diff --git a/planet/Objects.ocd/Items.ocd/Foodstuff.ocd/CookedMushroom.ocd/Script.c b/planet/Objects.ocd/Items.ocd/Foodstuff.ocd/CookedMushroom.ocd/Script.c index b28518cf8..03115587a 100644 --- a/planet/Objects.ocd/Items.ocd/Foodstuff.ocd/CookedMushroom.ocd/Script.c +++ b/planet/Objects.ocd/Items.ocd/Foodstuff.ocd/CookedMushroom.ocd/Script.c @@ -12,7 +12,7 @@ protected func ControlUse(object clonk, int iX, int iY) clonk->Eat(this); } -public func NutritionalValue() { return 15; } +public func NutritionalValue() { return 25; } public func IsKitchenProduct() { return true; } public func GetFuelNeed() { return 50; } diff --git a/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/DefCore.txt b/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/DefCore.txt index f8ae39aee..aa9500759 100644 --- a/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/DefCore.txt +++ b/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/DefCore.txt @@ -3,11 +3,11 @@ id=Mushroom Version=6,0 Category=C4D_Object Width=12 -Height=20 -Offset=-6,-10 +Height=30 +Offset=-6,-15 Vertices=2 VertexX=0,0 -VertexY=1,4 +VertexY=10,14 VertexCNAT=16,8 VertexFriction=10,100 Mass=6 diff --git a/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c b/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c index a488a9ecd..ae26d2749 100644 --- a/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c +++ b/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c @@ -1,41 +1,62 @@ -/*-- Mushroom --*/ +/** + Mushroom + Can be picked and eaten. + + @author +*/ #include Library_Plant #include Library_Crop -private func SeedChance() { return 400; } +private func SeedChance() { return 600; } private func SeedArea() { return 150; } -private func SeedAmount() { return 6; } +private func SeedAmount() { return 4; } private func SeedOffset() { return 10; } -/* Initialisation */ +/*-- Initialization --*/ -func Construction() +protected func Construction() { 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 SickleHarvesting() { return false; } +public func IsHarvestable() +{ + // The mushroom is harvestable if it has grown a little. + return GetCon() >= 50; +} + public func Harvest(object clonk) { - this.Collectible = 1; + this.Collectible = true; clonk->Collect(this); return true; } public func IsInteractable(object clonk) { - return GetProperty("Collectible") != 1 && inherited(clonk); + return !this.Collectible && inherited(clonk); } public func GetInteractionMetaInfo(object clonk) @@ -43,17 +64,18 @@ public func GetInteractionMetaInfo(object clonk) return { Description = "$PickMushroom$" }; } -/* Eating */ +/*-- Eating --*/ protected func ControlUse(object clonk, int iX, int iY) { 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 Description = "$Description$"; local UsageHelp = "$UsageHelp$"; -local Collectible = 0; +local Collectible = false; local Placement = 4; \ No newline at end of file diff --git a/planet/Worlds.ocf/AcidRift.ocs/Script.c b/planet/Worlds.ocf/AcidRift.ocs/Script.c index 0ca38e078..6435158a2 100644 --- a/planet/Worlds.ocf/AcidRift.ocs/Script.c +++ b/planet/Worlds.ocf/AcidRift.ocs/Script.c @@ -137,9 +137,9 @@ private func InitVegetation(int map_size, int difficulty) Fern->Place(20, top); Fern->Place(20, middle); Fern->Place(20, bottom); - Mushroom->Place(14, top); - Mushroom->Place(14, middle); - Mushroom->Place(14, bottom); + Mushroom->Place(10, top); + Mushroom->Place(10, middle); + Mushroom->Place(10, bottom); // Some branches and trunks. Branch->Place(24 + Random(12)); diff --git a/planet/Worlds.ocf/Chine.ocs/Script.c b/planet/Worlds.ocf/Chine.ocs/Script.c index e8825c6e1..dfa1ab24d 100644 --- a/planet/Worlds.ocf/Chine.ocs/Script.c +++ b/planet/Worlds.ocf/Chine.ocs/Script.c @@ -183,9 +183,9 @@ private func InitVegetation(int map_size, int difficulty) Fern->Place(20, top); Fern->Place(20, middle); Fern->Place(20, bottom); - Mushroom->Place(14, top); - Mushroom->Place(14, middle); - Mushroom->Place(14, bottom); + Mushroom->Place(10, top); + Mushroom->Place(10, middle); + Mushroom->Place(10, bottom); // Some branches and trunks. Branch->Place(30 + 12 * map_size + Random(16)); diff --git a/planet/Worlds.ocf/FloodedVeins.ocs/Script.c b/planet/Worlds.ocf/FloodedVeins.ocs/Script.c index 54cf10591..35d866d82 100644 --- a/planet/Worlds.ocf/FloodedVeins.ocs/Script.c +++ b/planet/Worlds.ocf/FloodedVeins.ocs/Script.c @@ -166,7 +166,7 @@ private func InitVegetation(int map_size) // Cave entrance covered with mushrooms and bushes. SproutBerryBush->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. PlaceGrass(100); @@ -179,7 +179,7 @@ private func InitVegetation(int map_size) // Some ferns and mushrooms scattered around the top and middle sections. 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. PlaceBatches([Firestone], 3, 100, 5); diff --git a/planet/Worlds.ocf/IronPeak.ocs/Script.c b/planet/Worlds.ocf/IronPeak.ocs/Script.c index 1a0b7d4de..eb18a4836 100644 --- a/planet/Worlds.ocf/IronPeak.ocs/Script.c +++ b/planet/Worlds.ocf/IronPeak.ocs/Script.c @@ -131,7 +131,7 @@ private func InitVegetation(int map_size) LargeCaveMushroom->Place(5 + 2 * map_size + Random(5), nil, { terraform = false }); // Some mushrooms as source of food. - Mushroom->Place(30 + Random(10)); + Mushroom->Place(22 + Random(8)); // Some objects in the earth. PlaceObjects(Rock, 10 + 10 * map_size + Random(10),"Earth"); diff --git a/planet/Worlds.ocf/Krakatoa.ocs/Script.c b/planet/Worlds.ocf/Krakatoa.ocs/Script.c index cb3310ef7..08de75972 100644 --- a/planet/Worlds.ocf/Krakatoa.ocs/Script.c +++ b/planet/Worlds.ocf/Krakatoa.ocs/Script.c @@ -155,11 +155,9 @@ private func InitVegetation(int map_size) veg->SetR(RandomX(-20, 20)); } // Some mushrooms as source of food. - for (var i = 0; i < 30 + Random(5); i++) - PlaceVegetation(Mushroom, 0, 0, wdt, hgt); + Mushroom->Place(22 + Random(8)); // Some ferns, to be burned soon. - for (var i = 0; i < 25 + Random(5); i++) - PlaceVegetation(Fern, 0, 0, wdt, hgt); + Fern->Place(25 + Random(5)); // Branches as a nice additional source of wood. Branch->Place(30 + Random(8)); // Some objects in the earth.