forked from Mirrors/openclonk
parent
23accab0de
commit
ee3f3594db
|
@ -12,7 +12,7 @@ protected func ControlUse(object clonk, int iX, int iY)
|
||||||
clonk->Eat(this);
|
clonk->Eat(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public func NutritionalValue() { return 15; }
|
public func NutritionalValue() { return 25; }
|
||||||
|
|
||||||
public func IsKitchenProduct() { return true; }
|
public func IsKitchenProduct() { return true; }
|
||||||
public func GetFuelNeed() { return 50; }
|
public func GetFuelNeed() { return 50; }
|
||||||
|
|
|
@ -3,11 +3,11 @@ id=Mushroom
|
||||||
Version=6,0
|
Version=6,0
|
||||||
Category=C4D_Object
|
Category=C4D_Object
|
||||||
Width=12
|
Width=12
|
||||||
Height=20
|
Height=30
|
||||||
Offset=-6,-10
|
Offset=-6,-15
|
||||||
Vertices=2
|
Vertices=2
|
||||||
VertexX=0,0
|
VertexX=0,0
|
||||||
VertexY=1,4
|
VertexY=10,14
|
||||||
VertexCNAT=16,8
|
VertexCNAT=16,8
|
||||||
VertexFriction=10,100
|
VertexFriction=10,100
|
||||||
Mass=6
|
Mass=6
|
||||||
|
|
|
@ -1,41 +1,62 @@
|
||||||
/*-- Mushroom --*/
|
/**
|
||||||
|
Mushroom
|
||||||
|
Can be picked and eaten.
|
||||||
|
|
||||||
|
@author
|
||||||
|
*/
|
||||||
|
|
||||||
#include Library_Plant
|
#include Library_Plant
|
||||||
#include Library_Crop
|
#include Library_Crop
|
||||||
|
|
||||||
private func SeedChance() { return 400; }
|
private func SeedChance() { return 600; }
|
||||||
private func SeedArea() { return 150; }
|
private func SeedArea() { return 150; }
|
||||||
private func SeedAmount() { return 6; }
|
private func SeedAmount() { return 4; }
|
||||||
private func SeedOffset() { return 10; }
|
private func SeedOffset() { return 10; }
|
||||||
|
|
||||||
/* Initialisation */
|
/*-- Initialization --*/
|
||||||
|
|
||||||
func Construction()
|
protected func Construction()
|
||||||
{
|
{
|
||||||
StartGrowth(3);
|
StartGrowth(3);
|
||||||
_inherited(...);
|
RootSurface();
|
||||||
|
this.MeshTransformation = Trans_Mul(Trans_Translate(0, 10000, 0), Trans_Rotate(RandomX(0, 359), 0, 1, 0));
|
||||||
|
return _inherited(...);
|
||||||
}
|
}
|
||||||
|
|
||||||
private func Initialize()
|
public func RootSurface()
|
||||||
{
|
{
|
||||||
SetProperty("MeshTransformation", Trans_Rotate(RandomX(0,359),0,1,0));
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Harvesting */
|
/*-- Harvesting --*/
|
||||||
|
|
||||||
private func IsCrop() { return true; }
|
private func IsCrop() { return true; }
|
||||||
private func SickleHarvesting() { return false; }
|
private func SickleHarvesting() { return false; }
|
||||||
|
|
||||||
|
public func IsHarvestable()
|
||||||
|
{
|
||||||
|
// The mushroom is harvestable if it has grown a little.
|
||||||
|
return GetCon() >= 50;
|
||||||
|
}
|
||||||
|
|
||||||
public func Harvest(object clonk)
|
public func Harvest(object clonk)
|
||||||
{
|
{
|
||||||
this.Collectible = 1;
|
this.Collectible = true;
|
||||||
clonk->Collect(this);
|
clonk->Collect(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public func IsInteractable(object clonk)
|
public func IsInteractable(object clonk)
|
||||||
{
|
{
|
||||||
return GetProperty("Collectible") != 1 && inherited(clonk);
|
return !this.Collectible && inherited(clonk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public func GetInteractionMetaInfo(object clonk)
|
public func GetInteractionMetaInfo(object clonk)
|
||||||
|
@ -43,17 +64,18 @@ public func GetInteractionMetaInfo(object clonk)
|
||||||
return { Description = "$PickMushroom$" };
|
return { Description = "$PickMushroom$" };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Eating */
|
/*-- Eating --*/
|
||||||
|
|
||||||
protected func ControlUse(object clonk, int iX, int iY)
|
protected func ControlUse(object clonk, int iX, int iY)
|
||||||
{
|
{
|
||||||
clonk->Eat(this);
|
clonk->Eat(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public func NutritionalValue() { return 5; }
|
// Nutritional value depends on the completion of the mushroom.
|
||||||
|
public func NutritionalValue() { return 3 * GetCon() / 20; }
|
||||||
|
|
||||||
local Name = "$Name$";
|
local Name = "$Name$";
|
||||||
local Description = "$Description$";
|
local Description = "$Description$";
|
||||||
local UsageHelp = "$UsageHelp$";
|
local UsageHelp = "$UsageHelp$";
|
||||||
local Collectible = 0;
|
local Collectible = false;
|
||||||
local Placement = 4;
|
local Placement = 4;
|
|
@ -137,9 +137,9 @@ private func InitVegetation(int map_size, int difficulty)
|
||||||
Fern->Place(20, top);
|
Fern->Place(20, top);
|
||||||
Fern->Place(20, middle);
|
Fern->Place(20, middle);
|
||||||
Fern->Place(20, bottom);
|
Fern->Place(20, bottom);
|
||||||
Mushroom->Place(14, top);
|
Mushroom->Place(10, top);
|
||||||
Mushroom->Place(14, middle);
|
Mushroom->Place(10, middle);
|
||||||
Mushroom->Place(14, bottom);
|
Mushroom->Place(10, bottom);
|
||||||
|
|
||||||
// Some branches and trunks.
|
// Some branches and trunks.
|
||||||
Branch->Place(24 + Random(12));
|
Branch->Place(24 + Random(12));
|
||||||
|
|
|
@ -183,9 +183,9 @@ private func InitVegetation(int map_size, int difficulty)
|
||||||
Fern->Place(20, top);
|
Fern->Place(20, top);
|
||||||
Fern->Place(20, middle);
|
Fern->Place(20, middle);
|
||||||
Fern->Place(20, bottom);
|
Fern->Place(20, bottom);
|
||||||
Mushroom->Place(14, top);
|
Mushroom->Place(10, top);
|
||||||
Mushroom->Place(14, middle);
|
Mushroom->Place(10, middle);
|
||||||
Mushroom->Place(14, bottom);
|
Mushroom->Place(10, bottom);
|
||||||
|
|
||||||
// Some branches and trunks.
|
// Some branches and trunks.
|
||||||
Branch->Place(30 + 12 * map_size + Random(16));
|
Branch->Place(30 + 12 * map_size + Random(16));
|
||||||
|
|
|
@ -166,7 +166,7 @@ private func InitVegetation(int map_size)
|
||||||
// Cave entrance covered with mushrooms and bushes.
|
// Cave entrance covered with mushrooms and bushes.
|
||||||
SproutBerryBush->Place(4, Rectangle(0, 120, 100, 40));
|
SproutBerryBush->Place(4, Rectangle(0, 120, 100, 40));
|
||||||
Fern->Place(4, Rectangle(0, 120, 100, 40));
|
Fern->Place(4, Rectangle(0, 120, 100, 40));
|
||||||
Mushroom->Place(8, Rectangle(0, 120, 100, 40));
|
Mushroom->Place(6, Rectangle(0, 120, 100, 40));
|
||||||
|
|
||||||
// The cavern has some grass wherever possible.
|
// The cavern has some grass wherever possible.
|
||||||
PlaceGrass(100);
|
PlaceGrass(100);
|
||||||
|
@ -179,7 +179,7 @@ private func InitVegetation(int map_size)
|
||||||
|
|
||||||
// Some ferns and mushrooms scattered around the top and middle sections.
|
// Some ferns and mushrooms scattered around the top and middle sections.
|
||||||
Fern->Place(12, Rectangle(0, 0, wdt, 3 * hgt / 8));
|
Fern->Place(12, Rectangle(0, 0, wdt, 3 * hgt / 8));
|
||||||
Mushroom->Place(20, Rectangle(0, 0, wdt, 3 * hgt / 8));
|
Mushroom->Place(14, Rectangle(0, 0, wdt, 3 * hgt / 8));
|
||||||
|
|
||||||
// Create earth materials in big clusters so the whole object arrangement looks a bit less uniform and more interesting.
|
// Create earth materials in big clusters so the whole object arrangement looks a bit less uniform and more interesting.
|
||||||
PlaceBatches([Firestone], 3, 100, 5);
|
PlaceBatches([Firestone], 3, 100, 5);
|
||||||
|
|
|
@ -131,7 +131,7 @@ private func InitVegetation(int map_size)
|
||||||
LargeCaveMushroom->Place(5 + 2 * map_size + Random(5), nil, { terraform = false });
|
LargeCaveMushroom->Place(5 + 2 * map_size + Random(5), nil, { terraform = false });
|
||||||
|
|
||||||
// Some mushrooms as source of food.
|
// Some mushrooms as source of food.
|
||||||
Mushroom->Place(30 + Random(10));
|
Mushroom->Place(22 + Random(8));
|
||||||
|
|
||||||
// Some objects in the earth.
|
// Some objects in the earth.
|
||||||
PlaceObjects(Rock, 10 + 10 * map_size + Random(10),"Earth");
|
PlaceObjects(Rock, 10 + 10 * map_size + Random(10),"Earth");
|
||||||
|
|
|
@ -155,11 +155,9 @@ private func InitVegetation(int map_size)
|
||||||
veg->SetR(RandomX(-20, 20));
|
veg->SetR(RandomX(-20, 20));
|
||||||
}
|
}
|
||||||
// Some mushrooms as source of food.
|
// Some mushrooms as source of food.
|
||||||
for (var i = 0; i < 30 + Random(5); i++)
|
Mushroom->Place(22 + Random(8));
|
||||||
PlaceVegetation(Mushroom, 0, 0, wdt, hgt);
|
|
||||||
// Some ferns, to be burned soon.
|
// Some ferns, to be burned soon.
|
||||||
for (var i = 0; i < 25 + Random(5); i++)
|
Fern->Place(25 + Random(5));
|
||||||
PlaceVegetation(Fern, 0, 0, wdt, hgt);
|
|
||||||
// Branches as a nice additional source of wood.
|
// Branches as a nice additional source of wood.
|
||||||
Branch->Place(30 + Random(8));
|
Branch->Place(30 + Random(8));
|
||||||
// Some objects in the earth.
|
// Some objects in the earth.
|
||||||
|
|
Loading…
Reference in New Issue