5 void PluginHorticulture()
14 string cfg_access =
"CfgHorticulture";
15 int cfg_horticulture_count =
GetGame().ConfigGetChildrenCount( cfg_access );
17 for (
int i = 0; i < cfg_horticulture_count; i++ )
19 string cfg_class_name =
"";
20 GetGame().ConfigGetChildName( cfg_access, i, cfg_class_name );
21 string cfg_class_access = cfg_access +
" " + cfg_class_name;
23 int cfg_class_count =
GetGame().ConfigGetChildrenCount( cfg_class_access );
25 for (
int j = 0; j < cfg_class_count; j++ )
27 string cfg_subclass_name =
"";
28 GetGame().ConfigGetChildName( cfg_class_access, j, cfg_subclass_name );
29 string cfg_subclass_access = cfg_class_access +
" " + cfg_subclass_name;
31 int cfg_subclass_count =
GetGame().ConfigGetChildrenCount( cfg_subclass_access );
35 if ( cfg_class_name ==
"Plants" )
38 m_PlantMaterials.Set( cfg_subclass_name, plantMaterialHealth );
41 for (
int k = 0; k < cfg_subclass_count; k++ )
43 string cfg_variable_name =
"";
44 GetGame().ConfigGetChildName( cfg_subclass_access, k, cfg_variable_name );
45 string cfg_variable_access = cfg_subclass_access +
" " + cfg_variable_name;
47 if ( cfg_class_name ==
"Plants" )
49 string string_param =
"";
50 GetGame().ConfigGetText( cfg_variable_access, string_param );
52 if ( cfg_variable_name ==
"infestedTex" )
54 plantMaterialHealth.m_InfestedTex = string_param;
56 else if ( cfg_variable_name ==
"infestedMat" )
58 plantMaterialHealth.m_InfestedMat = string_param;
60 else if ( cfg_variable_name ==
"healthyTex" )
62 plantMaterialHealth.m_HealthyTex = string_param;
64 else if ( cfg_variable_name ==
"healthyMat" )
66 plantMaterialHealth.m_HealthyMat = string_param;
74 string GetPlantType(
Object obj )
76 string seed_type = obj.GetType();
78 string plant_type =
"";
79 GetGame().ConfigGetText(
"cfgVehicles " + seed_type +
" Horticulture PlantType", plant_type );
84 float GetSurfaceFertility(
string surface_type )
86 float fertility = 0.8;
87 if ( surface_type ==
"hlina" || surface_type ==
"CRGrass1" || surface_type ==
"CRGrass2" || surface_type ==
"CRForest1" || surface_type ==
"CRForest2" || surface_type ==
"CRGrit1" )
95 bool GiveWormsToPlayer(
PlayerBase player,
float chance )
97 if (
Math.RandomFloat01() <= chance )
99 ItemBase item =
ItemBase.Cast( player.GetHumanInventory().CreateInInventory(
"Food_Worm") );
100 item.SetQuantity( 1 );
109 if ( m_PlantMaterials.Contains(plant_type) )
111 return m_PlantMaterials.Get(plant_type);