DayZ 1.24
Loading...
Searching...
No Matches
SeedPackBase.c
Go to the documentation of this file.
2{
3 private static const float PACK_DAMAGE_TOLERANCE = 0.5;
4
6 {
7 }
8
10 {
11
12 string pack_type = GetType();
13 string seeds_type = "";
14
15 GetGame().ConfigGetText("cfgVehicles " + pack_type + " Horticulture ContainsSeedsType", seeds_type);
16
17 int seeds_quantity_max = GetGame().ConfigGetInt("cfgVehicles " + pack_type + " Horticulture ContainsSeedsQuantity");
19
20 seeds_quantity = Math.Round(seeds_quantity_max * GetHealth01("", ""));
21
22 if (seeds_quantity < 1)
24
25 if (player)
26 {
28 player.ServerReplaceItemInHandsWithNew(lambda);
29 }
30 else
31 {
32 vector pos = GetPosition();
33 GetGame().CreateObjectEx(seeds_type, pos, ECE_PLACE_ON_SURFACE);
34 GetGame().ObjectDelete(this);
35 }
36 }
37
38 override void SetActions()
39 {
40 super.SetActions();
41
43 }
44}
45
47{
49
54
56 {
57 super.CopyOldPropertiesToNew(old_item, new_item);
58
61 unboxed.SetQuantity(m_ItemCount);
62 }
63
65 {
66 super.OnSuccess(new_item);
67
68 //spawns wrapping Paper
69 ItemBase paper = ItemBase.Cast(GetGame().CreateObjectEx("Paper", new_item.GetHierarchyRoot().GetPosition(), ECE_PLACE_ON_SURFACE));
70 }
71};
eBleedingSourceType GetType()
void AddAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
class SeedPackBase extends Inventory_Base m_ItemCount
void EmptySeedsPackLambda(EntityAI old_item, string new_item_type, PlayerBase player, int count)
class JsonUndergroundAreaTriggerData GetPosition
Super root of all classes in Enforce script.
Definition EnScript.c:11
void SeedPackBase()
Definition SeedPackBase.c:5
void EmptySeedPack(PlayerBase player)
Definition SeedPackBase.c:9
override void SetActions()
Definition EnMath.c:7
base class for transformation operations (creating one item from another)
void OnSuccess(EntityAI new_item)
Step H. - notification on finish.
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Round(float f)
Returns mathematical round of value.