DayZ 1.29
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 g_Game.ConfigGetText("cfgVehicles " + pack_type + " Horticulture ContainsSeedsType", seeds_type);
15
16 int seeds_quantity_max = g_Game.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();
34 g_Game.CreateObjectEx(seeds_type, pos, ECE_PLACE_ON_SURFACE);
35 g_Game.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 g_Game.CreateObjectEx("Paper", new_item.GetHierarchyRoot().GetPosition(), ECE_PLACE_ON_SURFACE);
79 }
80 }
81};
eBleedingSourceType GetType()
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
map m_Player
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
DayZGame g_Game
Определения DayZGame.c:3942
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
Super root of all classes in Enforce script.
Определения EnScript.c:11
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
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
void OnSuccess(EntityAI new_item)
Step H. - notification on finish.
Определения ReplaceItemWithNewLambdaBase.c:224
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
Определения ReplaceItemWithNewLambdaBase.c:193
base class for transformation operations (creating one item from another)
Определения ReplaceItemWithNewLambdaBase.c:5
Определения CannabisSeedsPack.c:2
const float NARROW
Определения ActionConstants.c:127
Определения EnConvert.c:119
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.
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473