mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
New Loot functions (Furniture + Ground Loot)
This commit is contained in:
parent
0c866e9eea
commit
41924ef4f0
@ -5,7 +5,7 @@ forceRestartTime = 14400; // 4 hour restarts
|
||||
StaticDateTime[] = {}; // {0,0,0,8,0} would forces the server to start at 8am each time it is started while allowing the year, month and day to stay real time. Any values left at 0 will result in no change.
|
||||
timeDifference = 0; // Server uses real time this will allow you to offset just the hour.
|
||||
timeMultiplier = 4; // Sets a time multiplier for in-game time. The command range is now capped at 0.1 - 120 to avoid performance problems.
|
||||
lootMultiplier = 0.5; // 1 = max loot multiplier. This controls how much loot can payout per Epoch loot container.
|
||||
lootMultiplier = 1; // 1 = normal loot multiplier. This controls how much loot can payout per loot container.
|
||||
|
||||
// Events
|
||||
WeatherChances[] = {
|
||||
|
@ -1 +1 @@
|
||||
5 "" !="bis_fnc_execvm \[\[.+\],\"initPlayerServer.sqf\"]" !="bis_fnc_effectkilled(airdestruction|secondaries) \[.+\]" !="epoch_server_(checkplayer|save(_vehicles|building)|(lock|pack)Storage|(upgrade|remove|paint|maint)build) \[.+\]" !="epoch_server_((load|respawn|dead|invite|revive|teleport)Player) \[.+\]" !="epoch_server_((upgrade|updateplayer|inviteplayer|create|delete)(Temp|)Group) \[.+\]" !="epoch_server_(deadplayerdetonate|triggerantagonist|playersetvariable|missioncomms|make(marker|SP)|removemarker) \[.+\]" !="epoch_server_(upgrade_vehicle|knockDownTree|mineRocks|lootAnimal|handle_(say3d|switchmove|sapperObjs)) \[.+\]" !="epoch_server_((repair|fill|lock)Vehicle|(loot|fill)Container|(store|take)Crypto|make(NPC|)Trade) \[.+\]" !="epoch_server_(paycrypto|tradeRequest|equippeditem|packJack|create(object|AirDrop)|airDropCrate|destroytrash|unpackBackpack) \[.+\]" !="epoch_(localcleanup|fnc_saveplayer|client_bitePlayer|serverlootobject|fnc_updateplayerstats) \[.+\]" !="cup_fnc_handletow \[.+\]" !="bis_fnc_reviveinitaddplayer \[.+\]" !="epoch_server_(setfinalplayerpos|defusebomb|putcrypto|paintvehicle) \[.+\]"
|
||||
5 "" !="bis_fnc_execvm \[\[.+\],\"initPlayerServer.sqf\"]" !="bis_fnc_effectkilled(airdestruction|secondaries) \[.+\]" !="epoch_server_(checkplayer|save(_vehicles|building)|(lock|pack)Storage|(upgrade|remove|paint|maint)build) \[.+\]" !="epoch_server_((load|respawn|dead|invite|revive|teleport)Player) \[.+\]" !="epoch_server_((upgrade|updateplayer|inviteplayer|create|delete)(Temp|)Group) \[.+\]" !="epoch_server_(deadplayerdetonate|triggerantagonist|playersetvariable|missioncomms|make(marker|SP)|removemarker) \[.+\]" !="epoch_server_(upgrade_vehicle|knockDownTree|mineRocks|lootAnimal|handle_(say3d|switchmove|sapperObjs)) \[.+\]" !="epoch_server_((repair|fill|lock)Vehicle|(loot|fill)Container|(store|take)Crypto|make(NPC|)Trade) \[.+\]" !="epoch_server_(paycrypto|tradeRequest|equippeditem|packJack|create(object|AirDrop)|airDropCrate|destroytrash|unpackBackpack) \[.+\]" !="epoch_(localcleanup|fnc_saveplayer|client_bitePlayer|serverlootobject|fnc_updateplayerstats) \[.+\]" !="cup_fnc_handletow \[.+\]" !="bis_fnc_reviveinitaddplayer \[.+\]" !="epoch_server_(setfinalplayerpos|defusebomb|putcrypto|paintvehicle|spawnLoot) \[.+\]"
|
||||
|
@ -1,119 +0,0 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Runs chances to spawn loot objects on building
|
||||
|
||||
Licence:
|
||||
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/looting/EPOCH_spawnLoot.sqf
|
||||
|
||||
Example:
|
||||
[_building] call EPOCH_spawnLoot;
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJECT - building
|
||||
_this select 1: NUMBER - Number of buildings checked before a building in the array can reattempt looting. Default: 333
|
||||
_this select 2: NUMBER - Limit of loot objects, as new are created old ones will be removed. Default: 33
|
||||
|
||||
Returns:
|
||||
BOOL
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_class","_color","_colors","_config","_delete","_dir","_item","_lootBias","_lootLimit","_lootType","_loots","_masterConfig","_pos","_posName","_positions","_possibleCount","_possibleLoots","_randomIndex","_return","_selectedConfig","_selectedLoot","_lootObjectLimit"];
|
||||
//[[[end]]]
|
||||
params [["_building",objNull,[objNull]], ["_LootBiasAdd",0]];
|
||||
_lootObjectLimit = 33;
|
||||
_selectedConfig = typeOf _building;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _building) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
// replace spaces and periods with underscores
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
};
|
||||
|
||||
//diag_log format["DEBUG: _selectedConfig %1",_selectedConfig];
|
||||
|
||||
_masterConfig = 'CfgBuildingLootPos' call EPOCH_returnConfig;
|
||||
_config = _masterConfig >> _selectedConfig;
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
|
||||
// exit with false if building is not lootable
|
||||
_return = false;
|
||||
if !(isClass(_config)) exitWith {_return};
|
||||
|
||||
_lootBias = getNumber(_config >> "lootBias") + _LootBiasAdd;
|
||||
_lootBias = _lootBias / ((count (((position player) nearEntities 75) select {isplayer _x && alive _x})) max 1);
|
||||
_lootType = getText(_config >> "lootType");
|
||||
_loots = getArray(_config >> _lootType);
|
||||
_lootLimit = (round random(getNumber(_config >> "limit"))) max 1;
|
||||
_posName = "";
|
||||
|
||||
if ((random 100) < _lootBias) then {
|
||||
_possibleLoots = [];
|
||||
{
|
||||
_x params ["_posNameTMP","_class","_randomColor"];
|
||||
_posName = _posNameTMP;
|
||||
_positions = getArray(_config >> _posName);
|
||||
{
|
||||
_possibleLoots pushBack [_class,_randomColor,_x];
|
||||
} forEach _positions;
|
||||
} forEach _loots;
|
||||
|
||||
if !(_possibleLoots isEqualTo []) then {
|
||||
for "_i" from 1 to _lootLimit do
|
||||
{
|
||||
_return = true;
|
||||
_possibleCount = count _possibleLoots;
|
||||
if (_possibleCount > 0) then {
|
||||
_randomIndex = (floor random(_possibleCount));
|
||||
|
||||
_selectedLoot = _possibleLoots deleteAt _randomIndex;
|
||||
//
|
||||
_selectedLoot params ["_class","_randomColor","_position"];
|
||||
_position params ["_m2WPos","_relDir"];
|
||||
_pos = _building modelToWorld _m2WPos;
|
||||
// force item to ground level if resulting z pos is below ground.
|
||||
if (_pos select 2 < 0) then {
|
||||
_pos set[2, 0];
|
||||
};
|
||||
if (_class isEqualType []) then {
|
||||
_class = selectRandom _class;
|
||||
};
|
||||
_dir = _relDir + (getDir _building);
|
||||
_item = createVehicle[_class, _pos, [], 0.0, "CAN_COLLIDE"];
|
||||
_item setDir _dir;
|
||||
|
||||
EPOCH_lootObjects pushBack _item;
|
||||
if (count EPOCH_lootObjects > _lootObjectLimit) then {
|
||||
_delete = EPOCH_lootObjects deleteAt 0;
|
||||
if (!isnull _delete) then {
|
||||
deleteVehicle _delete;
|
||||
};
|
||||
};
|
||||
|
||||
if (surfaceIsWater _pos) then {
|
||||
_item setPosASL _pos;
|
||||
} else {
|
||||
_item setPosATL _pos;
|
||||
};
|
||||
|
||||
if (_randomColor isEqualTo "true") then {
|
||||
_colors = getArray(_cfgBaseBuilding >> _class >> "availableTextures");
|
||||
if !(_colors isEqualTo[]) then {
|
||||
_color = selectRandom _colors;
|
||||
_item setObjectTextureGlobal[0, _color];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
diag_log format["DEBUG: no positions for: %1",_posName];
|
||||
};
|
||||
};
|
||||
_return
|
@ -2,4 +2,4 @@
|
||||
call epoch_favBar_refresh;
|
||||
|
||||
// process loot
|
||||
_LootBiasAdd = _LootBiasAdd call _lootBubble;
|
||||
call _lootBubble;
|
||||
|
@ -25,10 +25,6 @@ _UnFadeCheck = {
|
||||
};
|
||||
};
|
||||
|
||||
// Lootspawner
|
||||
_LootSpawned = false;
|
||||
_LootBiasAdd = 30;
|
||||
|
||||
// init player stat vars
|
||||
_gmVarsInit = ["CfgEpochClient", "gmVars", [["Temp",98.6],["Hunger",500],["Thirst",500],["Toxicity",0],["Stamina",10],["BloodP",100],["Alcohol",0],["Radiation",0]]] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_gModeVarNames = _gmVarsInit apply {_x param [0,""]};
|
||||
@ -139,6 +135,7 @@ _EPOCH_Autorunspeed = 1;
|
||||
// init config data
|
||||
_antagonistRndChance = ["CfgEpochClient", "antagonistRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
|
||||
|
||||
_LootCleanupTime = ["CfgBuildingLootPos", "LootCleanupTime", 300] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_baseRadiationLoss = ["CfgEpochClient", "baseRadiationLoss", -0.1] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_baseRadiationLossImmunityPenalty = ["CfgEpochClient", "baseRadiationLossImmunityPenalty", -0.1] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_baseHungerLoss = ["CfgEpochClient", "baseHungerLoss", 2] call EPOCH_fnc_returnConfigEntryV2;
|
||||
@ -238,88 +235,40 @@ _PlayTimeTimer = diag_ticktime;
|
||||
_UpdateTopStats = false;
|
||||
EPOCH_MyStatsPublic = !((missionnamespace getvariable ["EPOCH_totalPublicStats",1]) isEqualTo 0);
|
||||
|
||||
_pushbacklootedbld = {
|
||||
private ["_lootCheckBufferLimit"];
|
||||
_lootCheckBufferLimit = 333;
|
||||
EPOCH_LootedBlds pushBackUnique _this;
|
||||
if (count EPOCH_LootedBlds >= _lootCheckBufferLimit) then {
|
||||
EPOCH_LootedBlds deleteAt 0;
|
||||
};
|
||||
};
|
||||
_lootBubble = {
|
||||
private["_jammer", "_others", "_objects", "_nearObjects", "_building", "_lootDist", "_lootLoc", "_playerPos", "_distanceTraveled","_AddBias","_dir","_minlootdist","_maxlootdist"];
|
||||
_LootBiasAdd = _this;
|
||||
if (!alive player) exitwith {};
|
||||
if (speed vehicle player > 30) exitwith {};
|
||||
_playerPos = getPosATL vehicle player;
|
||||
_distanceTraveled = _lastPlayerPos distance2D _playerPos;
|
||||
_nearestbuilding = nearestBuilding player;
|
||||
if (player distance _nearestbuilding < (((sizeOf (typeOf _nearestbuilding))/2) min 15)) then {
|
||||
private _selectedConfig = typeOf _nearestbuilding;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _nearestbuilding) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
};
|
||||
if ((toLower _selectedConfig) in _lootClasses) then {
|
||||
_nearestbuilding call _pushbacklootedbld;
|
||||
};
|
||||
};
|
||||
if (_distanceTraveled > 10) then {
|
||||
_lastPlayerPos = _playerPos;
|
||||
if (_distanceTraveled < 100) then {
|
||||
_minlootdist = 30;
|
||||
_maxlootdist = 75;
|
||||
_dir = 30;
|
||||
if (speed (vehicle player) < 30) then {
|
||||
_LootBiasAdd = (_LootBiasAdd + 0.5) min 50;
|
||||
_minlootdist = 15;
|
||||
_maxlootdist = 50;
|
||||
_dir = 45;
|
||||
};
|
||||
_lootDist = (_distanceTraveled max _minlootdist) min _maxlootdist;
|
||||
_lootLoc = player getRelPos [_lootDist, (random [-_dir,0,_dir])];
|
||||
if (surfaceiswater _lootLoc) then {
|
||||
_lootLoc set [2,(getPosASL vehicle player) select 2];
|
||||
};
|
||||
_objects = (nearestObjects [_lootLoc, [], 50]) select {
|
||||
!(_x in EPOCH_LootedBlds) &&
|
||||
{_x distance player > _minlootdist} &&
|
||||
{_x distance player < _maxlootdist} &&
|
||||
{
|
||||
private _selectedConfig = typeOf _x;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _x) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
};
|
||||
((toLower _selectedConfig) in _lootClasses)
|
||||
}
|
||||
};
|
||||
if (count _objects > 4) then { // remove the farthest away buildings
|
||||
_objects resize 4;
|
||||
};
|
||||
// diag_log format["DEBUG: loot objects %1",_objects];
|
||||
_jammer = ((nearestObjects [_lootLoc, call EPOCH_JammerClasses, ((call EPOCH_MaxJammerRange) + 50)]) select {_x distance _lootLoc < ((getnumber (getmissionconfig "cfgEpochClient" >> "CfgJammers" >> (typeof _x) >> "buildingJammerRange"))+50)}) + (_lootLoc nearObjects ["ProtectionZone_Invisible_F", 25]);
|
||||
if (!(_objects isEqualTo[]) && (_jammer isEqualTo[])) then {
|
||||
_building = selectRandom _objects;
|
||||
if (_building getvariable ["EPOCH_Skiploot",false]) exitwith {};
|
||||
if !(_building in EPOCH_LootedBlds) then {
|
||||
_others = _building nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 15];
|
||||
if (_others isEqualTo[]) then {
|
||||
_nearObjects = nearestObjects[_building, ["WH_Loot", "Animated_Loot"], 25 min ((sizeOf (typeOf _building))/2)];
|
||||
//diag_log format["DEBUG: sizeof %1 %2",sizeOf (typeOf _building), typeOf _building];
|
||||
if (_nearObjects isEqualTo[]) then {
|
||||
_building call _pushbacklootedbld;
|
||||
_LootBiasAdd = if ([_building,_LootBiasAdd] call EPOCH_spawnLoot) then {(_LootBiasAdd - 7) max 0} else {_LootBiasAdd};
|
||||
};
|
||||
};
|
||||
if (_lastPlayerPos distance2D _playerPos < 30) exitwith {};
|
||||
_lastPlayerPos = _playerPos;
|
||||
if (missionnamespace getvariable ["InSafeZone",false]) exitwith {};
|
||||
_objects = (player nearObjects ["Building", 60]) select {
|
||||
!((_x getvariable ["Epoch_LastLootCheck",-10000]) > (diag_ticktime - _LootCleanupTime)) &&
|
||||
{!(_x getvariable ["EPOCH_Skiploot",false])} &&
|
||||
{(_x nearObjects ["PlotPole_Epoch", 100]) isEqualTo []} &&
|
||||
{(_x nearObjects ["ProtectionZone_Invisible_F", 25]) isEqualTo []} &&
|
||||
{(_x nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 15]) isEqualTo []} &&
|
||||
{!(isObjectHidden _x)} &&
|
||||
{
|
||||
private _selectedConfig = typeOf _x;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _x) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
};
|
||||
};
|
||||
((toLower _selectedConfig) in _lootClasses)
|
||||
}
|
||||
};
|
||||
if !(_objects isEqualTo[]) then {
|
||||
{
|
||||
_x setvariable ["Epoch_LastLootCheck",diag_ticktime];
|
||||
} foreach _objects;
|
||||
[player,Epoch_personalToken,_objects] remoteExec ["EPOCH_server_spawnLoot",2];
|
||||
};
|
||||
_LootBiasAdd
|
||||
};
|
||||
call _lootBubble;
|
||||
|
||||
// init weather temperature var if not already set
|
||||
if (isNil "EPOCH_CURRENT_WEATHER") then {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -266,10 +266,6 @@ class CfgClientFunctions
|
||||
class message_old1 {};
|
||||
class message_old2 {};
|
||||
};
|
||||
class looting
|
||||
{
|
||||
class spawnLoot {};
|
||||
};
|
||||
class gui
|
||||
{
|
||||
file = "epoch_code\gui\scripts";
|
||||
|
@ -26,6 +26,11 @@ class CfgRemoteExec
|
||||
{
|
||||
mode = 1;
|
||||
jip = 0;
|
||||
class EPOCH_server_spawnLoot
|
||||
{
|
||||
allowedTargets=2;
|
||||
jip = 0;
|
||||
};
|
||||
class EPOCH_server_PaintVehicle
|
||||
{
|
||||
allowedTargets=2;
|
||||
|
@ -25,8 +25,11 @@ if (_player distance _object > 20) exitWith{};
|
||||
if !(_object in EPOCH_cleanupQueue) then {
|
||||
|
||||
[_player,"LootedObjs",1,true] call EPOCH_server_updatePlayerStats;
|
||||
|
||||
EPOCH_cleanupQueue pushBack _object;
|
||||
|
||||
_parent = _object getvariable ["Epoch_ParentBuilding",ObjNull];
|
||||
if (isnull _parent) then {
|
||||
EPOCH_cleanupQueue pushBack _object;
|
||||
};
|
||||
|
||||
_type = typeOf _object;
|
||||
|
||||
@ -46,6 +49,11 @@ if !(_object in EPOCH_cleanupQueue) then {
|
||||
_object = createVehicle [_class, _pos, [], 0.0, "CAN_COLLIDE"];
|
||||
_object setDir _dir;
|
||||
_object setPosATL _pos;
|
||||
if !(isNull _parent) then {
|
||||
_ParentLoots = _parent getvariable ["Epoch_BuildingLoot",[]];
|
||||
_ParentLoots pushback _object;
|
||||
_parent setvariable ["Epoch_BuildingLoot",_ParentLoots];
|
||||
};
|
||||
};
|
||||
|
||||
[_object, _type] call EPOCH_serverLootObject;
|
||||
@ -54,7 +62,7 @@ if !(_object in EPOCH_cleanupQueue) then {
|
||||
[_object, {player action["Gear", _this]}] remoteExec ["call", _player];
|
||||
};
|
||||
} else {
|
||||
[_object, "Food"] call EPOCH_serverLootObject;
|
||||
[_object, "Default"] call EPOCH_serverLootObject;
|
||||
// force player to open gear on this object.
|
||||
[_object, {player action["Gear", _this]}] remoteExec ["call", _player];
|
||||
};
|
||||
|
@ -0,0 +1,133 @@
|
||||
/*
|
||||
Author: He-Man - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side Loot Spawner
|
||||
|
||||
Licence:
|
||||
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||
|
||||
Github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_looting/EPOCH_server_spawnLoot.sqf
|
||||
*/
|
||||
|
||||
private [ "_masterConfig","_building","_buildingLoot","_selectedConfig","_config","_EpochLootChance","_cfgBaseBuilding","_loots","_lootLimit","_possibleLoots","_posName","_positions","_possibleCount","_randomIndex","_selectedLoot",
|
||||
"_pos","_dir","_item","_color","_GroundSpawnChance","_MinGroundContainers","_MaxGroundContainers","_lootType"
|
||||
];
|
||||
|
||||
params [["_player",objNull,[objNull]],["_token","",[""]],["_objects",[]]];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_masterConfig = getmissionconfig "CfgBuildingLootPos";
|
||||
{
|
||||
_building = _x;
|
||||
_buildingLoot = [];
|
||||
if !(_building in Epoch_LootedBuildings) then {
|
||||
_building setvariable ["Epoch_LootCleanup",diag_ticktime + Epoch_LootCleanupTime];
|
||||
Epoch_LootedBuildings pushBackUnique _building;
|
||||
_selectedConfig = typeOf _building;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
(getModelInfo _building) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
};
|
||||
_config = _masterConfig >> _selectedConfig;
|
||||
if (isClass(_config)) then {
|
||||
_EpochLootChance = getNumber (_config >> "EpochLootChance");
|
||||
if ((random 100) < _EpochLootChance) then {
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_loots = getArray(_config >> "loottypes");
|
||||
_lootLimit = (round random(getNumber(_config >> "limit"))) max 1;
|
||||
_possibleLoots = [];
|
||||
{
|
||||
_x params ["_posNameTMP","_class","_randomColor"];
|
||||
_posName = _posNameTMP;
|
||||
_positions = getArray(_config >> _posName);
|
||||
{
|
||||
_possibleLoots pushBack [_class,_randomColor,_x];
|
||||
} forEach _positions;
|
||||
} forEach _loots;
|
||||
if !(_possibleLoots isEqualTo []) then {
|
||||
for "_i" from 1 to _lootLimit do {
|
||||
_possibleCount = count _possibleLoots;
|
||||
if (_possibleCount > 0) then {
|
||||
_randomIndex = (floor random(_possibleCount));
|
||||
_selectedLoot = _possibleLoots deleteAt _randomIndex;
|
||||
_selectedLoot params ["_class","_randomColor","_position"];
|
||||
_position params ["_m2WPos","_relDir"];
|
||||
_pos = _building modelToWorld _m2WPos;
|
||||
if (_pos select 2 < 0) then {
|
||||
_pos set[2, 0];
|
||||
};
|
||||
if (_class isEqualType []) then {
|
||||
_class = selectRandom _class;
|
||||
};
|
||||
_dir = _relDir + (getDir _building);
|
||||
_item = createVehicle[_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_item setvariable ["Epoch_ParentBuilding",_building];
|
||||
_buildingLoot pushback _item;
|
||||
_item setDir _dir;
|
||||
if (surfaceIsWater _pos) then {
|
||||
_item setPosASL _pos;
|
||||
}
|
||||
else {
|
||||
_item setPosATL _pos;
|
||||
};
|
||||
if (_randomColor isEqualTo "true") then {
|
||||
_colors = getArray(_cfgBaseBuilding >> _class >> "availableTextures");
|
||||
if !(_colors isEqualTo[]) then {
|
||||
_color = selectRandom _colors;
|
||||
_item setObjectTextureGlobal[0, _color];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
_building setvariable ["Epoch_BuildingLoot",_buildingLoot];
|
||||
};
|
||||
}
|
||||
else {
|
||||
_GroundSpawnChance = getNumber (_config >> "GroundSpawnChance");
|
||||
if ((random 100) < _GroundSpawnChance) then {
|
||||
_MinGroundContainers = getNumber (_config >> "MinGroundContainers");
|
||||
_MaxGroundContainers = getNumber (_config >> "MaxGroundContainers");
|
||||
_lootType = getText(_config >> "lootType");
|
||||
_loots = getArray(_config >> "loottypes");
|
||||
_positions = [];
|
||||
{
|
||||
_x params ["_posName","_class","_randomColor"];
|
||||
if !((tolower _posName) in ["cabinetpos","toolrackpos"]) then {
|
||||
_positions = _positions + getArray (_config >> _posName);
|
||||
};
|
||||
} forEach _loots;
|
||||
if !(_positions isEqualTo []) then {
|
||||
for "_i" from 1 to (_MinGroundContainers + (round (random (_MaxGroundContainers - _MinGroundContainers)))) do {
|
||||
if ((count _positions) > 0) then {
|
||||
_position = _positions deleteat (floor (random (count _positions)));
|
||||
_position params ["_m2WPos","_relDir"];
|
||||
_pos = _building modelToWorld _m2WPos;
|
||||
_pos vectoradd [0,0,0.1];
|
||||
if (_pos select 2 < 0) then {
|
||||
_pos set[2, 0];
|
||||
};
|
||||
_item = createVehicle ["Epoch_LootHolder", _pos, [], 0, "CAN_COLLIDE"];
|
||||
_buildingLoot pushback _item;
|
||||
if (surfaceIsWater _pos) then {
|
||||
_item setPosASL _pos;
|
||||
}
|
||||
else {
|
||||
_item setPosATL _pos;
|
||||
};
|
||||
[_item, format ["loots_%1",_lootType]] call EPOCH_serverLootObject;
|
||||
};
|
||||
};
|
||||
_building setvariable ["Epoch_BuildingLoot",_buildingLoot,true]; // true for debug!
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} foreach _objects;
|
@ -38,7 +38,7 @@ if (!isNull _object || !(_scatter isequalto [])) then{
|
||||
_config = configFile >> "CfgMainTable" >> _type;
|
||||
_minLoot = getNumber(_config >> "lootMin");
|
||||
_maxLoot = getNumber(_config >> "lootMax");
|
||||
_maxPayout = ((random(_maxLoot) * EPOCH_lootMultiplier) min _maxLoot) max _minLoot;
|
||||
_maxPayout = (round (random(_maxLoot * EPOCH_lootMultiplier))) max _minLoot;
|
||||
for "_k" from 1 to _maxPayout do {
|
||||
_loots pushBack (selectRandomWeighted _lootTable);
|
||||
};
|
||||
|
@ -54,6 +54,7 @@ class CfgServerFunctions
|
||||
class server_knockDownTree {};
|
||||
class server_mineRocks {};
|
||||
class server_lootAnimal {};
|
||||
class server_spawnLoot {};
|
||||
};
|
||||
class epoch_player {
|
||||
class fnc_addItemToX {};
|
||||
|
@ -25,6 +25,7 @@ EPOCH_staticTraderLocations = [];
|
||||
EPOCH_staticNPCTraderPos = [];
|
||||
EPOCH_traderStoredVehicles = [];
|
||||
EPOCH_traderStoredVehiclesCnt = [];
|
||||
Epoch_LootedBuildings = [];
|
||||
|
||||
private _configArray = [
|
||||
["serverRestart", false],
|
||||
@ -154,3 +155,8 @@ if !(EPOCH_TopStatsVars isEqualTo _TopStatsVarsDb) then {
|
||||
};
|
||||
publicvariable "EPOCH_TopStats";
|
||||
publicvariable "EPOCH_TopStatsVars";
|
||||
|
||||
Epoch_LootCleanupTime = getNumber ((getmissionconfig "CfgBuildingLootPos") >> "LootCleanupTime");
|
||||
if (Epoch_LootCleanupTime == 0) then {
|
||||
Epoch_LootCleanupTime = 300;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*%FSM<COMPILE "C:\Program Files (x86)\Steam\steamapps\common\Arma 3 Tools\FSMEditor\scriptedFSM.cfg, Server Monitor">*/
|
||||
/*%FSM<HEAD>*/
|
||||
/*
|
||||
item0[] = {"Init",0,250,600.000000,-575.000000,700.000000,-525.000000,0.000000,"Init"};
|
||||
item0[] = {"Init",0,4346,600.000000,-575.000000,700.000000,-525.000000,0.000000,"Init"};
|
||||
item1[] = {"_",8,218,600.000000,-500.000000,700.000000,-450.000000,0.000000,""};
|
||||
item2[] = {"Process",2,250,600.000000,-350.000000,700.000000,-300.000000,0.000000,"Process"};
|
||||
item3[] = {"Vehicle_and_Player",4,218,750.986694,-310.854675,850.986694,-260.854675,1.000000,"" \n "Vehicle and Player" \n "Checks"};
|
||||
@ -13,8 +13,9 @@ item8[] = {"Save_Vehicles",4,218,450.000000,-300.000000,550.000000,-250.000000,4
|
||||
item9[] = {"Cleanup_Handler",4,218,750.000000,-450.000000,850.000000,-400.000000,8.000000,"Cleanup" \n "Handler"};
|
||||
item10[] = {"Server_FPS",4,218,746.045227,-248.683014,846.045227,-198.683014,0.000000,"Server FPS"};
|
||||
item11[] = {"Forced_Restart",4,218,684.856567,-214.145233,784.856567,-164.145233,0.000000,"Forced" \n "Restart"};
|
||||
item12[] = {"Events_Monitor",4,4314,516.730896,-213.251221,616.730896,-163.251221,0.000000,"Events" \n "Monitor"};
|
||||
item12[] = {"Events_Monitor",4,218,516.730896,-213.251221,616.730896,-163.251221,0.000000,"Events" \n "Monitor"};
|
||||
item13[] = {"_",-1,250,532.894043,-183.108612,548.753357,-175.178955,0.000000,""};
|
||||
item14[] = {"Loot_Cleanup",4,218,419.174591,-226.325470,519.174561,-176.325470,8.000000,"Loot" \n "Cleanup"};
|
||||
version=1;
|
||||
class LayoutItems
|
||||
{
|
||||
@ -40,18 +41,20 @@ link8[] = {2,9};
|
||||
link9[] = {2,10};
|
||||
link10[] = {2,11};
|
||||
link11[] = {2,12};
|
||||
link12[] = {3,2};
|
||||
link13[] = {4,2};
|
||||
link14[] = {5,2};
|
||||
link15[] = {6,2};
|
||||
link16[] = {7,2};
|
||||
link17[] = {8,2};
|
||||
link18[] = {9,2};
|
||||
link19[] = {10,2};
|
||||
link20[] = {11,2};
|
||||
link21[] = {12,2};
|
||||
globals[] = {0.000000,0,0,0,0,640,480,1,6,6316128,1,275.180084,1161.319580,208.497711,-659.879456,896,844,1};
|
||||
window[] = {2,-1,-1,-32000,-32000,984,224,1516,224,3,918};
|
||||
link12[] = {2,14};
|
||||
link13[] = {3,2};
|
||||
link14[] = {4,2};
|
||||
link15[] = {5,2};
|
||||
link16[] = {6,2};
|
||||
link17[] = {7,2};
|
||||
link18[] = {8,2};
|
||||
link19[] = {9,2};
|
||||
link20[] = {10,2};
|
||||
link21[] = {11,2};
|
||||
link22[] = {12,2};
|
||||
link23[] = {14,2};
|
||||
globals[] = {0.000000,0,0,0,0,640,480,1,7,6316128,1,275.180084,1161.319580,208.497711,-659.879456,900,884,1};
|
||||
window[] = {2,-1,-1,-1,-1,942,182,1474,182,3,918};
|
||||
*//*%FSM</HEAD>*/
|
||||
class FSM
|
||||
{
|
||||
@ -109,6 +112,7 @@ class FSM
|
||||
"_lastWeatherChange = diag_tickTime;" \n
|
||||
"_lastObjectCleanup = diag_tickTime;" \n
|
||||
"_lastObjectCleanup1 = diag_tickTime;" \n
|
||||
"_lastLootCleanup = diag_ticktime;" \n
|
||||
"" \n
|
||||
"_pvehTime = diag_tickTime;" \n
|
||||
"_forcedrestartTimer = diag_tickTime;" \n
|
||||
@ -183,6 +187,21 @@ class FSM
|
||||
" };" \n
|
||||
" };" \n
|
||||
"};" \n
|
||||
"" \n
|
||||
"_cleanLoot = {" \n
|
||||
" if ((_this getvariable [""Epoch_LootCleanup"",diag_ticktime]) > diag_ticktime) exitwith {" \n
|
||||
" Epoch_LootedBuildings pushBackUnique _this;" \n
|
||||
" };" \n
|
||||
" if !((_this nearEntities [[""Epoch_Male_F"", ""Epoch_Female_F""], 50]) isEqualTo []) exitwith {" \n
|
||||
" Epoch_LootedBuildings pushBackUnique _this;" \n
|
||||
" };" \n
|
||||
" _Loots = _this getvariable [""Epoch_BuildingLoot"",[]];" \n
|
||||
" {" \n
|
||||
" deletevehicle _x;" \n
|
||||
" } foreach _Loots;" \n
|
||||
" _this setvariable [""Epoch_BuildingLoot"",nil];" \n
|
||||
" _this setvariable [""Epoch_LootCleanup"",nil];" \n
|
||||
"};" \n
|
||||
""/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
@ -231,20 +250,20 @@ class FSM
|
||||
""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Cleanup_Handler">*/
|
||||
class Cleanup_Handler
|
||||
/*%FSM<LINK "Loot_Cleanup">*/
|
||||
class Loot_Cleanup
|
||||
{
|
||||
itemno = 9;
|
||||
itemno = 14;
|
||||
priority = 8.000000;
|
||||
to="Process";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastObjectCleanup) > 300)"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"_lastObjectCleanup = diag_tickTime;" \n
|
||||
"" \n
|
||||
"// TODO need better way allMissionObjects is not performant" \n
|
||||
"if (_cleanupItems isEqualTo []) then {" \n
|
||||
" _cleanupItems = allMissionObjects ""groundWeaponHolder"" + entities ""WeaponHolderSimulated"";" \n
|
||||
"};"/*%FSM</ACTION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastLootCleanup) > 0.5)"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"" \n
|
||||
"_lastLootCleanup = diag_tickTime;" \n
|
||||
"if !(Epoch_LootedBuildings isEqualTo []) then {" \n
|
||||
" (Epoch_LootedBuildings deleteAt 0) call _cleanLoot;" \n
|
||||
"};" \n
|
||||
""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Cleanup">*/
|
||||
@ -265,6 +284,22 @@ class FSM
|
||||
"};"/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Cleanup_Handler">*/
|
||||
class Cleanup_Handler
|
||||
{
|
||||
itemno = 9;
|
||||
priority = 8.000000;
|
||||
to="Process";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastObjectCleanup) > 300)"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"_lastObjectCleanup = diag_tickTime;" \n
|
||||
"" \n
|
||||
"// TODO need better way allMissionObjects is not performant" \n
|
||||
"if (_cleanupItems isEqualTo []) then {" \n
|
||||
" _cleanupItems = allMissionObjects ""groundWeaponHolder"" + entities ""WeaponHolderSimulated"";" \n
|
||||
"};"/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Save_Vehicles">*/
|
||||
class Save_Vehicles
|
||||
{
|
||||
@ -354,29 +389,6 @@ class FSM
|
||||
""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Server_FPS">*/
|
||||
class Server_FPS
|
||||
{
|
||||
itemno = 10;
|
||||
priority = 0.000000;
|
||||
to="Process";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _serverFpsTime) > 30) && _serverFPSCheckFine"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"_serverFpsTime = diag_tickTime;" \n
|
||||
"" \n
|
||||
"if (_oldFPS isEqualTo EPOCH_diag_fps) then {" \n
|
||||
" _currentFPS = round(diag_fps);" \n
|
||||
" if !(_oldFPS isEqualTo _currentFPS) then {" \n
|
||||
" missionNamespace setVariable [""EPOCH_diag_fps"",_currentFPS,true];" \n
|
||||
" _oldFPS = _currentFPS;" \n
|
||||
" };" \n
|
||||
"} else {" \n
|
||||
" missionNamespace setVariable [""EPOCH_diag_fps"", compileFinal """",true];" \n
|
||||
" _serverFPSCheckFine = false;" \n
|
||||
"};" \n
|
||||
""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Forced_Restart">*/
|
||||
class Forced_Restart
|
||||
{
|
||||
@ -500,6 +512,29 @@ class FSM
|
||||
"_events2Check = _newEventsArray;"/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Server_FPS">*/
|
||||
class Server_FPS
|
||||
{
|
||||
itemno = 10;
|
||||
priority = 0.000000;
|
||||
to="Process";
|
||||
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
|
||||
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _serverFpsTime) > 30) && _serverFPSCheckFine"/*%FSM</CONDITION""">*/;
|
||||
action=/*%FSM<ACTION""">*/"_serverFpsTime = diag_tickTime;" \n
|
||||
"" \n
|
||||
"if (_oldFPS isEqualTo EPOCH_diag_fps) then {" \n
|
||||
" _currentFPS = round(diag_fps);" \n
|
||||
" if !(_oldFPS isEqualTo _currentFPS) then {" \n
|
||||
" missionNamespace setVariable [""EPOCH_diag_fps"",_currentFPS,true];" \n
|
||||
" _oldFPS = _currentFPS;" \n
|
||||
" };" \n
|
||||
"} else {" \n
|
||||
" missionNamespace setVariable [""EPOCH_diag_fps"", compileFinal """",true];" \n
|
||||
" _serverFPSCheckFine = false;" \n
|
||||
"};" \n
|
||||
""/*%FSM</ACTION""">*/;
|
||||
};
|
||||
/*%FSM</LINK>*/
|
||||
/*%FSM<LINK "Events_Manager">*/
|
||||
class Events_Manager
|
||||
{
|
||||
@ -581,4 +616,4 @@ class FSM
|
||||
{
|
||||
};
|
||||
};
|
||||
/*%FSM</COMPILE>*/
|
||||
/*%FSM</COMPILE>*/
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user