Added wooden barrel; set CastPXS defaults to 360 spread and shoot up.

The reason for the latter is that CastPXS("Material", 1000, 100)
would fire to the right in a semicircle... didn't seem like a logical default.
Charles Spurrill 2009-11-23 23:07:00 -08:00
parent 9ef7fc0d96
commit fdc3a7ee93
13 changed files with 108 additions and 4 deletions

View File

@ -31,6 +31,8 @@ protected func Initialize()
{
SetPosition(GetX(),GetY()-1);
}
if(Stuck()) RemoveObject();
}
public func Precipitation()
@ -147,7 +149,7 @@ private func WindDirection()
var iWind = GetWind();
if(iWind >= 7) SetXDir(Random(355),1000);
if(iWind <= -7) SetXDir(Random(-355),1000);
if(iWind <= -7) SetXDir(-Random(355),1000);
if(iWind < 6 && iWind > -6) SetXDir();
}

View File

@ -32,6 +32,7 @@ protected func Initialize()
if(FindPosInMat(iX, iY, "Sky", 0,0,LandscapeWidth(), LandscapeHeight()) &&
MaterialDepthCheck(iX,iY,"Sky",200)==true) CreateObject(CLOD, iX, iY, NO_OWNER) && (iCount=--iCount);
}
AdjustLightningFrequency(GetScenarioVal("Lightning"));
}
global func MaterialDepthCheck(int iX,int iY,string szMaterial,int iDepth)

View File

@ -0,0 +1,21 @@
[DefCore]
id=BARL
Version=4,10,0,0
Category=C4D_Object|C4D_SelectMaterial|C4D_SelectKnowledge|C4D_SelectHomebase
MaxUserSelect=5
Value=16
Mass=20
TimerCall=Check
Width=16
Height=16
Offset=-8,-8
Vertices=4
VertexX=-2,2,-2,2
VertexY=-7,-7,7,7
VertexFriction=60,60,60,60
Components=WOOD=1;METL=1;
Rebuy=1
Collectible=1
Rotate=1
Float=1

View File

@ -0,0 +1 @@
A sturdy wooden barrel, useful for carrying water.

View File

@ -0,0 +1 @@
A sturdy wooden barrel, useful for carrying water.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,76 @@
/*-- Wooden Barrel --*/
#strict 2
local szLiquid;
local iVolume;
local Closed;
local debug;
protected func Initialize()
{
iVolume=0;
Closed=false;
debug=1;
}
private func Hit()
{
Sound("WoodHit");
if(iVolume>=1 && Closed==false)
{
EmptyBarrel(GetR());
Sound(" "); //water splash sound should be added when available -Ringwaul
//Debug/Testing Purposes
if(debug == 1) Message("Volume|%d|Liquid|%s", this(), iVolume, szLiquid);
}
}
private func Check()
{
if(GetMaterial(0,2)== Material("Water"))
{
FillBarrel("Water");
}
if(iVolume==0) SetGraphics() && szLiquid=nil;
}
private func FillBarrel(string szMat)
{
var iCapacity=300;
if(iVolume>=1 && szMat!=szLiquid) return 0;
while(iVolume!=iCapacity && GetMaterial(0,2)== Material(szMat)) ExtractLiquid(0,2) && (iVolume=++iVolume);
szLiquid=szMat;
//Debug/Testing Purposes
if(debug == 1) Message("Volume|%d|Liquid|%s", this(), iVolume, szLiquid);
}
private func EmptyBarrel(int iAngle, int iStrength)
{
if(!iAngle) iAngle=0;
if(!iStrength) iStrength=30;
CastPXS(szLiquid, iVolume,iStrength,0,0,iAngle,30);
iVolume=0;
}
public func ControlUse(object pByClonk, int iX, int iY)
{
//var AimAngle=Angle(GetX(),GetY(), iX, iY);
//EmptyBarrel(AimAngle);
if(Contained()->GetDir() == 0) EmptyBarrel(45, 40);
if(Contained()->GetDir() == 1) EmptyBarrel(-45, 40);
}
public func IsTool() { return 0; }
public func IsToolProduct() { return 1; }
func Definition(def) {
SetProperty("Collectible", 1, def);
SetProperty("Name", "$Name$", def);
}

View File

@ -0,0 +1 @@
Name=Holzfass

View File

@ -0,0 +1 @@
Name=Wooden Barrel

View File

@ -9,7 +9,7 @@ Offset=-3,-3
Vertices=3
VertexX=0,1,-1
VertexY=1,-1,-1
VertexFriction=100
VertexFriction=40,40,40
Value=25
Mass=12
Components=GOLD=1

View File

@ -144,9 +144,9 @@ global func CastObjects(iddef,am,lev,x,y,angs,angw) {
}
global func CastPXS(string mat,int am,int lev,int x,int y,int angs,int angw) {
if(!angw) angw = 180;
if(!angw) angw = 360;
for(var i=0;i<am;i++) {
var ang = angs + RandomX(-angw/2,angw/2);
var ang = angs-90 + RandomX(-angw/2,angw/2);
InsertMaterial(Material(mat),x,y,Cos(ang,lev)+RandomX(-3,3),Sin(ang,lev)+RandomX(-3,3));
}
}