Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
seedpackbase.c
Go to the documentation of this file.
1
class
SeedPackBase
extends
Inventory_Base
2
{
3
private
static
const
float
PACK_DAMAGE_TOLERANCE
= 0.5;
4
5
void
SeedPackBase
()
6
{
7
}
8
9
void
EmptySeedPack
(
PlayerBase
player)
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
43
AddAction
(
ActionEmptySeedsPack
);
44
}
45
}
46
47
class
EmptySeedsPackLambda
:
ReplaceItemWithNewLambdaBase
48
{
49
int
m_ItemCount
;
50
PlayerBase
m_Player
;
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
};
GetType
eBleedingSourceType GetType()
Definition
bleedingsource.c:67
AddAction
void AddAction(typename actionName)
Definition
advancedcommunication.c:220
m_Player
map m_Player
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition
centraleconomy.c:37
ActionEmptySeedsPack
Definition
actionemptyseedspack.c:7
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
EntityAI
Definition
inventoryitem.c:2
Inventory_Base
Definition
barbedbaseballbat.c:2
Inventory_Base::PACK_DAMAGE_TOLERANCE
static const float PACK_DAMAGE_TOLERANCE
Definition
seedpackbase.c:3
Inventory_Base::EmptySeedPack
void EmptySeedPack(PlayerBase player)
Definition
seedpackbase.c:9
Inventory_Base::SeedPackBase
void SeedPackBase()
Definition
seedpackbase.c:5
Inventory_Base::SetActions
override void SetActions()
Definition
seedpackbase.c:39
ItemBase
Definition
inventoryitem.c:742
ItemBase::SetQuantity
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Definition
pileofwoodenplanks.c:88
Math
Definition
enmath.c:7
PlayerBase
Definition
playerbaseclient.c:2
ReplaceItemWithNewLambdaBase
base class for transformation operations (creating one item from another)
Definition
replaceitemwithnewlambdabase.c:5
ReplaceItemWithNewLambdaBase::OnSuccess
void OnSuccess(EntityAI new_item)
Definition
replaceitemwithnewlambdabase.c:224
ReplaceItemWithNewLambdaBase::CopyOldPropertiesToNew
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Definition
replaceitemwithnewlambdabase.c:193
SeedPackBase
Definition
cannabisseedspack.c:2
UAItemsSpreadRadius
Definition
actionconstants.c:124
UAItemsSpreadRadius::NARROW
const float NARROW
Definition
actionconstants.c:127
vector
Definition
enconvert.c:119
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Math::Round
static proto float Round(float f)
Returns mathematical round of value.
GetPosition
vector GetPosition()
Get the world position of the Effect.
Definition
effect.c:473
DEFAULT_SPAWN_DISTANCE
const float DEFAULT_SPAWN_DISTANCE
Definition
recipebase.c:3
m_ItemCount
class SeedPackBase extends Inventory_Base m_ItemCount
EmptySeedsPackLambda
void EmptySeedsPackLambda(EntityAI old_item, string new_item_type, PlayerBase player, int count)
Definition
seedpackbase.c:52
Games
Dayz
scripts
4_world
entities
itembase
seedpackbase.c
Generated by
1.17.0