Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignSupplyRestrictedSpawnPoint.c
Go to the documentation of this file.
2{
3
4}
5
6class SCR_CampaignSupplyRestrictedSpawnPoint : SCR_SpawnPoint
7{
8 //------------------------------------------------------------------------------------------------
11 override bool CanReserveFor_S(int playerId, out SCR_ESpawnResult result = SCR_ESpawnResult.SPAWN_NOT_ALLOWED)
12 {
13 if (!super.CanReserveFor_S(playerId, result))
14 return false;
15
16 IEntity playerController = GetGame().GetPlayerManager().GetPlayerController(playerId);
17 if (!playerController)
18 return false;
19
21 if (!loadoutComp)
22 return false;
23
25 if (loadout)
26 {
27 result = SCR_ESpawnResult.NOT_ALLOWED_CUSTOM_LOADOUT;
28 return false;
29 }
30
31 SCR_ResourceComponent resourceComp;
32 SCR_CampaignMilitaryBaseComponent base;
33 float spawnSupplyCost = SCR_ArsenalManagerComponent.GetLoadoutCalculatedSupplyCost(loadoutComp.GetLoadout(), false, playerId, null, this, base, resourceComp);
34
35 if (!resourceComp || base)
36 return false;
37
38 SCR_ResourceConsumer resourceConsumer = resourceComp.GetConsumer(EResourceGeneratorID.DEFAULT, EResourceType.SUPPLIES);
39 if (!resourceConsumer)
40 return false;
41
42 SCR_ResourceConsumtionResponse consumerResponse = resourceConsumer.RequestAvailability(spawnSupplyCost);
43
44 if (consumerResponse.GetReason() == EResourceReason.SUFFICIENT)
45 {
46 result = SCR_ESpawnResult.OK;
47 return true;
48 }
49
50 result = SCR_ESpawnResult.NOT_ALLOWED_NOT_ENOUGH_SUPPLIES;
51 return false;
52
53 }
54
55}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_ESpawnResult
void SCR_ResourceConsumtionResponse(float availableResource=0, float resourceMultiplier=0, float range=0, EResourceReason reasonCode=EResourceReason.UNAVAILABLE)
EResourceGeneratorID
proto external Managed FindComponent(typename typeName)
Spawn point entity defines positions on which players can possibly spawn.
bool CanReserveFor_S(int playerId, out SCR_ESpawnResult result=SCR_ESpawnResult.SPAWN_NOT_ALLOWED)