Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VehicleSalvageSupportStationComponent.c
Go to the documentation of this file.
5
6class SCR_VehicleSalvageSupportStationComponent : SCR_BaseSupportStationComponent
7{
8 [Attribute(defvalue: "0.2", uiwidget: UIWidgets.SpinBox, params: "0 inf", desc: "The refund multiplier for salvging wrecks. 20% of original cost by default.", category: "General Settings")]
9 protected float m_fRefundMultiplier;
10
11 //------------------------------------------------------------------------------------------------
12 // Check if the user action is valid
13 override bool IsValid(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action, vector actionPosition, out ESupportStationReasonInvalid reasonInvalid, out int supplyAmount)
14 {
16 if (!VehicleSalvageAction)
17 {
18 Debug.Error2("SCR_VehicleSalvageSupportStationComponent", "This user action is not of Vehicle Salvage type.");
19 return false;
20 }
21
22 return super.IsValid(actionOwner, actionUser, action, actionPosition, reasonInvalid, supplyAmount);
23 }
24
25 //------------------------------------------------------------------------------------------------
27 {
28 return ESupportStationType.LOAD_WRECK;
29 }
30
31 //------------------------------------------------------------------------------------------------
33 {
34 return true;
35 }
36
37 //------------------------------------------------------------------------------------------------
38 // Get final amount of supplies that will get refunded for salvaging
39 protected override int GetSupplyAmountAction(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action)
40 {
42 return 0;
43
45 if (!vehicleSalvageAction)
46 return 0;
47
48 return vehicleSalvageAction.GetSupplyCost() * m_fRefundMultiplier;
49 }
50
51 //------------------------------------------------------------------------------------------------
52 // Check if the vehicle exists and is destroyed, then generate supplies in return for executing the action
53 override void OnExecutedServer(notnull IEntity actionOwner, notnull IEntity actionUser, notnull SCR_BaseUseSupportStationAction action)
54 {
55 Vehicle vehicle = Vehicle.Cast(actionOwner.GetParent());
56 if (!vehicle)
57 return;
58
59 SCR_DamageManagerComponent damageManager = vehicle.GetDamageManager();
60 if (!damageManager || damageManager.GetState() != EDamageState.DESTROYED)
61 return;
62
63 super.OnExecutedServer(actionOwner, actionUser, action);
64
65 int supplyAmount = GetSupplyAmountAction(actionOwner, actionUser, action);
66
67 delete vehicle;
68
69 if (vehicle && !vehicle.IsDeleted())
70 return;
71
72 OnGenerateSuppliesServer(supplyAmount);
73 }
74
75 //------------------------------------------------------------------------------------------------
76 override void OnExecute(IEntity actionOwner, IEntity actionUser, int playerId, SCR_BaseUseSupportStationAction action)
77 {
78 super.OnExecute(actionOwner, actionUser, playerId, action);
79
80 // Play sound effect
81 SCR_AudioSourceConfiguration audioConfig = GetOnUseAudioConfig();
82 if (!audioConfig)
83 return;
84
85 PlaySoundEffect(audioConfig, actionUser, action);
86 }
87}
ESupportStationType
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
override int GetSupplyAmountAction(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action)
override void OnExecute(IEntity actionOwner, IEntity actionUser, int playerId, SCR_BaseUseSupportStationAction action)
override void OnExecutedServer(notnull IEntity actionOwner, notnull IEntity actionUser, notnull SCR_BaseUseSupportStationAction action)
bool HasSupplyGainInsteadOfCost(SCR_BaseUseSupportStationAction action)
ESupportStationType GetSupportStationType()
bool OnGenerateSuppliesServer(int amount)
void PlaySoundEffect(SCR_AudioSourceConfiguration audioConfig, notnull IEntity soundOwner, SCR_BaseUseSupportStationAction action)
SCR_AudioSourceConfiguration GetOnUseAudioConfig()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_ResourceGenerator m_ResourceGenerator
Definition Debug.c:13
enum EPhysicsLayerPresets Vehicle
Definition gameLib.c:24
SCR_FieldOfViewSettings Attribute
EDamageState