DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
SeedPackBase.c
См. документацию.
2{
3 private static const float PACK_DAMAGE_TOLERANCE = 0.5;
4
6 {
7 }
8
10 {
11 string pack_type = GetType();
12 string seeds_type = "";
13
14 GetGame().ConfigGetText("cfgVehicles " + pack_type + " Horticulture ContainsSeedsType", seeds_type);
15
16 int seeds_quantity_max = GetGame().ConfigGetInt("cfgVehicles " + pack_type + " Horticulture ContainsSeedsQuantity");
17 int seeds_quantity = seeds_quantity_max;
18
19 seeds_quantity = Math.Round(seeds_quantity_max * GetHealth01("",""));
20
21 if (seeds_quantity < 1)
22 {
23 seeds_quantity = 1;
24 }
25
26 if (player)
27 {
28 EmptySeedsPackLambda lambda = new EmptySeedsPackLambda(this, seeds_type, player, seeds_quantity);
29 player.ServerReplaceItemInHandsWithNew(lambda);
30 }
31 else
32 {
33 vector pos = GetPosition();
35 GetGame().ObjectDelete(this);
36 }
37 }
38
39 override void SetActions()
40 {
41 super.SetActions();
42
44 }
45}
46
48{
51
52 void EmptySeedsPackLambda(EntityAI old_item, string new_item_type, PlayerBase player, int count)
53 {
54 m_ItemCount = count;
55 m_Player = player;
56 }
57
58 override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
59 {
60 super.CopyOldPropertiesToNew(old_item, new_item);
61
62 ItemBase unboxed;
63 Class.CastTo(unboxed, new_item);
64 unboxed.SetQuantity(m_ItemCount);
65 }
66
67 override void OnSuccess(EntityAI new_item)
68 {
69 super.OnSuccess(new_item);
70
71 //spawns wrapping Paper
72 if (m_Player)
73 {
74 m_Player.SpawnEntityOnGroundRaycastDispersed("Paper",DEFAULT_SPAWN_DISTANCE,UAItemsSpreadRadius.NARROW);
75 }
76 else
77 {
78 GetGame().CreateObjectEx("Paper", new_item.GetHierarchyRoot().GetPosition(), ECE_PLACE_ON_SURFACE);
79 }
80 }
81};
eBleedingSourceType GetType()
Определения BleedingSource.c:63
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
DayZPlayer m_Player
Определения Hand_Events.c:42
const float DEFAULT_SPAWN_DISTANCE
Определения RecipeBase.c:3
class SeedPackBase extends Inventory_Base m_ItemCount
void EmptySeedsPackLambda(EntityAI old_item, string new_item_type, PlayerBase player, int count)
Определения SeedPackBase.c:52
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 Object CreateObjectEx(string type, vector pos, int iFlags, int iRotation=RF_DEFAULT)
Creates object of certain type.
proto native void ObjectDelete(Object obj)
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения Building.c:6
void SeedPackBase()
Определения SeedPackBase.c:5
void EmptySeedPack(PlayerBase player)
Определения SeedPackBase.c:9
static const float PACK_DAMAGE_TOLERANCE
Определения SeedPackBase.c:3
override void SetActions()
Определения SeedPackBase.c:39
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
Определения InventoryItem.c:731
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
void OnSuccess(EntityAI new_item)
Step H. - notification on finish.
Определения ReplaceItemWithNewLambdaBase.c:216
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
Определения ReplaceItemWithNewLambdaBase.c:185
base class for transformation operations (creating one item from another)
Определения ReplaceItemWithNewLambdaBase.c:5
Определения CannabisSeedsPack.c:2
const float NARROW
Определения ActionConstants.c:127
Определения EnConvert.c:106
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.
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9