diff --git a/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/DefCore.txt b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/DefCore.txt new file mode 100644 index 000000000..1e14a1d74 --- /dev/null +++ b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/DefCore.txt @@ -0,0 +1,17 @@ +[DefCore] +id=Lichen +Version=5,2,0,1 +Category=C4D_StaticBack +Timer=350 +TimerCall=Seed +Width=25 +Height=25 +Offset=-12,-12 +Vertices=2 +VertexX=0,0 +VertexY=7,12 +VertexFriction=50,100 +VertexCNAT=16,8 +Components=Moss=4 +Mass=10 +BlastIncinerate=1 \ No newline at end of file diff --git a/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Graphics.8.png b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Graphics.8.png new file mode 100644 index 000000000..bd2621258 Binary files /dev/null and b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Graphics.8.png differ diff --git a/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Lichenpart.ocd/Graphics.png b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Lichenpart.ocd/Graphics.png new file mode 100644 index 000000000..031bc29b9 Binary files /dev/null and b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Lichenpart.ocd/Graphics.png differ diff --git a/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Lichenpart.ocd/Particle.txt b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Lichenpart.ocd/Particle.txt new file mode 100644 index 000000000..66e08b86f --- /dev/null +++ b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Lichenpart.ocd/Particle.txt @@ -0,0 +1,15 @@ +[Particle] +Name=Lichen +MaxCount=1500 +InitFn=StdInit +ExecFn=StdExec +DrawFn=Std +Face=0,0,64,64,-32,-32 +Delay=0 +Repeats=1 +GravityAcc=33 +VertexCount=1 +VertexY=0 +AlphaFade=15 +RByV=3 +Attach=0 \ No newline at end of file diff --git a/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Script.c b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Script.c new file mode 100644 index 000000000..0e790bd74 --- /dev/null +++ b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/Script.c @@ -0,0 +1,67 @@ +/*-- Lichen --*/ + +#include Library_Plant + +local grow_stage; + +private func SeedChance() { return 1000; } + +private func IsCrop() { return true; } + +protected func Initialize() +{ + SetAction("Grow"); +} + +protected func Grow() +{ + grow_stage++; +} + +public func Harvest(object clonk) +{ + var moss = CreateObject(Moss, 0, GetObjHeight()/2, NO_OWNER); + clonk->Collect(moss); + CreateParticle("Lichen", 0,0, 10, -2, 75, RGBa(128,128,128,255)); + CreateParticle("Lichen", 0,0,-10, -2, 75, RGBa(128,128,128,255)); + + if (grow_stage) + { + if (GetAction() != "Grow") SetAction("Grow"); + grow_stage--; + SetPhase(grow_stage); + } + else + RemoveObject(); + return true; +} + +local Name = "$Name$"; +local Description = "$Description$"; +local ActMap = { + Grow = { + Prototype = Action, + Name = "Grow", + Procedure = DFA_NONE, + Length = 4, + Delay = 2500, + X = 0, + Y = 0, + Wdt = 25, + Hgt = 25, + NextAction = "Grown", + PhaseCall = "Grow" + }, + Grown = { + Prototype = Action, + Name = "Grown", + Procedure = DFA_NONE, + Length = 1, + Delay = 0, + X = 75, + Y = 0, + Wdt = 25, + Hgt = 25, + NextAction = "Grown" + } +}; \ No newline at end of file diff --git a/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/StringTblDE.txt b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/StringTblDE.txt new file mode 100644 index 000000000..a3430e554 --- /dev/null +++ b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/StringTblDE.txt @@ -0,0 +1,2 @@ +Name=Flechte +Description=Bewuchert dunkle, feuchte Tunnel. Liefert Moos bei der Ernte. \ No newline at end of file diff --git a/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/StringTblUS.txt b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/StringTblUS.txt new file mode 100644 index 000000000..712360b1f --- /dev/null +++ b/planet/Objects.ocd/Environment.ocd/Vegetation.ocd/Lichen.ocd/StringTblUS.txt @@ -0,0 +1,2 @@ +Name=Lichen +Description=Sprawls in dark, wet tunnels. Gives moss when harvested. \ No newline at end of file diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/DefCore.txt b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/DefCore.txt new file mode 100644 index 000000000..e19d74e00 --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/DefCore.txt @@ -0,0 +1,19 @@ +[DefCore] +id=Moss +Version=5,2,0,1 +Category=C4D_Object +Width=8 +Height=8 +Offset=-4,-4 +Vertices=3 +VertexX=0,2,-2 +VertexY=1,-1,-1 +VertexFriction=75,75,75 +Value=1 +Mass=1 +Components=Moss=1 +ContactIncinerate=1 +BlastIncinerate=1 +Rotate=1 +Float=1 +Placement=3 \ No newline at end of file diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics.8.png b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics.8.png new file mode 100644 index 000000000..eaf4354d1 Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics.8.png differ diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics1.8.png b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics1.8.png new file mode 100644 index 000000000..e954b2bb6 Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics1.8.png differ diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics1Dry.8.png b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics1Dry.8.png new file mode 100644 index 000000000..eef4205b9 Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics1Dry.8.png differ diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics2.8.png b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics2.8.png new file mode 100644 index 000000000..163f68f52 Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics2.8.png differ diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics2Dry.8.png b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics2Dry.8.png new file mode 100644 index 000000000..95531db03 Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Graphics2Dry.8.png differ diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/GraphicsDry.8.png b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/GraphicsDry.8.png new file mode 100644 index 000000000..c85182c72 Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/GraphicsDry.8.png differ diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Script.c b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Script.c new file mode 100644 index 000000000..fcb45f90f --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/Script.c @@ -0,0 +1,120 @@ +/*-- + Moss + Authors: Mimmo, Clonkonaut +--*/ + +static const MOSS_MAXWETNESS = 30; // Moisture the moss can achieve. Dries out within 36*MOSS_MAXWETNESS frames +static const MOSS_MAXDIST = 50; // Used for various distance checks +local wetness; +local graphic; +local lastpos; + +func Initialize() +{ + graphic = Random(3); + if (graphic) + SetGraphics(Format("%d",graphic)); + + wetness = MOSS_MAXWETNESS; + lastpos = CreateArray(); + AddEffect("MossMoisture",this,100,36,this); +} + +public func ControlUse(object clonk, int x, int y, bool box) +{ + if(!clonk->~IsWalking()) return true; + // Search for ground + x = 0; y = 0; + if (GBackSemiSolid(x,y)) return true; + if (GetMaterial(x,y) != Material("Tunnel")) return true; + var i = 0; + while (!GBackSolid(x,y) && i < 15) { ++y; ++i; } + if (!GBackSolid(x,y)) return true; + if (GetMaterialVal("Soil", "Material", GetMaterial(x,y)) == 1) + { + // Plant! + clonk->DoKneel(); + CreateObject(Lichen, x, y, clonk->GetOwner()); + RemoveObject(); + } + else + clonk->Message("$NoSuitableGround$"); + + return true; +} + +/*-- Reproduction --*/ + +private func FxMossMoistureTimer(target, effect, time) +{ + if (GetMaterial() == Material("Water")) + { + + if (wetness < MOSS_MAXWETNESS) + { + wetness = MOSS_MAXWETNESS; + if(graphic) + SetGraphics(Format("%d",graphic)); + else + SetGraphics(); + } + } + else if (!Contained() && !GBackSolid() && !GBackLiquid()) + if (wetness) + { + wetness--; + // Fire nearby -> dry faster + if (FindObject(Find_Distance(100), Find_OCF(OCF_OnFire))) wetness--; + if (wetness <= 0) + { + wetness = 0; + if (graphic) + SetGraphics(Format("%dDry",graphic)); + else + SetGraphics("Dry"); + } + if ([GetX(),GetY()]==lastpos) + { + if (FindNearWater()) + TryToLichen(); + } + else + lastpos = [GetX(), GetY()]; + } +} + +protected func TryToLichen() +{ + if (GetMaterial() != Material("Tunnel")) return false; + var y = 0; + while (!GBackSolid(0,y) && y < 10) y++; + if (!GBackSolid(0,y)) return false; + if (!GetMaterialVal("Soil", "Material", GetMaterial(0,y))) return false; + if (FindObject(Find_ID(Lichen), Find_Distance(MOSS_MAXDIST))) return false; + + CreateObject(Lichen, 0, y, NO_OWNER); + RemoveObject(); + return true; +} + +// Moss only grows (on itself) if close to water +private func FindNearWater() +{ + // Take a random hit within the target area + var y = RandomX(-MOSS_MAXDIST, MOSS_MAXDIST); + for (var i = 0; i < MOSS_MAXDIST; i+=2) + { + if (GetMaterial(i, y) == Material("Water")) return true; + if (GetMaterial(-i,y) == Material("Water")) return true; + } + return false; +} + +/*-- Status --*/ + +public func IsFuel() { return !wetness; } +public func GetFuelAmount() { return 100; } + +local Collectible = 1; +local Name = "$Name$"; +local Description = "$Description$"; \ No newline at end of file diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/StringTblDE.txt b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/StringTblDE.txt new file mode 100644 index 000000000..7eb74c357 --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/StringTblDE.txt @@ -0,0 +1,3 @@ +Name=Moos +Description=Moos wächst unterirdisch nahe des Wassers. [Benutzen] zum Einpflanzen. Zum Trocknen Kontakt mit Wasser vermeiden. +NoSuitableGround=Untergrund ist zum|Anbau nicht geeignet! \ No newline at end of file diff --git a/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/StringTblUS.txt b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/StringTblUS.txt new file mode 100644 index 000000000..fec8904e4 --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Resources.ocd/Moss.ocd/StringTblUS.txt @@ -0,0 +1,3 @@ +Name=Moss +Description=Moss grows close to subterraen ponds. Press [Use] to plant. Keep away from water to dry. +NoSuitableGround=Ground not suitable|for planting! \ No newline at end of file