Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл ActionSkinning.c

См. исходные тексты.

Структуры данных

class  ActionSkinningCB
 

Функции

ActionSkinningCB ActionContinuousBaseCB ActionSkinning ()
 
override void CreateActionComponent ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnFinishProgressServer (ActionData action_data)
 
vector GetRandomPos (vector body_pos)
 
ItemBase CreateOrgan (PlayerBase player, vector body_pos, string item_to_spawn, string cfg_skinning_organ_class, ItemBase tool)
 
override void OnFinishProgressClient (ActionData action_data)
 
void HandlePlayerBody (ActionData action_data)
 This section drops all clothes (and attachments) from the dead player before deleting their body.
 
void DropInventoryItems (PlayerBase body, float newLifetime)
 
void SpawnItems (ActionData action_data)
 

Функции

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
49 {
50 Object targetObject = target.GetObject();
51
52 if (targetObject.CanBeSkinned() && !targetObject.IsAlive())
53 {
55 if (Class.CastTo(target_EAI, targetObject) && target_EAI.CanBeSkinnedWith(item))
56 return true;
57 }
58
59 return false;
60 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Building.c:6
Definition ObjectTyped.c:2
Definition EntityAI.c:95
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки Class::CastTo().

◆ ActionSkinning()

32 {
33 m_CallbackClass = ActionSkinningCB;
35
36 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ANIMALSKINNING;
37 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
38 m_FullBody = true;
39 m_Text = "#skin";
40 }
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
float m_SpecialtyWeight
Definition ActionBase.c:68
int m_StanceMask
Definition ActionBase.c:53
Definition ActionSkinning.c:22
Definition ActionConstants.c:119
const float PRECISE_MEDIUM
Definition ActionConstants.c:124
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602

Используется в ActionConstructor::RegisterActions(), ToolBase::SetActions(), Crowbar::SetActions(), HandSaw::SetActions(), HayHook::SetActions(), Iceaxe::SetActions(), Inventory_Base::SetActions() и ItemBase::SetActions().

◆ CreateActionComponent()

override void CreateActionComponent ( )

◆ CreateConditionComponents()

override void CreateConditionComponents ( )
43 {
46 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
Definition CCINonRuined.c:2
Definition CCTCursorNoRuinCheck.c:2

Перекрестные ссылки m_ConditionItem и m_ConditionTarget.

◆ CreateOrgan()

ItemBase CreateOrgan ( PlayerBase player,
vector body_pos,
string item_to_spawn,
string cfg_skinning_organ_class,
ItemBase tool )
97 {
98 // Create item from config
102
103 // Check if skinning is configured for this body
104 if (!added_item)
105 return null;
106
107 // Set randomized position
108 added_item.PlaceOnSurface();
109
110 // Set item's quantity from config, if it's defined there.
111 float item_quantity = 0;
114
115 GetGame().ConfigGetFloatArray(cfg_skinning_organ_class + "quantityMinMax", quant_min_max);
116 GetGame().ConfigGetFloatArray(cfg_skinning_organ_class + "quantityMinMaxCoef", quant_min_max_coef);
117
118
119 // Read config for quantity value
120 if (quant_min_max.Count() > 0)
121 {
122 float soft_skill_manipulated_value = (quant_min_max.Get(0)+ quant_min_max.Get(1)) / 2;
123 float min_quantity = player.GetSoftSkillsManager().AddSpecialtyBonus(soft_skill_manipulated_value, this.GetSpecialtyWeight());
124 item_quantity = Math.RandomFloat(min_quantity, quant_min_max.Get(1));
125 }
126
127 if (quant_min_max_coef.Count() > 0)
128 {
129 float coef = Math.RandomFloat(quant_min_max_coef.Get(0), quant_min_max_coef.Get(1));
130 item_quantity = added_item.GetQuantityMax() * coef;
131 }
132
133 if (GetGame().ConfigGetFloat(cfg_skinning_organ_class + "quantity") > 0)
134 item_quantity = g_Game.ConfigGetFloat(cfg_skinning_organ_class + "quantity");
135
136 if (GetGame().ConfigGetFloat(cfg_skinning_organ_class + "quantityCoef") > 0)
137 {
138 float coef2 = g_Game.ConfigGetFloat(cfg_skinning_organ_class + "quantityCoef");
139 item_quantity = added_item.GetQuantityMax() * coef2;
140 }
141
142 if (item_quantity > 0)
143 {
145 added_item.SetQuantity(item_quantity, false);
146 }
147
148 // Transfer tool's damage to the item's condition
149 float item_apply_tool_damage_coef = GetGame().ConfigGetFloat(cfg_skinning_organ_class + "transferToolDamageCoef");
150
152 {
153 float tool_dmg_coef = 1 - tool.GetHealth01();
155 added_item.DecreaseHealthCoef(organ_dmg_coef);
156 }
157
158 added_item.InsertAgent(eAgents.SALMONELLA, 1);
159 return added_item;
160 }
float GetSpecialtyWeight()
Definition ActionBase.c:1044
vector GetRandomPos(vector body_pos)
Definition ActionSkinning.c:90
const int ECE_PLACE_ON_SURFACE
Definition CentralEconomy.c:37
DayZGame g_Game
Definition DayZGame.c:3746
eAgents
Definition EAgents.c:3
Definition InventoryItem.c:731
Definition EnMath.c:7
Definition EnConvert.c:106
proto native CGame GetGame()
static proto float Round(float f)
Returns mathematical round of value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].

Перекрестные ссылки Class::CastTo(), ECE_PLACE_ON_SURFACE, g_Game, GetGame(), GetRandomPos(), GetSpecialtyWeight(), Math::RandomFloat() и Math::Round().

Используется в SpawnItems().

◆ DropInventoryItems()

void DropInventoryItems ( PlayerBase body,
float newLifetime )
244 {
246 body.GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, children);
247 foreach (EntityAI child : children)
248 {
249 if (child)
250 {
251 child.SetLifetime(newLifetime);
252 body.GetInventory().DropEntity(InventoryMode.SERVER, body, child);
253 }
254 }
255 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition gameplay.c:6

Используется в HandlePlayerBody().

◆ GetRandomPos()

vector GetRandomPos ( vector body_pos)
91 {
92 return body_pos + Vector(Math.RandomFloat01() - 0.5, 0, Math.RandomFloat01() - 0.5);
93 }
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126

Перекрестные ссылки Math::RandomFloat01() и Vector().

Используется в CreateOrgan().

◆ HandlePlayerBody()

void HandlePlayerBody ( ActionData action_data)

This section drops all clothes (and attachments) from the dead player before deleting their body.

179 {
181 if (Class.CastTo(body,action_data.m_Target.GetObject()))
182 {
183 if (body.IsRestrained() && body.GetHumanInventory().GetEntityInHands())
184 MiscGameplayFunctions.TransformRestrainItem(body.GetHumanInventory().GetEntityInHands(), null, action_data.m_Player, body);
185
186 //Remove splint if target is wearing one
187 if (body.IsWearingSplint())
188 {
189 EntityAI entity = action_data.m_Player.SpawnEntityOnGroundOnCursorDir("Splint", 0.5);
191 EntityAI attachment = body.GetItemOnSlot("Splint_Right");
192 if (attachment && attachment.GetType() == "Splint_Applied")
193 {
194 if (newItem)
195 {
196 MiscGameplayFunctions.TransferItemProperties(attachment, newItem);
197 //Lower health level of splint after use
198 if (newItem.GetHealthLevel() < 4)
199 {
200 int newDmgLevel = newItem.GetHealthLevel() + 1;
201 float max = newItem.GetMaxHealth("", "");
202
203 switch (newDmgLevel)
204 {
207 break;
208
210 newItem.SetHealth("", "", max * GameConstants.DAMAGE_DAMAGED_VALUE);
211 break;
212
214 newItem.SetHealth("", "", max * GameConstants.DAMAGE_WORN_VALUE);
215 break;
216
218 newItem.SetHealth("", "", max * GameConstants.DAMAGE_RUINED_VALUE);
219 break;
220
221 default:
222 break;
223 }
224 }
225 }
226
227 attachment.Delete();
228 }
229 }
230
232 if (GetCEApi())
233 {
234 deadBodyLifetime = GetCEApi().GetCEGlobalInt("CleanupLifetimeDeadPlayer");
235 if (deadBodyLifetime <= 0)
236 deadBodyLifetime = 3600;
237 }
238
240 }
241 }
void DropInventoryItems(PlayerBase body, float newLifetime)
Definition ActionSkinning.c:243
proto native CEApi GetCEApi()
Get the CE API.
Definition constants.c:615
Definition PlayerBaseClient.c:2
const float DAMAGE_RUINED_VALUE
Definition constants.c:776
const float DAMAGE_DAMAGED_VALUE
Definition constants.c:774
const float DAMAGE_BADLY_DAMAGED_VALUE
Definition constants.c:775
const float DAMAGE_WORN_VALUE
Definition constants.c:773
const int STATE_RUINED
Definition constants.c:760
const int STATE_BADLY_DAMAGED
Definition constants.c:761
const int STATE_DAMAGED
Definition constants.c:762
const int STATE_WORN
Definition constants.c:763

Перекрестные ссылки Class::CastTo(), GameConstants::DAMAGE_BADLY_DAMAGED_VALUE, GameConstants::DAMAGE_DAMAGED_VALUE, GameConstants::DAMAGE_RUINED_VALUE, GameConstants::DAMAGE_WORN_VALUE, DropInventoryItems(), GetCEApi(), GameConstants::STATE_BADLY_DAMAGED, GameConstants::STATE_DAMAGED, GameConstants::STATE_RUINED и GameConstants::STATE_WORN.

Используется в OnFinishProgressServer().

◆ OnFinishProgressClient()

override void OnFinishProgressClient ( ActionData action_data)
163 {
164 super.OnFinishProgressClient(action_data);
165
166 if (action_data.m_Target)
167 {
168 Object target_obj = action_data.m_Target.GetObject();
169
170 if (target_obj.IsKindOf("Animal_CapreolusCapreolus") || target_obj.IsKindOf("Animal_CapreolusCapreolusF") || target_obj.IsKindOf("Animal_CervusElaphus") || target_obj.IsKindOf("Animal_CervusElaphusF"))
171 {
172 GetGame().GetAnalyticsClient().OnActionFinishedGutDeer();
173 }
174 }
175 }

Перекрестные ссылки GetGame().

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)
64 {
65 super.OnFinishProgressServer(action_data);
66
67 Object targetObject = action_data.m_Target.GetObject();
68
69 // Mark the body as skinned to forbid another skinning action on it
71 body.SetAsSkinned();
72
73 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(body, {Bolt_Base});
74
77
78 if (body)
79 {
80 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().ObjectDelete,body);
81 }
82
83 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, UADamageApplied.SKINNING);
84
86 moduleLifespan.UpdateBloodyHandsVisibility(action_data.m_Player, true);
87 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
88 }
void SpawnItems(ActionData action_data)
Definition ActionSkinning.c:257
void HandlePlayerBody(ActionData action_data)
This section drops all clothes (and attachments) from the dead player before deleting their body.
Definition ActionSkinning.c:178
void PluginLifespan()
Definition PluginLifespan.c:45
PluginBase GetPlugin(typename plugin_type)
Definition PluginManager.c:316
Definition AmmunitionPiles.c:91
Definition ActionConstants.c:131
const float SKINNING
Definition ActionConstants.c:137
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

