DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Edible_Base.c
Go to the documentation of this file.
1class Edible_Base extends ItemBase
2{
3 const string DIRECT_COOKING_SLOT_NAME = "DirectCooking";
4
5 const string SOUND_BAKING_START = "Baking_SoundSet";
6 const string SOUND_BAKING_DONE = "Baking_Done_SoundSet";
7 const string SOUND_BURNING_DONE = "Food_Burning_SoundSet";
8
9 protected bool m_MakeCookingSounds;
10 protected SoundOnVehicle m_SoundCooking;
12 protected string m_SoundPlaying;
13 ref FoodStage m_FoodStage;
14 protected float m_DecayTimer;
15 protected float m_DecayDelta = 0.0;
17
19 {
20 if ( HasFoodStage() )
21 {
22 m_FoodStage = new FoodStage( this );
23
24 //synchronized variables
25 RegisterNetSyncVariableInt( "m_FoodStage.m_FoodStageType", FoodStageType.NONE, FoodStageType.COUNT );
26 RegisterNetSyncVariableInt( "m_FoodStage.m_SelectionIndex", 0, 6 );
27 RegisterNetSyncVariableInt( "m_FoodStage.m_TextureIndex", 0, 6 );
28 RegisterNetSyncVariableInt( "m_FoodStage.m_MaterialIndex", 0, 6 );
29 RegisterNetSyncVariableFloat( "m_FoodStage.m_CookingTime", 0, 600, 0 ); //min = 0; max = 0; precision = 0;
30
31 m_SoundPlaying = "";
32 RegisterNetSyncVariableBool("m_MakeCookingSounds");
33 }
34 }
35
36 override void EEInit()
37 {
38 super.EEInit();
39
40 //update visual
42 }
43
44 override void EEDelete( EntityAI parent )
45 {
46 super.EEDelete( parent );
47
48 // remove audio
50 }
51
52 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
53 {
54 super.EEItemLocationChanged(oldLoc, newLoc);
55
57 if (oldLoc.GetType() == InventoryLocationType.ATTACHMENT || oldLoc.GetType() == InventoryLocationType.CARGO)
58 {
59 switch (oldLoc.GetParent().GetType())
60 {
61 case "FryingPan":
62 case "Pot":
63 case "Cauldron":
64 case "SharpWoodenStick":
65 MakeSoundsOnClient(false);
66 break;
67 }
68
70 if (oldLoc.GetSlot() > -1 && InventorySlots.GetSlotName(oldLoc.GetSlot()).Contains(DIRECT_COOKING_SLOT_NAME))
71 {
72 MakeSoundsOnClient(false);
73 }
74 }
75 }
76
78 {
79 if ( GetFoodStage() )
80 {
81 GetFoodStage().UpdateVisuals();
82 }
83 }
84
85 bool Consume(float amount, PlayerBase consumer)
86 {
87 AddQuantity(-amount, false, false);
88 OnConsume(amount, consumer);
89 return true;
90 }
91
92 void OnConsume(float amount, PlayerBase consumer);
93
94 //food staging
95 override bool CanBeCooked()
96 {
97 return false;
98 }
99
100 override bool CanBeCookedOnStick()
101 {
102 return false;
103 }
104
105 //================================================================
106 // SYNCHRONIZATION
107 //================================================================
109 {
110 SetSynchDirty();
111
112 if (GetGame().IsMultiplayer())
113 {
115 }
116 }
117
119 {
120 super.OnVariablesSynchronized();
121
122 //update visuals
124
125 //update audio
127 {
128 RefreshAudio();
129 }
130 else
131 {
132 RemoveAudio();
133 }
134 }
135
136 //================================================================
137 // AUDIO EFFECTS (WHEN ON DCS)
138 //================================================================
139 void MakeSoundsOnClient( bool soundstate )
140 {
141 m_MakeCookingSounds = soundstate;
142
143 //synchronize
144 Synchronize();
145 }
146 protected void RefreshAudio()
147 {
148 string sound_name;
149 int particle_id;
150
151 switch ( GetFoodStageType() )
152 {
153 case FoodStageType.RAW:
154 sound_name = SOUND_BAKING_START;
155 break;
156 case FoodStageType.BAKED:
157 sound_name = SOUND_BAKING_DONE;
158 break;
159 case FoodStageType.BURNED:
160 sound_name = SOUND_BURNING_DONE;
161 break;
162 default:
163 sound_name = SOUND_BAKING_START;
164 break;
165 }
166
167 SoundCookingStart(sound_name);
168 }
169 protected void RemoveAudio()
170 {
171 m_MakeCookingSounds = false;
173 }
174
175 //================================================================
176 // SERIALIZATION
177 //================================================================
178 override void OnStoreSave( ParamsWriteContext ctx )
179 {
180 super.OnStoreSave( ctx );
181
182 if ( GetFoodStage() )
183 {
184 GetFoodStage().OnStoreSave( ctx );
185 }
186
187 // food decay
188 ctx.Write( m_DecayTimer );
189 ctx.Write( m_LastDecayStage );
190 }
191
192 override bool OnStoreLoad( ParamsReadContext ctx, int version )
193 {
194 if ( !super.OnStoreLoad( ctx, version ) )
195 return false;
196
197 if ( GetFoodStage() )
198 {
199 if ( !GetFoodStage().OnStoreLoad( ctx, version ) )
200 return false;
201 }
202
203 if ( version >= 115 )
204 {
205 if ( !ctx.Read( m_DecayTimer ) )
206 {
207 m_DecayTimer = 0.0;
208 return false;
209 }
210 if ( !ctx.Read( m_LastDecayStage ) )
211 {
213 return false;
214 }
215 }
216
217 return true;
218 }
219
220 override void AfterStoreLoad()
221 {
222 super.AfterStoreLoad();
223
224 //synchronize
225 Synchronize();
226 }
227
228 //get food stage
229 FoodStage GetFoodStage()
230 {
231 return m_FoodStage;
232 }
233
234 //food types
235 override bool IsMeat()
236 {
237 return false;
238 }
239
240 override bool IsCorpse()
241 {
242 return false;
243 }
244
245 override bool IsFruit()
246 {
247 return false;
248 }
249
250 override bool IsMushroom()
251 {
252 return false;
253 }
254
255 //================================================================
256 // NUTRITIONAL VALUES
257 //================================================================
258 //food properties
259 static float GetFoodTotalVolume(ItemBase item, string classname = "", int food_stage = 0)
260 {
261 Edible_Base food_item = Edible_Base.Cast(item);
262 if (food_item && food_item.GetFoodStage())
263 {
264 return FoodStage.GetFullnessIndex(food_item.GetFoodStage());
265 }
266 else if (classname != "" && food_stage)
267 {
268 return FoodStage.GetFullnessIndex(null, food_stage, classname);
269 }
270 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
271 return GetGame().ConfigGetFloat( class_path + " fullnessIndex" );
272
273 }
274
275 static float GetFoodEnergy(ItemBase item, string classname = "", int food_stage = 0)
276 {
277 Edible_Base food_item = Edible_Base.Cast(item);
278 if (food_item && food_item.GetFoodStage())
279 {
280 return FoodStage.GetEnergy(food_item.GetFoodStage());
281 }
282 else if (classname != "" && food_stage)
283 {
284 return FoodStage.GetEnergy(null, food_stage, classname);
285 }
286 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
287 return GetGame().ConfigGetFloat( class_path + " energy" );
288 }
289
290 static float GetFoodWater(ItemBase item, string classname = "", int food_stage = 0)
291 {
292 Edible_Base food_item = Edible_Base.Cast(item);
293 if (food_item && food_item.GetFoodStage())
294 {
295 return FoodStage.GetWater(food_item.GetFoodStage());
296 }
297 else if (classname != "" && food_stage)
298 {
299 return FoodStage.GetWater(null, food_stage, classname);
300 }
301 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
302 return GetGame().ConfigGetFloat( class_path + " water" );
303 }
304
305 static float GetFoodNutritionalIndex(ItemBase item, string classname = "", int food_stage = 0)
306 {
307 Edible_Base food_item = Edible_Base.Cast(item);
308 if (food_item && food_item.GetFoodStage())
309 {
310 return FoodStage.GetNutritionalIndex(food_item.GetFoodStage());
311 }
312 else if (classname != "" && food_stage)
313 {
314 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
315 }
316 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
317 return GetGame().ConfigGetFloat( class_path + " nutritionalIndex" );
318
319 }
320
321 static float GetFoodToxicity(ItemBase item, string classname = "", int food_stage = 0)
322 {
323 Edible_Base food_item = Edible_Base.Cast(item);
324 if (food_item && food_item.GetFoodStage())
325 {
326 return FoodStage.GetToxicity(food_item.GetFoodStage());
327 }
328 else if (classname != "" && food_stage)
329 {
330 return FoodStage.GetToxicity(null, food_stage, classname);
331 }
332 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
333 return GetGame().ConfigGetFloat( class_path + " toxicity" );
334 }
335
336 static int GetFoodAgents(ItemBase item, string classname = "", int food_stage = 0)
337 {
338 Edible_Base food_item = Edible_Base.Cast(item);
339 if (food_item && food_item.GetFoodStage())
340 {
341 return FoodStage.GetAgents(food_item.GetFoodStage());
342 }
343 else if (classname != "" && food_stage)
344 {
345 return FoodStage.GetAgents(null, food_stage, classname);
346 }
347 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
348 return GetGame().ConfigGetInt( class_path + " agents" );
349 }
350
351 static float GetFoodDigestibility(ItemBase item, string classname = "", int food_stage = 0)
352 {
353 Edible_Base food_item = Edible_Base.Cast(item);
354 if (food_item && food_item.GetFoodStage())
355 {
356 return FoodStage.GetDigestibility(food_item.GetFoodStage());
357 }
358 else if (classname != "" && food_stage)
359 {
360 return FoodStage.GetDigestibility(null, food_stage, classname);
361 }
362 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
363 return GetGame().ConfigGetInt( class_path + " digestibility" );
364 }
365
366 static NutritionalProfile GetNutritionalProfile(ItemBase item, string classname = "", int food_stage = 0)
367 {
368 return new NutritionalProfile(GetFoodEnergy(item, classname, food_stage),GetFoodWater(item, classname, food_stage),GetFoodNutritionalIndex(item, classname, food_stage),GetFoodTotalVolume(item, classname, food_stage), GetFoodToxicity(item, classname, food_stage), GetFoodAgents(item, classname,food_stage), GetFoodDigestibility(item, classname,food_stage));
369 }
370
371 //================================================================
372 // FOOD STAGING
373 //================================================================
375 {
376 return GetFoodStage().GetFoodStageType();
377 }
378
379 //food stage states
381 {
382 if ( GetFoodStage() )
383 {
384 return GetFoodStage().IsFoodRaw();
385 }
386
387 return false;
388 }
389
391 {
392 if ( GetFoodStage() )
393 {
394 return GetFoodStage().IsFoodBaked();
395 }
396
397 return false;
398 }
399
401 {
402 if ( GetFoodStage() )
403 {
404 return GetFoodStage().IsFoodBoiled();
405 }
406
407 return false;
408 }
409
411 {
412 if ( GetFoodStage() )
413 {
414 return GetFoodStage().IsFoodDried();
415 }
416
417 return false;
418 }
419
421 {
422 if ( GetFoodStage() )
423 {
424 return GetFoodStage().IsFoodBurned();
425 }
426
427 return false;
428 }
429
431 {
432 if ( GetFoodStage() )
433 {
434 return GetFoodStage().IsFoodRotten();
435 }
436
437 return false;
438 }
439
440 //food stage change
441 void ChangeFoodStage( FoodStageType new_food_stage_type )
442 {
443 GetFoodStage().ChangeFoodStage( new_food_stage_type );
444 }
445
447 {
448 return GetFoodStage().GetNextFoodStageType( cooking_method );
449 }
450
451 string GetFoodStageName( FoodStageType food_stage_type )
452 {
453 return GetFoodStage().GetFoodStageName( food_stage_type );
454 }
455
457 {
458 return GetFoodStage().CanChangeToNewStage( cooking_method );
459 }
460
461 //Use this to receive food stage from another Edible_Base
462 void TransferFoodStage( notnull Edible_Base source )
463 {
464 if ( !source.HasFoodStage())
465 return;
466 m_LastDecayStage = source.GetLastDecayStage();
467 ChangeFoodStage(source.GetFoodStage().GetFoodStageType());
468 m_DecayTimer = source.GetDecayTimer();
469 m_DecayDelta = source.GetDecayDelta();
470 }
471
472 //================================================================
473 // COOKING
474 //================================================================
475 //cooking time
477 {
478 return GetFoodStage().GetCookingTime();
479 }
480
481 void SetCookingTime( float time )
482 {
483 GetFoodStage().SetCookingTime( time );
484
485 //synchronize when calling on server
486 Synchronize();
487 }
488
489 //replace edible with new item (opening cans)
490 void ReplaceEdibleWithNew( string typeName )
491 {
492 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
493 if (player)
494 {
495 ReplaceEdibleWithNewLambda lambda = new ReplaceEdibleWithNewLambda(this, typeName, player);
496 player.ServerReplaceItemInHandsWithNew(lambda);
497 }
498 else
499 Error("ReplaceEdibleWithNew - cannot use edible without player");
500 }
501
502 override void SetActions()
503 {
504 super.SetActions();
505
508 }
509
510 protected void SoundCookingStart(string sound_name)
511 {
512 #ifndef SERVER
513 if (m_SoundPlaying != sound_name)
514 {
516
517 m_SoundEffectCooking = SEffectManager.PlaySound(sound_name, GetPosition(), 0, 0, true);
518 m_SoundPlaying = sound_name;
519 }
520 #endif
521 }
522
523 protected void SoundCookingStop()
524 {
525 #ifndef SERVER
527 {
530 m_SoundPlaying = "";
531 }
532 #endif
533 }
534
535 override bool CanHaveTemperature()
536 {
537 return true;
538 }
539
540 override bool CanDecay()
541 {
542 return false;
543 }
544
545 override bool CanProcessDecay()
546 {
547 return ( GetFoodStageType() != FoodStageType.ROTTEN );
548 }
549
550 override void ProcessDecay( float delta, bool hasRootAsPlayer )
551 {
552 delta *= DayZGame.Cast(GetGame()).GetFoodDecayModifier();
553 m_DecayDelta += ( 1 + ( 1 - GetHealth01( "", "" ) ) );
554 if ( hasRootAsPlayer )
556
557 /*Print( "-------------------------" );
558 Print( this );
559 Print( m_DecayTimer );
560 Print( m_DecayDelta );
561 Print( m_LastDecayStage );*/
562
563 if ( IsFruit() || IsMushroom() )
564 {
565 // fruit, vegetables and mushrooms
567 {
568 switch ( GetFoodStageType() )
569 {
570 case FoodStageType.RAW:
573 break;
574
575 case FoodStageType.BOILED:
578 break;
579
580 case FoodStageType.BAKED:
583 break;
584
585 case FoodStageType.DRIED:
586 case FoodStageType.BURNED:
587 case FoodStageType.ROTTEN:
588 default:
589 m_DecayTimer = -1;
591 return;
592 }
593
594 //m_DecayTimer = m_DecayTimer / 1000.0;
595 }
596
597 m_DecayTimer -= ( delta * m_DecayDelta );
598
599 if ( m_DecayTimer <= 0 )
600 {
601 if ( m_LastDecayStage != FoodStageType.NONE )
602 {
603 // switch to decayed stage
604 if ( ( m_LastDecayStage == FoodStageType.BOILED ) || ( m_LastDecayStage == FoodStageType.BAKED ) )
605 {
607 }
608 if ( m_LastDecayStage == FoodStageType.RAW )
609 {
610 int rng = Math.RandomIntInclusive( 0, 100 );
612 {
614 }
615 else
616 {
617 if ( CanChangeToNewStage( FoodStageType.DRIED ) )
618 {
620 }
621 else
622 {
624 }
625 }
626 }
627 }
628 }
629
630 }
631 else if ( IsMeat() )
632 {
633 // meat
635 {
636 switch ( GetFoodStageType() )
637 {
638 case FoodStageType.RAW:
641 break;
642
643 case FoodStageType.BOILED:
646 break;
647
648 case FoodStageType.BAKED:
651 break;
652
653 case FoodStageType.DRIED:
656 break;
657
658 case FoodStageType.BURNED:
659 case FoodStageType.ROTTEN:
660 default:
661 m_DecayTimer = -1;
663 return;
664 }
665 }
666
667 m_DecayTimer -= ( delta * m_DecayDelta );
668
669 if ( m_DecayTimer <= 0 )
670 {
671 if ( m_LastDecayStage != FoodStageType.NONE )
672 {
673 // switch to decayed stage
674 if ( ( m_LastDecayStage == FoodStageType.DRIED ) || ( m_LastDecayStage == FoodStageType.RAW ) || ( m_LastDecayStage == FoodStageType.BOILED ) || ( m_LastDecayStage == FoodStageType.BAKED ) )
675 {
677 }
678 }
679 }
680 }
681 else if ( IsCorpse() )
682 {
683 // corpse
685 {
686 switch ( GetFoodStageType() )
687 {
688 case FoodStageType.RAW:
691 break;
692
693 case FoodStageType.BURNED:
694 case FoodStageType.ROTTEN:
695 default:
696 m_DecayTimer = -1;
698 return;
699 }
700 }
701
702 m_DecayTimer -= ( delta * m_DecayDelta );
703
704 if ( m_DecayTimer <= 0 )
705 {
706 if ( m_LastDecayStage != FoodStageType.NONE )
707 {
708 // switch to decayed stage
709 if ( ( m_LastDecayStage == FoodStageType.DRIED ) || ( m_LastDecayStage == FoodStageType.RAW ) || ( m_LastDecayStage == FoodStageType.BOILED ) || ( m_LastDecayStage == FoodStageType.BAKED ) )
710 {
712 }
713 }
714 }
715 }
716 else
717 {
718 // opened cans
719 m_DecayTimer -= ( delta * m_DecayDelta );
720
721 if ( ( m_DecayTimer <= 0 ) && ( m_LastDecayStage == FoodStageType.NONE ) )
722 {
725 //m_DecayTimer = m_DecayTimer / 1000.0;
726 }
727 else
728 {
729 if ( m_DecayTimer <= 0 )
730 {
731 InsertAgent(eAgents.FOOD_POISON, 1);
732 m_DecayTimer = -1;
733 }
734 }
735 }
736
737 m_DecayDelta = 0.0;
738 }
739
740 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
741 {
742 super.GetDebugActions(outputList);
743
744 if (HasFoodStage())
745 {
746 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FOOD_STAGE_PREV, "Food Stage Prev", FadeColors.WHITE));
747 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FOOD_STAGE_NEXT, "Food Stage Next", FadeColors.WHITE));
748 }
749 }
750
751 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
752 {
753 super.OnAction(action_id, player, ctx);
754
755 if ( GetGame().IsServer() )
756 {
757 if ( action_id == EActions.FOOD_STAGE_PREV )
758 {
759 int food_stage_prev = GetFoodStageType() - 1;
760 if (food_stage_prev <= 0)
761 {
762 food_stage_prev = FoodStageType.COUNT - 1;
763 }
764 ChangeFoodStage(food_stage_prev);
765 return true;
766 }
767 else if ( action_id == EActions.FOOD_STAGE_NEXT )
768 {
769 int food_stage_next = GetFoodStageType() + 1;
770 if (food_stage_next >= FoodStageType.COUNT )
771 {
772 food_stage_next = FoodStageType.RAW;
773 }
774 ChangeFoodStage(food_stage_next);
775 return true;
776 }
777 }
778 return false;
779 }
780 //================================================================
781 // GENERAL GETTERS
782 //================================================================
783
785 {
786 return m_DecayTimer;
787 }
788
790 {
791 return m_DecayDelta;
792 }
793
795 {
796 return m_LastDecayStage;
797 }
798}
799
801{
802 void ReplaceEdibleWithNewLambda(EntityAI old_item, string new_item_type, PlayerBase player) { }
AttachActionData ActionData ActionAttach()
Definition ActionAttach.c:9
void ActionDetach()
Param4< int, int, string, int > TSelectableActionInfoWithColor
void AddAction(typename actionName)
void Synchronize()
void UpdateVisuals()
CookingMethodType
Definition Cooking.c:2
EActions
Definition EActions.c:2
eAgents
Definition EAgents.c:3
ref FoodStage m_FoodStage
protected void SoundCookingStop()
static float GetFoodDigestibility(ItemBase item, string classname="", int food_stage=0)
static float GetFoodTotalVolume(ItemBase item, string classname="", int food_stage=0)
protected bool m_MakeCookingSounds
const string SOUND_BURNING_DONE
FoodStageType GetFoodStageType()
const string DIRECT_COOKING_SLOT_NAME
bool CanChangeToNewStage(CookingMethodType cooking_method)
override bool IsMushroom()
const string SOUND_BAKING_DONE
static float GetFoodEnergy(ItemBase item, string classname="", int food_stage=0)
protected FoodStageType m_LastDecayStage
static float GetFoodToxicity(ItemBase item, string classname="", int food_stage=0)
void MakeSoundsOnClient(bool soundstate)
protected float m_DecayTimer
static float GetFoodWater(ItemBase item, string classname="", int food_stage=0)
const string SOUND_BAKING_START
static float GetFoodNutritionalIndex(ItemBase item, string classname="", int food_stage=0)
FoodStage GetFoodStage()
static int GetFoodAgents(ItemBase item, string classname="", int food_stage=0)
protected EffectSound m_SoundEffectCooking
DEPRECATED.
protected void RemoveAudio()
class Edible_Base extends ItemBase ReplaceEdibleWithNewLambda(EntityAI old_item, string new_item_type, PlayerBase player)
protected void RefreshAudio()
void ChangeFoodStage(FoodStageType new_food_stage_type)
protected string m_SoundPlaying
protected void SoundCookingStart(string sound_name)
protected float m_DecayDelta
FoodStageType
Definition FoodStage.c:2
InventoryLocationType
types of Inventory Location
override void InsertAgent(int agent, float count=1)
Definition ItemBase.c:8477
bool HasFoodStage()
Definition ItemBase.c:7020
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Definition ItemBase.c:7866
bool OnStoreLoad(ParamsReadContext ctx, int version)
int particle_id
class JsonUndergroundAreaTriggerData GetPosition
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native int ConfigGetInt(string path)
Get int value from config on path.
override bool IsCorpse()
Definition Carp.c:13
override bool IsFruit()
Definition CaninaBerry.c:13
override void OnConsume(float amount, PlayerBase consumer)
override bool IsMeat()
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
override void Stop()
Stops sound.
InventoryLocation.
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
ref FoodStage m_FoodStage
Definition Edible_Base.c:13
override bool CanDecay()
protected void SoundCookingStop()
static float GetFoodDigestibility(ItemBase item, string classname="", int food_stage=0)
static float GetFoodTotalVolume(ItemBase item, string classname="", int food_stage=0)
void SetCookingTime(float time)
protected bool m_MakeCookingSounds
Definition Edible_Base.c:9
string GetFoodStageName(FoodStageType food_stage_type)
bool IsFoodBurned()
override void OnStoreSave(ParamsWriteContext ctx)
FoodStageType GetFoodStageType()
override bool CanBeCookedOnStick()
override bool CanBeCooked()
Definition Edible_Base.c:95
static NutritionalProfile GetNutritionalProfile(ItemBase item, string classname="", int food_stage=0)
void UpdateVisuals()
Definition Edible_Base.c:77
override void EEInit()
Definition Edible_Base.c:36
bool Consume(float amount, PlayerBase consumer)
Definition Edible_Base.c:85
bool IsFoodRaw()
bool CanChangeToNewStage(CookingMethodType cooking_method)
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override bool IsCorpse()
override bool IsMushroom()
bool IsFoodDried()
void Edible_Base()
Definition Edible_Base.c:18
float GetCookingTime()
static float GetFoodEnergy(ItemBase item, string classname="", int food_stage=0)
void TransferFoodStage(notnull Edible_Base source)
override bool IsFruit()
void ReplaceEdibleWithNew(string typeName)
static float GetFoodToxicity(ItemBase item, string classname="", int food_stage=0)
override bool CanProcessDecay()
override void EEDelete(EntityAI parent)
Definition Edible_Base.c:44
FoodStageType GetLastDecayStage()
override void AfterStoreLoad()
float GetDecayTimer()
void OnConsume(float amount, PlayerBase consumer)
void Synchronize()
FoodStageType GetNextFoodStageType(CookingMethodType cooking_method)
void MakeSoundsOnClient(bool soundstate)
protected float m_DecayTimer
Definition Edible_Base.c:14
static float GetFoodWater(ItemBase item, string classname="", int food_stage=0)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition Edible_Base.c:52
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
static float GetFoodNutritionalIndex(ItemBase item, string classname="", int food_stage=0)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
bool IsFoodBoiled()
FoodStage GetFoodStage()
static int GetFoodAgents(ItemBase item, string classname="", int food_stage=0)
protected EffectSound m_SoundEffectCooking
DEPRECATED.
Definition Edible_Base.c:11
protected void RemoveAudio()
bool IsFoodBaked()
override void OnVariablesSynchronized()
override void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool CanHaveTemperature()
bool IsFoodRotten()
protected void RefreshAudio()
void ChangeFoodStage(FoodStageType new_food_stage_type)
float GetDecayDelta()
protected string m_SoundPlaying
Definition Edible_Base.c:12
protected void SoundCookingStart(string sound_name)
protected SoundOnVehicle m_SoundCooking
Definition Edible_Base.c:10
override bool IsMeat()
override void SetActions()
Definition EnMath.c:7
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
const float DECAY_FOOD_CAN_OPEN
Definition constants.c:873
const float DECAY_FOOD_BOILED_MEAT
Definition constants.c:868
const float DECAY_FOOD_RAW_CORPSE
Definition constants.c:866
const float DECAY_FOOD_RAW_FRVG
Definition constants.c:867
const int DECAY_TIMER_RANDOM_PERCENTAGE
Definition constants.c:875
const float DECAY_FOOD_BOILED_FRVG
Definition constants.c:869
const float DECAY_FOOD_RAW_MEAT
Definition constants.c:865
const float DECAY_FOOD_BAKED_FRVG
Definition constants.c:871
const float DECAY_FOOD_BAKED_MEAT
Definition constants.c:870
const float DECAY_RATE_ON_PLAYER
Definition constants.c:876
const int DECAY_FOOD_FRVG_DRIED_CHANCE
Definition constants.c:874
const float DECAY_FOOD_DRIED_MEAT
Definition constants.c:872
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:53
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106
const int SAT_DEBUG_ACTION
Definition constants.c:408
bool Contains(string sample)
Returns true if sample is substring of string.
Definition EnString.c:286