Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FuelInventoryItemComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Misc", description: "")]
5
6class SCR_FuelInventoryItemComponent : InventoryItemComponent
7{
8 [Attribute("1", desc: "Weight of fuel per liter to update the inventory weight", params: "0 inf", category: "Fuel")]
9 protected float m_fFuelWeightPerLiter;
10
12
13 //------------------------------------------------------------------------------------------------
14 // constructor
18 void SCR_FuelInventoryItemComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
19 {
21 return;
22
24 if ((gameMode && !gameMode.IsMaster()) || (!gameMode && Replication.IsClient()))
25 return;
26
27 //~ Call a frame later so fuel manager can init correctly
28 GetGame().GetCallqueue().CallLater(DelayedInit);
29 }
30
31 //------------------------------------------------------------------------------------------------
32 protected void DelayedInit()
33 {
35 if (m_FuelManager)
36 {
37 m_FuelManager.GetOnFuelChanged().Insert(OnFuelAmountChanged);
38 OnFuelAmountChanged(m_FuelManager.GetTotalFuel());
39 }
40 else
41 Debug.Error2("SCR_FuelInventoryItemComponent", "Fuel Inventory Item does not have a 'SCR_FuelManagerComponent'!");
42 }
43
44 //------------------------------------------------------------------------------------------------
45 protected void OnFuelAmountChanged(float newFuelValue)
46 {
47 SetAdditionalWeight(newFuelValue * m_fFuelWeightPerLiter);
48 }
49
50 //------------------------------------------------------------------------------------------------
51 // destructor
53 {
54 if (m_FuelManager)
55 m_FuelManager.GetOnFuelChanged().Remove(OnFuelAmountChanged);
56 }
57}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseGameMode GetGameMode()
override void DelayedInit(IEntity owner)
override void DelayedInit()
override void SetAdditionalWeight()
void OnFuelAmountChanged(float newFuelValue)
void ~SCR_FuelInventoryItemComponent()
void SCR_FuelManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
FuelManagerComponent m_FuelManager
Definition Debug.c:13
proto external GenericComponent FindComponent(typename typeName)
Main replication API.
Definition Replication.c:14
sealed bool IsMaster()
static bool IsEditMode()
Definition Functions.c:1566
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute