1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/**
Mushroom
Can be picked and eaten.
@author
*/
#include Library_Plant
#include Library_Edible
local plant_seed_chance = 17;
local plant_seed_area = 150;
local plant_seed_amount = 4;
local plant_seed_offset = 5;
private func Incineration()
{
SetClrModulation(RGB(48, 32, 32));
}
/*-- Initialization --*/
protected func Construction()
{
StartGrowth(3);
RootSurface();
this.MeshTransformation = Trans_Rotate(RandomX(0, 359), 0, 1, 0);
return _inherited(...);
}
public func RootSurface()
{
// First move up until unstuck.
var max_move = 30;
while (Stuck() && --max_move >= 0)
SetPosition(GetX(), GetY() - 1);
// Then move down until stuck.
max_move = 30;
while (!Stuck() && --max_move >= 0)
SetPosition(GetX(), GetY() + 1);
return;
}
/*-- Eating --*/
// Nutritional value depends on the completion of the mushroom.
public func NutritionalValue() { return GetCon() / 10; }
/*-- Display --*/
public func GetCarryMode()
{
return CARRY_Hand;
}
public func GetCarryTransform()
{
return Trans_Scale(750);
}
/*-- Properties --*/
local Name = "$Name$";
local Description = "$Description$";
local Collectible = true;
local BlastIncinerate = 5;
local ContactIncinerate = 1;
local Placement = 4;
|