62 string plant_type = this.
GetType();
63 m_GrowthStagesCount =
GetGame().
ConfigGetInt(
"cfgVehicles " + plant_type +
" Horticulture GrowthStagesCount" );
80 RegisterNetSyncVariableBool(
"m_HasCrops");
81 RegisterNetSyncVariableInt(
"m_PlantState");
82 RegisterNetSyncVariableInt(
"m_PlantStateIndex");
102 void Init(
GardenBase garden_base,
float fertility,
float harvesting_efficiency,
float water )
124 float count =
m_CropsCount * fertility * harvesting_efficiency;
137 if (rain_intensity <= 0.0)
179 if ( !super.OnStoreLoad( ctx, version ) )
185 ctx.
Read( slot_index );
187 Slot slot = garden.GetSlotByIndex(slot_index);
199 super.OnStoreSave( ctx );
205 int slot_index = slot.GetSlotIndex();
208 ctx.
Write( slot_index );
215 Print(
"Warning! A plant existed without a garden. Therefore it was deleted from the world to prevent issues!");
228 if ( !ctx.
Read( loadInt ) )
234 if ( !ctx.
Read( loadInt ) )
240 if ( !ctx.
Read( loadInt ) )
245 if ( !ctx.
Read( loadInt ) )
250 if ( !ctx.
Read( loadInt ) )
255 if ( !ctx.
Read( loadInt ) )
259 float loadFloat = 0.0;
260 if ( !ctx.
Read( loadFloat ) )
265 if ( !ctx.
Read( loadInt ) )
270 if ( !ctx.
Read( loadInt ) )
274 string loadString =
"";
275 if ( !ctx.
Read( loadString ) )
280 if ( !ctx.
Read( loadFloat ) )
285 if ( !ctx.
Read( loadInt ) )
290 if ( !ctx.
Read( loadInt ) )
295 if ( !ctx.
Read( loadFloat ) )
299 bool loadBool =
false;
300 if ( !ctx.
Read( loadBool ) )
305 if ( !ctx.
Read( loadFloat ) )
312 if ( ctx.
Read( loadBool ) )
323 if ( ctx.
Read( loadFloat ) )
325 if ( loadFloat > 0.0 )
334 if ( ctx.
Read( loadFloat ) )
336 if ( loadFloat > 0.0 )
345 if ( ctx.
Read( loadFloat ) )
347 if ( loadFloat > 0.0 )
356 if ( ctx.
Read( loadFloat ) )
358 if ( loadFloat > 0.0 )
405 bool saveBool =
false;
406 ctx.
Write( saveBool );
408 float saveFloat = 0.0;
409 ctx.
Write( saveFloat );
416 ctx.
Write( saveFloat );
423 ctx.
Write( saveFloat );
430 ctx.
Write( saveFloat );
435 Print(
"PRINT ALL VALUES OF PLANT...");
446 Print(
"----------------------------------------------------------");
451 return super.CanPutInCargo(parent);
456 return super.CanPutIntoHands(parent);
503 ShowSelection(
"plantStage_" + plant_state_index );
504 HideSelection(
"plantStage_" + prev_plant_state_index );
510 ShowSelection(
"plantStage_" + plant_state_index +
"_crops" );
511 HideSelection(
"plantStage_" + prev_plant_state_index +
"_crops" );
515 HideSelection(
"plantStage_" + plant_state_index +
"_crops" );
516 HideSelection(
"plantStage_" + prev_plant_state_index +
"_crops" );
520 ShowSelection(
"plantStage_" + plant_state_index +
"_shadow" );
521 HideSelection(
"plantStage_" + prev_plant_state_index +
"_shadow" );
601 return "I've sprayed the plant a bit. Now it is enough spayed.";
605 return "I've sprayed the plant a bit.";
641 vector pos = player.GetPosition();
680 return GetSlot().GetWaterUsage();
710 garden.RemoveSlotPlant(
this );
771 if (spoilRemove != 0)
eBleedingSourceType GetType()
void AddAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
string ToStringLen(int len)
Integer to string with fixed length, padded with zeroes.
override bool CanPutInCargo(EntityAI parent)
override bool CanPutIntoHands(EntityAI parent)
override bool CanRemoveFromHands(EntityAI parent)
override void SetTakeable(bool pState)
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
void OnStoreSave(ParamsWriteContext ctx)
bool OnStoreLoad(ParamsReadContext ctx, int version)
static const int STATE_GROWING
void OnStoreSaveCustom(ParamsWriteContext ctx)
PluginHorticulture m_ModuleHorticulture
void InfestationTimerTick()
ref Timer m_InfestationTimer
float m_InfestationChance
enum EPlantState m_SprayUsage
void SprayPlant(float consumed_quantity)
void ChangeInfestation(bool is_infested)
float m_PlantMaterialMultiplier
static int m_DebugFullMaturityTime
void DebugSetTimes(int maturity, int spoil, int spoilRemove, int dryDelete)
const float SPOIL_AFTER_MATURITY_TIME
ref Timer m_SpoiledRemoveTimer
static int m_DebugDeleteDryTime
ref Timer m_DeleteDryPlantTimer
void SpoiledRemoveTimerTick()
void RemovePlantEx(vector pos)
static int m_DebugSpoilTime
static void DebugSetTickSpeedMultiplier(float multiplier)
static const int STATE_SPOILED
static void DebugSetGlobalTimes(int maturity, int spoil, int spoilRemove, int dryDelete)
EPlantState GetPlantState()
static float m_DebugTickSpeedMultiplier
static int m_DebugSpoilRemoveTime
float m_CurrentPlantMaterialQuantity
static const int STATE_DRY
ref Timer m_SpoilAfterFullMaturityTimer
static const int STATE_MATURE
void DeleteDryPlantTick()
bool OnStoreLoadCustom(ParamsReadContext ctx, int version)
int m_SpoilAfterFullMaturityTime
void SetPlantState(int state)
void Harvest(PlayerBase player)
string StopInfestation(float consumed_quantity)
PluginBase GetPlugin(typename plugin_type)
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native Weather GetWeather()
Returns weather controller object.
proto native void ObjectDelete(Object obj)
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native float GetActual()
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
proto void Print(void var)
Prints content of variable to console/log.
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto float Ceil(float f)
Returns ceil of value.