forked from Mirrors/openclonk
Objects: Added a waterfall and drain
parent
9c73e68871
commit
ff47339e80
Binary file not shown.
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
@ -19,17 +19,47 @@ protected func Initialize()
|
|||
|
||||
// Objects fade after 5 seconds.
|
||||
CreateObject(Rule_ObjectFade)->DoFadeTime(7 * 36);
|
||||
|
||||
// Some decoration trunks ranks and a waterfall.
|
||||
var trunk = CreateObject(Trunk, 76, 324);
|
||||
trunk->SetR(60); trunk.Plane = 510;
|
||||
trunk.MeshTransformation = [-731, 0, 682, 0, 0, 1000, 0, 0, -682, 0, -731, 0];
|
||||
trunk = CreateObject(Trunk, 123, 68);
|
||||
trunk->SetR(115); trunk.Plane = 510;
|
||||
trunk.MeshTransformation = [469, 0, 883, 0, 0, 1000, 0, 0, -883, 0, 469, 0];
|
||||
trunk = CreateObject(Trunk, 172, 134);
|
||||
trunk->SetR(-110); trunk.Plane = 510;
|
||||
trunk.MeshTransformation = [-545, 0, -839, 0, 0, 1000, 0, 0, 839, 0, -545, 0];
|
||||
|
||||
var waterfall;
|
||||
waterfall = CreateWaterfall(130, 53, 2, "Water");
|
||||
waterfall->SetDirection(4, 0, 3, 6);
|
||||
waterfall = CreateWaterfall(144, 50, 8, "Water");
|
||||
waterfall->SetDirection(6, 0, 5, 6);
|
||||
CreateLiquidDrain(100, 315, 10);
|
||||
CreateLiquidDrain(130, 315, 10);
|
||||
CreateLiquidDrain(160, 315, 10);
|
||||
|
||||
CreateObject(Fern, 48, 114);
|
||||
CreateObject(Fern, 284, 128);
|
||||
CreateObject(Lorry, 294, 128)->SetR(20);
|
||||
CreateObject(Pickaxe, 260, 128)->SetR(-45);
|
||||
CreateObject(Mushroom, 271, 136);
|
||||
|
||||
CreateObject(Rank, 146, 302)->SetR(180);
|
||||
CreateObject(Rank, 198, 190)->SetR(225);
|
||||
CreateObject(Rank, 54, 66)->SetR(180);
|
||||
CreateObject(Rank, 42, 232)->SetR(120);
|
||||
CreateObject(Rank, 269, 230)->SetR(-120);
|
||||
|
||||
for (var i = 0; i < 2 + Random(6); i++)
|
||||
CreateObject(Rank, 114, 10 + Random(140))->SetR(RandomX(60, 120));
|
||||
for (var i = 0; i < 2 + Random(6); i++)
|
||||
CreateObject(Rank, 190, 10 + Random(140))->SetR(-RandomX(60, 120));
|
||||
|
||||
//Water needs to be OK
|
||||
AddEffect("Refiller",nil,100,6);
|
||||
return;
|
||||
}
|
||||
|
||||
global func FxRefillerTimer(object pTarget, effect, int timer)
|
||||
{
|
||||
for(var i=0; i<10; i++) if(!GBackLiquid(100,315)) InsertMaterial(Material("Water"),135,385);
|
||||
}
|
||||
|
||||
// Gamecall from LastManStanding goal, on respawning.
|
||||
protected func OnPlayerRelaunch(int plr)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[DefCore]
|
||||
id=Waterfall
|
||||
Version=5,2,0,1
|
||||
Category=C4D_StaticBack
|
Binary file not shown.
After Width: | Height: | Size: 142 B |
|
@ -0,0 +1,117 @@
|
|||
/*--
|
||||
Waterfall
|
||||
Author: Maikel
|
||||
|
||||
Waterfall object, use to place waterfalls in the landscape.
|
||||
--*/
|
||||
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*-- Waterfall --*/
|
||||
|
||||
global func CreateWaterfall(int x, int y, int strength, string mat)
|
||||
{
|
||||
var fall = CreateObject(Waterfall, x, y, NO_OWNER);
|
||||
AddEffect("IntWaterfall", fall, 100, 1, fall, nil, x, y, strength, mat);
|
||||
return fall;
|
||||
}
|
||||
|
||||
protected func FxIntWaterfallStart(object target, proplist effect, int temporary, int x, int y, int strength, string mat)
|
||||
{
|
||||
if (temporary)
|
||||
return 1;
|
||||
effect.X = x;
|
||||
effect.Y = y;
|
||||
effect.Strength = strength;
|
||||
effect.Material = mat;
|
||||
// Start sound.
|
||||
target->Sound("Waterfall", false, 10 * effect.Strength, nil, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func FxIntWaterfallTimer(object target, proplist effect)
|
||||
{
|
||||
// Insert liquid at location every frame.
|
||||
for (var i = 0; i < effect.Strength / 2; i++)
|
||||
InsertMaterial(Material("Water"), AbsX(effect.X), AbsY(effect.Y), effect.XDir + Random(effect.XVar), effect.YDir + Random(effect.YVar));
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func FxIntWaterfallStop(object target, proplist effect, bool temporary)
|
||||
{
|
||||
if (temporary)
|
||||
return 1;
|
||||
// Stop sound.
|
||||
target->Sound("Waterfall", false, 10 * effect.Strength, nil, -1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public func SetStrength(int strength)
|
||||
{
|
||||
var effect = GetEffect("IntWaterfall", this);
|
||||
if (effect)
|
||||
effect.Strength = BoundBy(strength, 0, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
public func SetMaterial(int material)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public func SetDirection(int xdir, int ydir, int xvar, int yvar)
|
||||
{
|
||||
var effect = GetEffect("IntWaterfall", this);
|
||||
if (effect)
|
||||
{
|
||||
effect.XDir = xdir;
|
||||
effect.YDir = ydir;
|
||||
effect.XVar = xvar;
|
||||
effect.YVar = yvar;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public func SetSoundLocation(int x, int y)
|
||||
{
|
||||
SetPosition(x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-- Liquid Drain --*/
|
||||
|
||||
global func CreateLiquidDrain(int x, int y, int strength)
|
||||
{
|
||||
var drain = CreateObject(Waterfall, x, y, NO_OWNER);
|
||||
AddEffect("IntLiquidDrain", drain, 100, 1, drain, nil, x, y, strength);
|
||||
return drain;
|
||||
}
|
||||
|
||||
protected func FxIntLiquidDrainStart(object target, proplist effect, int temporary, int x, int y, int strength)
|
||||
{
|
||||
if (temporary)
|
||||
return 1;
|
||||
effect.X = x;
|
||||
effect.Y = y;
|
||||
effect.Strength = strength;
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func FxIntLiquidDrainTimer(object target, proplist effect)
|
||||
{
|
||||
for (var i = 0; i < effect.Strength / 2; i++)
|
||||
ExtractLiquid(AbsX(effect.X), AbsY(effect.Y));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
local Name = "$Name$";
|
|
@ -0,0 +1 @@
|
|||
Name=Wasserfall
|
|
@ -0,0 +1 @@
|
|||
Name=Waterfall
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
Waterfall.wav by volivieri CC-BY-3.0 (http://www.freesound.org/people/volivieri/sounds/38390/)
|
|
@ -47,7 +47,7 @@ protected func Initialize()
|
|||
Cloud->Place(20);
|
||||
CreateObject(Environment_Celestial);
|
||||
var time = CreateObject(Environment_Time);
|
||||
time->SetTime(1125);
|
||||
time->SetTime(60*22);
|
||||
time->SetCycleSpeed(0);
|
||||
|
||||
// A light blue hue, to indicate the cold climate.
|
||||
|
|
|
@ -36,6 +36,12 @@ func Initialize()
|
|||
var dark = 40;
|
||||
SetSkyAdjust(RGB(150, 42, 0));
|
||||
SetGamma(RGB(0,0,0), RGB(128-dark,128-dark,128-dark), RGB(255-2*dark,255-2*dark,255-2*dark));
|
||||
|
||||
// Time of days and celestials.
|
||||
CreateObject(Environment_Celestial);
|
||||
var time = CreateObject(Environment_Time);
|
||||
time->SetTime(60*20);
|
||||
time->SetCycleSpeed(20);
|
||||
|
||||
// Some dark clouds which rain few ashes.
|
||||
Cloud->Place(15);
|
||||
|
|
Loading…
Reference in New Issue