Moss & Lichen added, Lichen graphic needed

Felix Wagner 2011-11-05 01:49:15 +00:00
parent 1478eaf152
commit 3da392888c
17 changed files with 248 additions and 0 deletions

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -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

View File

@ -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"
}
};

View File

@ -0,0 +1,2 @@
Name=Flechte
Description=Bewuchert dunkle, feuchte Tunnel. Liefert Moos bei der Ernte.

View File

@ -0,0 +1,2 @@
Name=Lichen
Description=Sprawls in dark, wet tunnels. Gives moss when harvested.

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -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$";

View File

@ -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!

View File

@ -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!