Перекрестные ссылки CALL_CATEGORY_SYSTEM, GetGame(), GetPlugin(), HandlePlayerBody(), m_SpecialtyWeight, PluginLifespan(), UADamageApplied::SKINNING и SpawnItems().

◆ SpawnItems()

void SpawnItems ( ActionData action_data)
258 {
259 EntityAI body = EntityAI.Cast(action_data.m_Target.GetObject());
260
261 // Get config path to the animal
262 string cfg_animal_class_path = "cfgVehicles " + body.GetType() + " " + "Skinning ";
263 vector bodyPosition = body.GetPosition();
264
265 // Getting item type from the config
266 int child_count = g_Game.ConfigGetChildrenCount(cfg_animal_class_path);
267
268 string item_to_spawn;
270 // Parsing of the 'Skinning' class in the config of the dead body
271 for (int i1 = 0; i1 < child_count; i1++)
272 {
273 // To make configuration as convenient as possible, all classes are parsed and parameters are read
274 g_Game.ConfigGetChildName(cfg_animal_class_path, i1, cfg_skinning_organ_class); // out cfg_skinning_organ_class
276 g_Game.ConfigGetText(cfg_skinning_organ_class + "item", item_to_spawn); // out item_to_spawn
277
278 if (item_to_spawn != "") // Makes sure to ignore incompatible parameters in the Skinning class of the agent
279 {
280 // Spawning items in action_data.m_Player's inventory
281 int item_count = g_Game.ConfigGetInt(cfg_skinning_organ_class + "count");
282
285 float zoneDmg = 0;
286
287 GetGame().ConfigGetTextArray(cfg_skinning_organ_class + "itemZones", itemZones);
288 GetGame().ConfigGetFloatArray(cfg_skinning_organ_class + "countByZone", itemCount);
289
290 if (itemCount.Count() > 0)
291 {
292 item_count = 0;
293 for (int z = 0; z < itemZones.Count(); z++)
294 {
295 zoneDmg = body.GetHealth01(itemZones[z], "Health");
296 zoneDmg *= itemCount[z]; //just re-using variable
298 }
299 }
300
301 for (int i2 = 0; i2 < item_count; i2++)
302 {
304
305 //Damage pelts based on the average values on itemZones
306 //It only works if the "quantityCoef" in the config is more than 0
307 float qtCoeff = GetGame().ConfigGetFloat(cfg_skinning_organ_class + "quantityCoef");
308 if (qtCoeff > 0)
309 {
310 float avgDmgZones = 0;
311 for (int c2 = 0; c2 < itemZones.Count(); c2++)
312 {
313 avgDmgZones += body.GetHealth01(itemZones[c2], "Health");
314 }
315
316 avgDmgZones = avgDmgZones/itemZones.Count(); // Evaluate the average Health
317
318 if (spawn_result)
319 spawn_result.SetHealth01("","", avgDmgZones);
320 }
321
322 // handle fat/guts from human bodies
323 if ((item_to_spawn == "Lard") || (item_to_spawn == "Guts"))
324 {
325 if (body.IsKindOf("SurvivorBase"))
326 {
327 spawn_result.InsertAgent(eAgents.BRAIN, 1);
328 }
329 }
330 }
331 }
332 }
333 }
ItemBase CreateOrgan(PlayerBase player, vector body_pos, string item_to_spawn, string cfg_skinning_organ_class, ItemBase tool)
Definition ActionSkinning.c:96
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки CreateOrgan(), Math::Floor(), g_Game и GetGame().

Используется в OnFinishProgressServer().