Initial Commit
This commit is contained in:
parent
b703f0bc62
commit
ca7e4c20d5
40
CreatePBOs.bat
Normal file
40
CreatePBOs.bat
Normal file
@ -0,0 +1,40 @@
|
||||
@Echo off
|
||||
REM C:\Program Files\PBO Manager v.1.4 beta\PBOConsole.exe -pack <folder_to_pack> <resulting_file_name>
|
||||
|
||||
SET PBO="C:\Program Files\PBO Manager v.1.4 beta\PBOConsole.exe"
|
||||
f:
|
||||
cd F:\GitRepo\Arma3_Repo\Server
|
||||
|
||||
|
||||
REM Create @A3EAI PBO
|
||||
%PBO% -pack .\@A3EAI\addons\a3eai_config .\@A3EAI\addons\a3eai_config.pbo
|
||||
%PBO% -pack .\@A3EAI\addons\a3eai .\@A3EAI\addons\a3eai.pbo
|
||||
|
||||
REM Create a3_vemf_reloaded
|
||||
%PBO% -pack .\@epochhive\addons\a3_vemf_reloaded .\@epochhive\addons\a3_vemf_reloaded.pbo
|
||||
%PBO% -pack .\@epochhive\addons\a3_vemf_reloaded_config .\@epochhive\addons\a3_vemf_reloaded_config.pbo
|
||||
|
||||
REM Create DZMS
|
||||
%PBO% -pack .\@epochhive\addons\DZMS .\@epochhive\addons\DZMS.pbo
|
||||
|
||||
REM Epoch Server Files
|
||||
%PBO% -pack .\@epochhive\addons\epoch_server .\@epochhive\addons\epoch_server.pbo
|
||||
%PBO% -pack .\@epochhive\addons\epoch_server_core .\@epochhive\addons\epoch_server_core.pbo
|
||||
%PBO% -pack .\@epochhive\addons\epoch_server_debris_event .\@epochhive\addons\epoch_server_debris_event.pbo
|
||||
%PBO% -pack .\@epochhive\epoch_server\addons\events .\@epochhive\epoch_server\addons\events.pbo
|
||||
%PBO% -pack .\@epochhive\addons\epoch_server_settings .\@epochhive\addons\epoch_server_settings.pbo
|
||||
%PBO% -pack .\@epochhive\addons\epoch_server_vip_event .\@epochhive\addons\epoch_server_vip_event.pbo
|
||||
|
||||
REM SEM
|
||||
%PBO% -pack .\@epochhive\addons\sem .\@epochhive\addons\sem.pbo
|
||||
|
||||
REM UD
|
||||
%PBO% -pack .\@epochhive\addons\ud .\@epochhive\addons\ud.pbo
|
||||
|
||||
REM GMS
|
||||
%PBO% -pack .\@GMS\addons\custom_server .\@GMS\addons\custom_server.pbo
|
||||
|
||||
REM Mission File
|
||||
%PBO% -pack .\mpmissions\epoch.Bornholm .\mpmissions\epoch.Bornholm.pbo
|
||||
|
||||
pause
|
1
Server/@epochhive/addons/epoch_server/$PREFIX$
Normal file
1
Server/@epochhive/addons/epoch_server/$PREFIX$
Normal file
@ -0,0 +1 @@
|
||||
epoch_server
|
5
Server/@epochhive/addons/epoch_server/BIS_AddonInfo.hpp
Normal file
5
Server/@epochhive/addons/epoch_server/BIS_AddonInfo.hpp
Normal file
@ -0,0 +1,5 @@
|
||||
class BIS_AddonInfo
|
||||
{
|
||||
author="";
|
||||
timepacked="1521065975";
|
||||
};
|
1
Server/@epochhive/addons/epoch_server/build.hpp
Normal file
1
Server/@epochhive/addons/epoch_server/build.hpp
Normal file
@ -0,0 +1 @@
|
||||
build=826;
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Handle set damage on sapper bombs sderver side
|
||||
|
||||
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_antagonists/EPOCH_server_handle_sapperObjs.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_safeBombs","_safeUnits"];
|
||||
//[[[end]]]
|
||||
params [["_bomb",objNull], "_player", ["_token","",[""]], "_unit", ["_killUnit",false]];
|
||||
if !([_player,_token]call EPOCH_server_getPToken)exitWith{};
|
||||
_safeUnits = ["Epoch_Sapper_F","Epoch_SapperB_F","Epoch_SapperG_F"];
|
||||
_safeBombs = ["Sapper_Charge_Ammo","SapperB_Charge_Ammo","SmokeShellToxicSapper"];
|
||||
if!(isNull _bomb)then{
|
||||
if(typeOf _bomb in _safeBombs) then {
|
||||
_bomb setDamage 1;
|
||||
};
|
||||
};
|
||||
if(_killUnit && {!isNull _unit})then{
|
||||
if(typeOf _unit in _safeUnits) then {
|
||||
_unit setDamage 1;
|
||||
};
|
||||
};
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
3d Sound System
|
||||
|
||||
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_antagonists/EPOCH_server_handle_say3D.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_nearBy","_range","_say3dsoundsConfig","_selectedSound","_target","_targets"];
|
||||
//[[[end]]]
|
||||
params [["_player",objNull,[objNull]],["_target",objNull],["_sound","",[""]], ["_token","",[""]] ];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _target) then {_target = _player};
|
||||
|
||||
_say3dsoundsConfig = 'CfgSay3Dhandler' call EPOCH_returnConfig;
|
||||
_selectedSound = (_say3dsoundsConfig >> _sound);
|
||||
if (isClass _selectedSound) then {
|
||||
// get nearby players based on range
|
||||
_range = getNumber(_selectedSound >> "distance");
|
||||
_nearBy = (_target nearEntities [["Epoch_Male_F","Epoch_Female_F","LandVehicle","Ship","Air","Tank"], _range]) select {isPlayer _x};
|
||||
// send sound to everyone except caller.
|
||||
_targets = _nearBy - [_player];
|
||||
if !(_targets isEqualTo []) then {
|
||||
[_target, _sound] remoteExec ['say3D',_targets];
|
||||
};
|
||||
};
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Animations
|
||||
|
||||
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_antagonists/EPOCH_server_handle_switchMove.sqf
|
||||
|
||||
Usage:
|
||||
[_player,"moveName","token",_target] call EPOCH_server_handle_switchMove;
|
||||
or
|
||||
[_player,"moveName","token"] call EPOCH_server_handle_switchMove;
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_nearBy","_range","_selectedMove","_switchMovehandlerConfig","_target","_targets"];
|
||||
//[[[end]]]
|
||||
params [["_player",objNull,[objNull]],["_move","",[""]],["_token","",[""]],["_target",objNull]];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (_move isEqualTo "") exitWith {};
|
||||
if (isNull _target) then {_target = _player};
|
||||
|
||||
_switchMovehandlerConfig = 'CfgSwitchMovehandler' call EPOCH_returnConfig;
|
||||
_selectedMove = (_switchMovehandlerConfig >> _move);
|
||||
if (isClass _selectedMove) then {
|
||||
// get nearby players based on range
|
||||
_range = getNumber(_selectedMove >> "distance");
|
||||
_nearBy = (_target nearEntities [["Epoch_Male_F","Epoch_Female_F","LandVehicle","Ship","Air","Tank"], _range]) select {isPlayer _x};
|
||||
// send move to everyone except caller.
|
||||
_targets = _nearBy - [_player];
|
||||
if !(_targets isEqualTo []) then {
|
||||
[_target, _move] remoteExec ['switchMove',_targets];
|
||||
};
|
||||
};
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors: Aaron Clark
|
||||
|
||||
Description:
|
||||
Trigger an antagonist on a client. Option to add antagonist object to target as a variable.
|
||||
|
||||
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_antagonists/EPOCH_server_triggerAntagonist.sqf
|
||||
*/
|
||||
params ["_target","_antagonistClass","_doVariable","_player","_token"];
|
||||
diag_log format["Epoch: ADMIN: Attempting antagonist (%3) trigger from %1 for %2.", getPlayerUID _player, _target, _antagonistClass];
|
||||
if !([_player,_token]call EPOCH_server_getPToken)exitWith{};
|
||||
|
||||
if(!isNull _target)then{
|
||||
diag_log format["Epoch: ADMIN: Calling antagonist (%3) trigger from %1 for %2.", getPlayerUID _player, _target, _antagonistClass];
|
||||
|
||||
[_antagonistClass, _target, _doVariable] remoteExec ["EPOCH_unitSpawn",_target];
|
||||
//if(!isNull _player)then{hideObjectGlobal _player;};//Do elsewhere, allow revival
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Trigger antagonists
|
||||
|
||||
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_antagonists/EPOCH_server_triggerEvent.sqf
|
||||
*/
|
||||
params [["_target",objNull,[objNull]], ["_type","",[""]]];
|
||||
if (!isNull _target) then {
|
||||
switch (_type) do {
|
||||
case "UAV": {
|
||||
"I_UAV_01_F" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
case "Cloak": {
|
||||
if (sunOrMoon < 1) then {
|
||||
"Epoch_Cloak_F" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
} else {
|
||||
"Epoch_Sapper_F" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
};
|
||||
case "Sapper": {
|
||||
"Epoch_Sapper_F" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
case "GreatWhite": {
|
||||
"GreatWhite_F" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
case "SapperB": {
|
||||
"Epoch_SapperB_F" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
case "SapperG": {
|
||||
"Epoch_SapperG_F" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
case "PHANTOM": {
|
||||
"PHANTOM" remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
case "Zombie": {
|
||||
["EPOCH_RyanZombie_1",12] remoteExec ['EPOCH_unitSpawnIncrease',_target];
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Building Save function
|
||||
|
||||
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_bases/EPOCH_saveBuilding.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_VAL","_animPhases","_cfgBaseBuilding","_class","_objHiveKey","_objSlot","_return","_worldspace"];
|
||||
//[[[end]]]
|
||||
_return = false;
|
||||
if !(isNull _this) then {
|
||||
_objSlot = _this getVariable["BUILD_SLOT", -1];
|
||||
if (_objSlot != -1) then{
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_this setDamage 0;
|
||||
_class = typeOf _this;
|
||||
_worldspace = [getposworld _this call EPOCH_precisionPos, vectordir _this, vectorup _this, true];
|
||||
_objHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _objSlot];
|
||||
_animPhases = [];
|
||||
{
|
||||
_animPhases pushBack (_this animationPhase _x)
|
||||
} foreach (getArray(_cfgBaseBuilding >> _class >> "persistAnimations"));
|
||||
|
||||
_Textures = [];
|
||||
if (missionnamespace getvariable ["UseCustomTextures",false]) then {
|
||||
_Textures = getObjectTextures _this;
|
||||
};
|
||||
|
||||
_VAL = [_class, _worldspace, _this getVariable["EPOCH_secureStorage", "-1"], _this getVariable["BUILD_OWNER", "-1"], _this getVariable["TEXTURE_SLOT", 0], _animPhases, _Textures];
|
||||
["Building", _objHiveKey, EPOCH_expiresBuilding, _VAL] call EPOCH_fnc_server_hiveSETEX;
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
_return
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Change owner of NPC
|
||||
|
||||
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_bases/EPOCH_server_changeOwner.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_newOwner","_result"];
|
||||
//[[[end]]]
|
||||
params ["_object","_newOwnerObj"];
|
||||
_newOwner = owner _newOwnerObj;
|
||||
_result = false;
|
||||
if (!isNull _object) then {
|
||||
if (local _object) then {
|
||||
if ((owner _object) != _newOwner) then {
|
||||
_result = _object setOwner _newOwner;
|
||||
diag_log format["DEBUG CHANGEOWNER: %1 OWNER: %2 PLAYER: %3 RESULT: %4", _object,owner(_object),_newOwner,_result];
|
||||
};
|
||||
};
|
||||
};
|
||||
_result
|
@ -0,0 +1,231 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors: Skaronator
|
||||
|
||||
Description:
|
||||
Load Buildings from Epoch Hive
|
||||
|
||||
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_bases/EPOCH_server_loadBuildings.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_Simulated","_DamageAllowed","_ExceptedBaseObjects","_IndestructibleBaseObjects","_UseIndestructible","_VAL","_ammoClass","_ammoObj","_anims","_animsData","_arr","_arrCount","_baseObj","_cfgBaseBuilding","_class","_color","_damage","_location","_marker","_maxTTL","_owner","_response","_serverSettingsConfig","_storageSlot","_textureSlot","_ttl","_vehHiveKey","_worldspace"];
|
||||
//[[[end]]]
|
||||
EPOCH_BaseCams = [];
|
||||
EPOCH_Plotpoles = [];
|
||||
_maxTTL = parseNumber EPOCH_expiresBuilding;
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_baseDynamicSimulationSystem = [_serverSettingsConfig, "baseDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry;
|
||||
_UseIndestructible = [_serverSettingsConfig, "UseIndestructible", false] call EPOCH_fnc_returnConfigEntry;
|
||||
_IndestructibleBaseObjects = [_serverSettingsConfig, "IndestructibleBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_UseDeSimulateObjects = [_serverSettingsConfig, "UseDeSimulateObjects", true] call EPOCH_fnc_returnConfigEntry;
|
||||
_DeSimulateObjects = [_serverSettingsConfig, "DeSimulateObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_ExceptedDeSymObjects = [_serverSettingsConfig, "ExceptedDeSymObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_DisableDoorsOnObj = [_serverSettingsConfig, "DisableDoorsOnObj", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
|
||||
_VAL = ["", [], "", "", 0, []];
|
||||
|
||||
for "_i" from 0 to _this do {
|
||||
_vehHiveKey = format ["%1:%2", (call EPOCH_fn_InstanceID),_i];
|
||||
_response = ["Building", _vehHiveKey] call EPOCH_fnc_server_hiveGETTTL;
|
||||
_Simulated = true;
|
||||
_DamageAllowed = true;
|
||||
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType [] && !((_response select 1) isEqualTo [])) then {
|
||||
_arr = _response select 1;
|
||||
_ttl = _response select 2;
|
||||
|
||||
// DEBUG to see if this command works
|
||||
if !(_arr isEqualTypeParams _VAL) then {
|
||||
diag_log format["DEBUG: Data does not match schema: %1 vs %2",_arr,_VAL];
|
||||
};
|
||||
|
||||
_arrCount = count _arr;
|
||||
|
||||
_class = _arr select 0;
|
||||
_worldspace = _arr select 1;
|
||||
|
||||
_storageSlot = "-1";
|
||||
if (_arrCount >= 3) then {
|
||||
if ((_arr select 2) isEqualType 0) then {
|
||||
_storageSlot = str(_arr select 2);
|
||||
} else {
|
||||
_storageSlot = _arr select 2;
|
||||
};
|
||||
// diag_log format ["DEBUG _class: %1 _worldspace: %2 _storageSlot: %3", _class, _worldspace, _storageSlot];
|
||||
};
|
||||
|
||||
_owner = "-1";
|
||||
if (_arrCount >= 4) then {
|
||||
_owner = _arr select 3;
|
||||
};
|
||||
|
||||
// load texture index
|
||||
_textureSlot = 0;
|
||||
if (_arrCount >= 5) then {
|
||||
_textureSlot = _arr select 4;
|
||||
};
|
||||
|
||||
// experiment with damage factor based on time only for now.
|
||||
_damage = ((1 - (_ttl / _maxTTL)) min 1) max 0;
|
||||
|
||||
_worldspace params ["_pos","_vectordir","_vectorup",["_useworld",false]];
|
||||
_vectordirup = [_vectordir,_vectorup];
|
||||
|
||||
// increased position precision
|
||||
if (count _pos == 2) then{
|
||||
_pos = (_pos select 0) vectorAdd (_pos select 1);
|
||||
};
|
||||
|
||||
// remove old safes on && !(_class isKindOf 'Constructions_lockedstatic_F')
|
||||
if (isClass (configFile >> "CfgVehicles" >> _class) && (_damage < 1) && !(_class isKindOf 'Constructions_lockedstatic_F')) then {
|
||||
|
||||
_baseObj = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
{
|
||||
_x params ["_ClassX",["_VarsX",[]]];
|
||||
if ((tolower _class) isequalto (tolower _ClassX)) exitwith {
|
||||
{
|
||||
_x params ["_VarNameX","_ValueX"];
|
||||
_baseObj setvariable [_VarNameX,_ValueX,true];
|
||||
} foreach _VarsX;
|
||||
};
|
||||
} foreach _DisableDoorsOnObj;
|
||||
if (_UseIndestructible) then {
|
||||
if ({_class iskindof _x} count _ExceptedBaseObjects == 0) then {
|
||||
{
|
||||
if (_class iskindof _x) exitwith {
|
||||
_baseObj allowdamage false;
|
||||
_DamageAllowed = false;
|
||||
};
|
||||
} foreach _IndestructibleBaseObjects;
|
||||
};
|
||||
};
|
||||
if (_UseDeSimulateObjects) then {
|
||||
if ({_class iskindof _x} count _ExceptedDeSymObjects == 0) then {
|
||||
{
|
||||
if (_class iskindof _x) exitwith {
|
||||
_baseObj enablesimulationglobal false;
|
||||
_Simulated = false;
|
||||
};
|
||||
} foreach _DeSimulateObjects;
|
||||
};
|
||||
};
|
||||
if (_useworld) then {
|
||||
_baseObj setposworld _pos;
|
||||
}
|
||||
else {
|
||||
_baseObj setposATL _pos;
|
||||
};
|
||||
_baseObj setVectorDirAndUp _vectordirup;
|
||||
|
||||
if (_Simulated && _baseDynamicSimulationSystem) then { // Only needed, if simulation is not disabled
|
||||
// new Dynamicsimulation
|
||||
_baseObj enableSimulationGlobal false; // turn off sim on server start, let dynSim activate it to true
|
||||
_baseObj enableDynamicSimulation true;
|
||||
_baseObj triggerDynamicSimulation false; // this object doesnt need to turn anything on in the server
|
||||
};
|
||||
|
||||
// spawn additional object for trap
|
||||
_ammoClass = (_cfgBaseBuilding >> _class >> "ammoClass");
|
||||
if(isText _ammoClass) then {
|
||||
_ammoClass = getText _ammoClass;
|
||||
_ammoObj = createVehicle [_ammoClass, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
if (_useworld) then {
|
||||
_ammoObj setposworld _pos;
|
||||
}
|
||||
else {
|
||||
_ammoObj setposATL _pos;
|
||||
};
|
||||
_ammoObj setVectorDirAndUp _vectordirup;
|
||||
_baseObj setVariable ["EPOCH_TRAP_OBJ",_ammoObj];
|
||||
_baseObj addEventHandler ["Explosion", {(_this select 0) setDamage 1}];
|
||||
};
|
||||
|
||||
// set persistent Animations
|
||||
if (_arrCount >= 6) then {
|
||||
_anims = [];
|
||||
_animsData = _arr select 5;
|
||||
// check that we have an array to prevent any errors
|
||||
if (_animsData isEqualType _anims) then {
|
||||
_anims = _animsData;
|
||||
};
|
||||
|
||||
{
|
||||
_baseObj animate [_x, _anims param [_forEachIndex,0], true]
|
||||
} foreach(getArray(_cfgBaseBuilding >> _class >> "persistAnimations"));
|
||||
};
|
||||
|
||||
// Handle Jammers and create marker if EPOCH_SHOW_JAMMERS set true.
|
||||
if (_class in ((call EPOCH_JammerClasses) + ["BaseCam_EPOCH"])) then {
|
||||
if (_owner != "-1") then {
|
||||
_baseObj setVariable ["BUILD_OWNER", _owner, true];
|
||||
};
|
||||
|
||||
// add BaseCam to public array
|
||||
if (_class isequalto "BaseCam_EPOCH") then {
|
||||
EPOCH_BaseCams pushBackUnique _baseObj;
|
||||
// Set PubVar later after all Cams are loaded in
|
||||
};
|
||||
|
||||
if (_class in (call EPOCH_JammerClasses)) then {
|
||||
EPOCH_Plotpoles pushbackunique _baseObj;
|
||||
if (EPOCH_SHOW_JAMMERS) then {
|
||||
_marker = createMarker [str(_pos), _pos];
|
||||
_marker setMarkerShape "ICON";
|
||||
// TODO allow players to change this per base
|
||||
_marker setMarkerType "mil_dot";
|
||||
// _marker setMarkerText _class;
|
||||
_marker setMarkerColor "ColorBlue";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_baseObj setDamage _damage;
|
||||
if (_DamageAllowed) then { // Only needed, if damage is allowed
|
||||
_baseObj call EPOCH_server_buildingInit;
|
||||
};
|
||||
_baseObj setVariable ["BUILD_SLOT", _i, true];
|
||||
|
||||
if (_arrCount >= 7 && (missionnamespace getvariable ["UseCustomTextures",false])) then {
|
||||
_Textures = _arr select 6;
|
||||
{
|
||||
_baseObj setobjecttextureglobal [_foreachindex,_x];
|
||||
} foreach _Textures;
|
||||
}
|
||||
else {
|
||||
if (_textureSlot != 0) then {
|
||||
// get texture path from index
|
||||
_color = getArray (_cfgBaseBuilding >> _class >> "availableTextures");
|
||||
if !(_color isEqualTo []) then {
|
||||
_baseObj setObjectTextureGlobal [0, (_color select _textureSlot)];
|
||||
_baseObj setVariable ["TEXTURE_SLOT", _textureSlot, true];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
EPOCH_BuildingSlots set [_i,1];
|
||||
if (EPOCH_DEBUG_VEH) then {
|
||||
_marker = createMarker [str(_pos) , _pos];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _class;
|
||||
_marker setMarkerColor "ColorRed";
|
||||
};
|
||||
} else { //Need Hivecall to delete the object out of the DB!
|
||||
EPOCH_BuildingSlots set [_i,0];
|
||||
};
|
||||
}
|
||||
else {
|
||||
EPOCH_BuildingSlots set [_i,0];
|
||||
};
|
||||
};
|
||||
publicvariable "EPOCH_BaseCams";
|
||||
publicvariable "EPOCH_Plotpoles";
|
||||
missionNamespace setVariable ["EPOCH_BuildingSlotCount", {_x == 0} count EPOCH_BuildingSlots, true];
|
||||
true
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors: Skaronator
|
||||
|
||||
Description:
|
||||
Building Maintain
|
||||
|
||||
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_bases/EPOCH_server_maintBUILD.sqf
|
||||
|
||||
Example:
|
||||
// Client RE
|
||||
[_this, player, _maintainCount, Epoch_personalToken] remoteExec ["EPOCH_server_maintBUILD",2];
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJECT - Jammer object
|
||||
_this select 1: STRING - Player Object
|
||||
_this select 2: STRING - Maintain count
|
||||
_this select 3: STRING - Epoch Personal Token
|
||||
|
||||
Returns:
|
||||
NOTHING
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cIndex","_counter","_current_crypto","_objSlot","_playerCryptoLimit","_playerUID","_storSlot","_vars"];
|
||||
//[[[end]]]
|
||||
params [["_object",objNull],"_player","_maintCount",["_token","",[""]] ];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _object) exitWith{};
|
||||
if (_player distance _object > 20) exitWith{};
|
||||
|
||||
_playerUID = getPlayerUID _player;
|
||||
_counter = 0;
|
||||
|
||||
if (typeOf _object in (call EPOCH_JammerClasses)) then {
|
||||
|
||||
_objSlot = _object getVariable["BUILD_SLOT", -1];
|
||||
if (_objSlot != -1) then {
|
||||
|
||||
// get vars array and current Crypto value
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
|
||||
if (_current_crypto >= _maintCount) then {
|
||||
|
||||
// maintain jammer
|
||||
_counter = _counter + 1;
|
||||
EPOCH_saveBuildQueue pushBackUnique _object;
|
||||
|
||||
if (_maintCount > 0) then {
|
||||
|
||||
// maintain all objects within range
|
||||
{
|
||||
_storSlot = _x getVariable["STORAGE_SLOT", "ABORT"];
|
||||
if (_storSlot != "ABORT") then {
|
||||
if ((damage _x) > 0) then {
|
||||
_counter = _counter + 1;
|
||||
EPOCH_saveStorQueue pushBackUnique _x;
|
||||
};
|
||||
};
|
||||
_objSlot = _x getVariable["BUILD_SLOT", -1];
|
||||
if (_objSlot != -1) then{
|
||||
if ((damage _x) > 0) then {
|
||||
_counter = _counter + 1;
|
||||
EPOCH_saveBuildQueue pushBackUnique _x;
|
||||
};
|
||||
};
|
||||
if (_counter > _maintCount) exitWith{};
|
||||
} forEach nearestObjects[_object, ["Constructions_static_F","Constructions_foundation_F","Buildable_Storage","Constructions_lockedstatic_F"], call EPOCH_MaxJammerRange];
|
||||
|
||||
// effect crypto
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
_current_crypto = ((_current_crypto - _counter) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable["VARS", _vars];
|
||||
|
||||
};
|
||||
diag_log format["Epoch: ADMIN: %1 maintained %2 base objects at %3", _playerUID, _counter, getPosATL _object];
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Building Paint handler
|
||||
|
||||
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_bases/EPOCH_server_paintBUILD.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_class","_color","_currentTextureSlot","_objSlot","_playerUID"];
|
||||
//[[[end]]]
|
||||
params [["_object",objNull],"_textureSlot","_player",["_token","",[""]] ];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _object) exitWith{};
|
||||
if (_player distance _object > 20) exitWith{};
|
||||
|
||||
_playerUID = getPlayerUID _player;
|
||||
|
||||
_objSlot = _object getVariable["BUILD_SLOT", -1];
|
||||
if (_objSlot != -1) then {
|
||||
|
||||
_currentTextureSlot = _object getVariable["TEXTURE_SLOT", 0];
|
||||
if (_textureSlot != _currentTextureSlot) then {
|
||||
|
||||
_class = typeOf _object;
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_color = getArray(_cfgBaseBuilding >> _class >> "availableTextures");
|
||||
if !(_color isEqualTo[]) then {
|
||||
_object setObjectTextureGlobal[0, (_color select _textureSlot)];
|
||||
_object setVariable["TEXTURE_SLOT", _textureSlot, true];
|
||||
_object call EPOCH_saveBuilding;
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,185 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Remove 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_server/compile/epoch_bases/EPOCH_server_removeBUILD.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_ammoObj","_arrCount","_attachments","_cfgBaseBuilding","_gwh","_inventory","_isTemporary","_magazineName","_magazineSize","_magsAmmoCargo","_nearbyWH","_objQty","_objType","_objTypes","_posWH","_qty","_removeParts","_storageSlot","_vehSlot","_wMags","_wMagsArray","_wepsItemsCargo"];
|
||||
//[[[end]]]
|
||||
params ["_building","_player",["_token","",[""]] ];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _building) exitWith{};
|
||||
if (_player distance _building > 20) exitWith{};
|
||||
if (_building getvariable ['Build_LockedForRemoving',false]) exitwith {};
|
||||
_building setvariable ['Build_LockedForRemoving',true];
|
||||
|
||||
// TODO add group check here since this should only be removed by group or owner of pole
|
||||
_objType = typeOf _building;
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_isTemporary = getNumber(_cfgBaseBuilding >> _objType >> "isTemporary");
|
||||
|
||||
// check that object has building or storage slot
|
||||
_vehSlot = _building getVariable["BUILD_SLOT", -1];
|
||||
_storageSlot = _building getVariable["STORAGE_SLOT", "ABORT"];
|
||||
|
||||
if (_vehSlot != -1 || _storageSlot != "ABORT" || _isTemporary == 1) then{
|
||||
|
||||
_removeParts = getArray(_cfgBaseBuilding >> _objType >> "removeParts");
|
||||
if !(_removeParts isEqualTo []) then {
|
||||
|
||||
_posWH = getPosATL _player;
|
||||
_gwh = objNull;
|
||||
// give player a refund of parts
|
||||
_nearbyWH = nearestObjects[_posWH, ["groundWeaponHolder"], 2];
|
||||
if !(_nearbyWH isEqualTo[]) then{
|
||||
_gwh = _nearbyWH select 0;
|
||||
// _posWH = getPosATL _gwh;
|
||||
} else {
|
||||
_gwh = createVehicle["groundWeaponHolder", [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
_gwh setPosATL _posWH;
|
||||
};
|
||||
|
||||
if !(isNull _gwh) then{
|
||||
|
||||
// if normal storage device dump items on ground.
|
||||
if (_building isKindOf "Buildable_Storage") then {
|
||||
|
||||
// may not be needed but should prevent <null> in DB.
|
||||
_wepsItemsCargo = weaponsItemsCargo _building;
|
||||
if (isNil "_wepsItemsCargo") then{
|
||||
_wepsItemsCargo = [];
|
||||
};
|
||||
_magsAmmoCargo = magazinesAmmoCargo _building;
|
||||
if (isNil "_magsAmmoCargo") then{
|
||||
_magsAmmoCargo = [];
|
||||
};
|
||||
|
||||
// dump items on ground
|
||||
_inventory = [
|
||||
_wepsItemsCargo,
|
||||
_magsAmmoCargo,
|
||||
getBackpackCargo _building,
|
||||
getItemCargo _building
|
||||
];
|
||||
|
||||
[_building, _player] call EPOCH_server_save_killedStorage;
|
||||
deleteVehicle _building;
|
||||
|
||||
{
|
||||
_objType = _forEachIndex;
|
||||
|
||||
_objTypes = _x;
|
||||
_objQty = [];
|
||||
|
||||
if (_objType in[2, 3]) then{
|
||||
_objTypes = _x select 0;
|
||||
_objQty = _x select 1;
|
||||
};
|
||||
|
||||
{
|
||||
switch _objType do {
|
||||
case 0: {
|
||||
if (_x isEqualType []) then{
|
||||
_arrCount = count _x;
|
||||
if (_arrCount >= 4) then{
|
||||
|
||||
_gwh addWeaponCargoGlobal[_x deleteAt 0, 1];
|
||||
|
||||
_attachments = [];
|
||||
_wMags = false;
|
||||
_wMagsArray = [];
|
||||
// suppressor, laser, optics, magazines(array), bipods
|
||||
{
|
||||
// magazines
|
||||
if (_x isEqualType []) then{
|
||||
_wMags = true;
|
||||
_wMagsArray = _x;
|
||||
}
|
||||
else {
|
||||
// attachments
|
||||
if (_x != "") then{
|
||||
_attachments pushBack _x;
|
||||
};
|
||||
};
|
||||
} forEach _x;
|
||||
|
||||
// add all attachments to vehicle
|
||||
// TODO replace with adding attachments directly to gun (Arma feature dependant)
|
||||
{
|
||||
_gwh addItemCargoGlobal[_x, 1];
|
||||
} forEach _attachments;
|
||||
|
||||
if (_wMags) then{
|
||||
if (_wMagsArray isEqualType [] && (count _wMagsArray) >= 2) then{
|
||||
_gwh addMagazineAmmoCargo[_wMagsArray select 0, 1, _wMagsArray select 1];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (_x isEqualType []) then{
|
||||
if ((count _x) == 2) then{
|
||||
_magazineName = _x select 0;
|
||||
_magazineSize = _x select 1;
|
||||
|
||||
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then{
|
||||
_gwh addMagazineAmmoCargo[_magazineName, 1, _magazineSize];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
case 2: {
|
||||
if (_x isEqualType "STRING") then{
|
||||
_qty = _objQty select _forEachIndex;
|
||||
_gwh addBackpackCargoGlobal[_x, _qty];
|
||||
};
|
||||
};
|
||||
case 3: {
|
||||
if (_x isEqualType "STRING") then{
|
||||
_qty = _objQty select _forEachIndex;
|
||||
_gwh addItemCargoGlobal[_x, _qty];
|
||||
};
|
||||
};
|
||||
};
|
||||
}forEach _objTypes;
|
||||
}forEach _inventory;
|
||||
|
||||
} else {
|
||||
|
||||
// Remove trap object
|
||||
_ammoObj = _building getVariable ["EPOCH_TRAP_OBJ",objNull];
|
||||
if !(isNull _ammoObj) then {
|
||||
deleteVehicle _ammoObj;
|
||||
};
|
||||
|
||||
[_building, _player] call EPOCH_server_save_killedBuilding;
|
||||
deleteVehicle _building;
|
||||
};
|
||||
// Normal config based payout
|
||||
_nearbyWH = nearestObjects[_posWH, ["groundWeaponHolder"], 2];
|
||||
if !(_nearbyWH isEqualTo[]) then{
|
||||
_gwh = _nearbyWH select 0;
|
||||
// _posWH = getPosATL _gwh;
|
||||
} else {
|
||||
_gwh = createVehicle["groundWeaponHolder", [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
_gwh setPosATL _posWH;
|
||||
};
|
||||
|
||||
{
|
||||
_gwh addMagazineCargoGlobal[_x select 0, _x select 1];
|
||||
} forEach _removeParts;
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,126 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Building Save
|
||||
|
||||
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_bases/EPOCH_server_saveBuilding.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_findnextslot","_newVehicle","_objSlot","_oemType","_playerUID","_serverSettingsConfig","_slot","_staticClass","_staticClassConfig","_storageObj","_vehiclePos"];
|
||||
//[[[end]]]
|
||||
params ["_vehicle", "_player", ["_token","",[""]] ];
|
||||
|
||||
if (isNull _vehicle) exitWith{};
|
||||
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
||||
|
||||
_playerUID = getPlayerUID _player;
|
||||
|
||||
if (!isNull ropeAttachedTo _vehicle) exitWith{};
|
||||
|
||||
_oemType = typeOf _vehicle;
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_staticClassConfig = (_cfgBaseBuilding >> _oemType >> "staticClass");
|
||||
if (isText _staticClassConfig) then {
|
||||
|
||||
_staticClass = getText(_staticClassConfig);
|
||||
if (_staticClass isKindOf "Buildable_Storage" || _staticClass isKindOf "Constructions_lockedstatic_F") then{
|
||||
|
||||
if !(EPOCH_StorageSlots isEqualTo[]) then {
|
||||
|
||||
_slot = EPOCH_StorageSlots deleteAt 0;
|
||||
missionNamespace setVariable ["EPOCH_StorageSlotsCount",count EPOCH_StorageSlots, true];
|
||||
|
||||
// Secure and insecure storage
|
||||
_vehiclePos = getposATL _vehicle;
|
||||
|
||||
_storageObj = [_staticClass,_vehicle] call EPOCH_swapBuilding;
|
||||
|
||||
// add new gardens to manager
|
||||
if (_staticClass isEqualTo "Garden_EPOCH") then {
|
||||
EPOCH_activeGardens pushBackUnique _storageObj;
|
||||
};
|
||||
|
||||
if (_staticClass in ["SolarCharger_EPOCH","SolarChargerXL_EPOCH"]) then {
|
||||
EPOCH_activeSolars pushBackUnique _storageObj;
|
||||
};
|
||||
|
||||
if (getNumber(_cfgBaseBuilding >> _staticClass >> "isSecureStorage") == 1) then{
|
||||
_storageObj setVariable["EPOCH_Locked", false, true];
|
||||
if (_storageObj isKindOf "GunSafe_EPOCH") then {
|
||||
{
|
||||
_storageObj animate [_x,1];
|
||||
} foreach ["door1","door2","handle1","handle2"];
|
||||
};
|
||||
};
|
||||
|
||||
_storageObj setVariable["STORAGE_OWNERS", [_playerUID]];
|
||||
|
||||
_storageObj setVariable["STORAGE_SLOT", _slot, true];
|
||||
|
||||
_storageObj call EPOCH_server_save_storage;
|
||||
if (isDamageAllowed _storageObj) then { // Only needed, if damage is allowed
|
||||
_storageObj call EPOCH_server_storageInit;
|
||||
};
|
||||
[_player,"BuildingsSet",1,true] call EPOCH_server_updatePlayerStats;
|
||||
diag_log format["Epoch: STORAGE: %1 created storage %2 at %3 with slot %4", _playerUID, _staticClass, _vehiclePos, _slot];
|
||||
[[_storageObj,[vectordir _storageObj, vectorup _storageObj]]] remoteexec ['Epoch_fnc_SetFinalDir',_player];
|
||||
};
|
||||
|
||||
} else {
|
||||
|
||||
// TODO: optimize by using config var
|
||||
if (_vehicle isKindOf "ThingX" || _vehicle isKindOf "Const_Ghost_EPOCH" || ({_vehicle isKindOf _x} count (call EPOCH_JammerClasses) > 0)) then {
|
||||
|
||||
_objSlot = _vehicle getVariable["BUILD_SLOT", -1];
|
||||
if (_objSlot == -1) then{
|
||||
_findnextslot = EPOCH_BuildingSlots find 0;
|
||||
if (_findnextslot != -1) then{
|
||||
_objSlot = _findnextslot;
|
||||
EPOCH_BuildingSlots set[_findnextslot, 1];
|
||||
_vehicle setVariable["BUILD_SLOT", _findnextslot, true];
|
||||
};
|
||||
};
|
||||
|
||||
missionNamespace setVariable ['EPOCH_BuildingSlotCount', { _x == 0 } count EPOCH_BuildingSlots, true];
|
||||
|
||||
if (_objSlot != -1) then {
|
||||
_newVehicle = [_vehicle, false] call EPOCH_server_simulSwap;
|
||||
|
||||
// add BaseCam to public array
|
||||
if (_newVehicle iskindof "BaseCam_EPOCH") then {
|
||||
_playerGroup = _player getVariable["GROUP", ""];
|
||||
_Owner = _playerUID;
|
||||
if (_playerGroup != "") then {
|
||||
_Owner = _playerGroup;
|
||||
};
|
||||
_newVehicle setVariable["BUILD_OWNER", _Owner, true];
|
||||
EPOCH_BaseCams pushBackUnique _newVehicle;
|
||||
publicvariable "EPOCH_BaseCams";
|
||||
}
|
||||
else {
|
||||
_newVehicle setVariable["BUILD_OWNER", _playerUID, true];
|
||||
};
|
||||
if ({_newVehicle isKindOf _x} count (call EPOCH_JammerClasses) > 0) then {
|
||||
EPOCH_Plotpoles = EPOCH_Plotpoles - [ObjNull];
|
||||
EPOCH_Plotpoles pushBackUnique _newVehicle;
|
||||
publicvariable "EPOCH_Plotpoles";
|
||||
};
|
||||
_newVehicle call EPOCH_saveBuilding;
|
||||
[_player,"BuildingsSet",1,true] call EPOCH_server_updatePlayerStats;
|
||||
[[_newVehicle,[vectordir _newVehicle, vectorup _newVehicle]]] remoteexec ['Epoch_fnc_SetFinalDir',_player];
|
||||
};
|
||||
|
||||
} else {
|
||||
diag_log format["DEBUG BUILD SAVE ABORT TYPE ERROR: %1", _this]
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
true
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Building - Converts to static all simulated objects that have not moved since last check
|
||||
|
||||
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_bases/EPOCH_server_simToStatic.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_class","_currentPosition","_entities","_lastPosition","_newObj","_objSlot","_staticClassConfig"];
|
||||
//[[[end]]]
|
||||
_entities = allMissionObjects "Constructions_modular_F";
|
||||
{
|
||||
_lastPosition = _x getVariable["LAST_POS", []];
|
||||
_currentPosition = getposATL _x;
|
||||
if (_lastPosition isEqualTo _currentPosition) then {
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_staticClassConfig = (_cfgBaseBuilding >> (typeOf _x) >> "staticClass");
|
||||
if (isText(_staticClassConfig)) then {
|
||||
_class = getText(_staticClassConfig);
|
||||
_objSlot = _x getVariable["BUILD_SLOT", -1];
|
||||
if (_objSlot != -1) then {
|
||||
_newObj = [_class,_x] call EPOCH_swapBuilding;
|
||||
_newObj setVariable ["BUILD_SLOT",_objSlot,true];
|
||||
_newObj call EPOCH_server_buildingInit;
|
||||
};
|
||||
};
|
||||
};
|
||||
_x setVariable ["LAST_POS",_currentPosition];
|
||||
uiSleep 1;
|
||||
} forEach _entities;
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Building - Sim to Static
|
||||
|
||||
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_bases/EPOCH_server_simulSwap.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_ammoClass","_ammoObj","_cfgBaseBuilding","_cfgClass","_class","_classConfig","_color","_damage","_newObj","_objSlot","_oemType","_return","_textureSlot","_worldspace"];
|
||||
//[[[end]]]
|
||||
params [["_object",objNull,[objNull]],["_static",false,[false]] ];
|
||||
_return = _object;
|
||||
_objSlot = _object getVariable ["BUILD_SLOT", -1];
|
||||
if (_objSlot != -1) then {
|
||||
|
||||
_cfgClass = "staticClass";
|
||||
if (_static) then {
|
||||
_cfgClass = "simulClass";
|
||||
};
|
||||
_oemType = typeOf _object;
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_classConfig = (_cfgBaseBuilding >> _oemType >> _cfgClass);
|
||||
if (isText _classConfig) then {
|
||||
_class = getText(_classConfig);
|
||||
|
||||
if (_oemType != _class) then {
|
||||
|
||||
_textureSlot = _object getVariable["TEXTURE_SLOT", 0];
|
||||
_damage = damage _object;
|
||||
|
||||
_newObj = [_class,_object] call EPOCH_swapBuilding;
|
||||
|
||||
_newObj setVariable ["BUILD_SLOT",_objSlot,true];
|
||||
if (isDamageAllowed _newObj) then { // Only needed, if damage is allowed
|
||||
_newObj call EPOCH_server_buildingInit;
|
||||
};
|
||||
|
||||
if (_textureSlot != 0) then {
|
||||
// get texture path from index
|
||||
_color = getArray(_cfgBaseBuilding >> _class >> "availableTextures");
|
||||
if !(_color isEqualTo[]) then {
|
||||
_newObj setObjectTextureGlobal[0, (_color select _textureSlot)];
|
||||
_newObj setVariable["TEXTURE_SLOT", _textureSlot, true];
|
||||
};
|
||||
};
|
||||
|
||||
// spawn additional object for trap
|
||||
_ammoClass = (_cfgBaseBuilding >> _class >> "ammoClass");
|
||||
if (isText _ammoClass) then {
|
||||
_ammoClass = getText _ammoClass;
|
||||
_ammoObj = createVehicle [_ammoClass, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
_ammoObj attachTo [_newObj,[0,0,0]];
|
||||
_newObj setVariable ["EPOCH_TRAP_OBJ",_ammoObj];
|
||||
_newObj addEventHandler ["Explosion", {(_this select 0) setDamage 1}];
|
||||
};
|
||||
|
||||
_newObj setDamage _damage;
|
||||
_return = _newObj;
|
||||
};
|
||||
};
|
||||
};
|
||||
_return
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Building - Unsupported building check (unused ATM)
|
||||
|
||||
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_bases/EPOCH_server_unsuppported.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_class","_isSupported","_newObj","_objSlot","_objectPos","_playerUID","_simulClassConfig","_simulatedCount","_slot","_stableCount","_start"];
|
||||
//[[[end]]]
|
||||
|
||||
if !(isNil "EPOCH_unsupportedCheckRunning") exitWith{ diag_log "UnsupportedCheck: Already running aborted"};
|
||||
EPOCH_unsupportedCheckRunning = true;
|
||||
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
|
||||
// Check unsupported
|
||||
_start = diag_tickTime;
|
||||
_simulatedCount = 0;
|
||||
_stableCount = 0;
|
||||
{
|
||||
if (!isNull _x) then {
|
||||
_simulClassConfig = (_cfgBaseBuilding >> (typeOf _x) >> "simulClass");
|
||||
if (isText(_simulClassConfig)) then {
|
||||
_objectPos = getPosASL _x;
|
||||
_isSupported = isTouchingGround _x;
|
||||
if (!_isSupported) then {
|
||||
_isSupported = if (terrainIntersectASL[_objectPos, [_objectPos select 0, _objectPos select 1, (_objectPos select 2) - 1]]) then { true } else {
|
||||
lineIntersects[_objectPos, [_objectPos select 0, _objectPos select 1, (_objectPos select 2) - 5], _x, objNull]
|
||||
};
|
||||
};
|
||||
if (!_isSupported) then {
|
||||
_class = getText(_simulClassConfig);
|
||||
_objSlot = _x getVariable["BUILD_SLOT", -1];
|
||||
if (_objSlot != -1) then {
|
||||
_playerUID = _x getVariable["BUILD_OWNER", "-1"];
|
||||
_slot = _x getVariable["EPOCH_secureStorage", "-1"];
|
||||
// _newObj = createVehicle[_class, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
_newObj = [_class,_x] call EPOCH_swapBuilding;
|
||||
_newObj setVariable["BUILD_SLOT", _objSlot, true];
|
||||
_newObj setVariable["BUILD_OWNER", _playerUID, true];
|
||||
_newObj setVariable["EPOCH_secureStorage", _slot];
|
||||
_newObj setVelocity[0, 0, -1];
|
||||
_simulatedCount = _simulatedCount + 1;
|
||||
uiSleep 1;
|
||||
};
|
||||
} else {
|
||||
_stableCount = _stableCount + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach(allMissionObjects "Constructions_static_F");
|
||||
diag_log format["Epoch: Speed %1 Count %2 Stable %3", (diag_tickTime - _start), _simulatedCount, _stableCount];
|
||||
EPOCH_unsupportedCheckRunning = nil;
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Building Upgrades
|
||||
|
||||
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_bases/EPOCH_server_upgradeBUILD.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_class","_newObj","_objSlot","_objType","_upgrade","_upgrades","_Skip"];
|
||||
//[[[end]]]
|
||||
params ["_object","_player",["_index",0],["_token","",[""]],["_CryptoCosts",0]];
|
||||
|
||||
if (isNull _object) exitWith{};
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_Skip = false;
|
||||
if (_CryptoCosts > 0) then {
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
if (_current_crypto < _CryptoCosts) Exitwith {
|
||||
_Skip = true;
|
||||
};
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
_current_crypto = ((_current_crypto - _CryptoCosts) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable["VARS", _vars];
|
||||
};
|
||||
if (_Skip) exitwith {};
|
||||
|
||||
_objSlot = _object getVariable["BUILD_SLOT", -1];
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
if (_objSlot != -1) then {
|
||||
_upgrades = getArray(_cfgBaseBuilding >> (typeOf _object) >> "upgradeBuilding");
|
||||
if !(_upgrades isEqualTo []) then {
|
||||
_upgrade = _upgrades param [_index,[]];
|
||||
_class = _upgrade select 0;
|
||||
_newObj = [_class,_object] call EPOCH_swapBuilding;
|
||||
_newObj setVariable ["BUILD_SLOT",_objSlot,true];
|
||||
if (isDamageAllowed _newObj) then { // Only needed, if damage is allowed
|
||||
_newObj call EPOCH_server_buildingInit;
|
||||
};
|
||||
_newObj call EPOCH_saveBuilding;
|
||||
};
|
||||
} else {
|
||||
_objType = typeOf _object;
|
||||
if (getNumber(_cfgBaseBuilding >> _objType >> "isTemporary") == 1) then{
|
||||
_upgrades = getArray(_cfgBaseBuilding >> (typeOf _object) >> "upgradeBuilding");
|
||||
if !(_upgrades isEqualTo []) then {
|
||||
_upgrade = _upgrades param [_index,[]];
|
||||
_class = _upgrade select 0;
|
||||
_newObj = [_class,_object] call EPOCH_swapBuilding;
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,78 @@
|
||||
// _newObj = [_class,_object] call EPOCH_swapBuilding;
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_newObj","_objectPos","_owner","_UpdatePlots"];
|
||||
//[[[end]]]
|
||||
params [["_class",""],["_object",objNull],["_method",0]];
|
||||
_newObj = objNull;
|
||||
if (!isNull _object && !(_class isEqualTo "")) then {
|
||||
_objectPos = getPosWorld _object;
|
||||
_newObj = createVehicle [_class, ASLtoAGL _objectPos, [], 0, "CAN_COLLIDE"];
|
||||
if (!isNull _newObj) then {
|
||||
_owner = _object getvariable ["Build_Owner",""];
|
||||
if !(_owner isEqualTo "") then {
|
||||
_newObj setVariable ["BUILD_OWNER", _owner, true];
|
||||
};
|
||||
_UpdatePlots = false;
|
||||
if (_object in EPOCH_Plotpoles) then {
|
||||
EPOCH_Plotpoles = EPOCH_Plotpoles - [_object];
|
||||
_UpdatePlots = true;
|
||||
};
|
||||
if (_class in (call EPOCH_JammerClasses)) then {
|
||||
EPOCH_Plotpoles pushback _newObj;
|
||||
_UpdatePlots = true;
|
||||
};
|
||||
if (_UpdatePlots) then {
|
||||
publicvariable 'EPOCH_Plotpoles';
|
||||
};
|
||||
_object hideObjectGlobal true;
|
||||
switch (_method) do {
|
||||
case 0: {
|
||||
_newObj setposATL (getPosATL _object);
|
||||
_newObj setDir (getDir _object);
|
||||
_newObj setVectorDirAndUp [vectorDir _object, vectorUP _object];
|
||||
};
|
||||
case 1: {
|
||||
_newObj attachTo [_object,[0,0,0]];
|
||||
detach _newObj;
|
||||
};
|
||||
case 2: {
|
||||
_newObj setDir (getDir _object);
|
||||
_newObj setPosWorld (getPosWorld _object);
|
||||
_newObj setVectorUp (vectorup _object);
|
||||
_newObj setVectorDir (vectorDir _object);
|
||||
};
|
||||
};
|
||||
deleteVehicle _object;
|
||||
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_UseIndestructible = [_serverSettingsConfig, "UseIndestructible", false] call EPOCH_fnc_returnConfigEntry;
|
||||
_IndestructibleBaseObjects = [_serverSettingsConfig, "IndestructibleBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_DisableDoorsOnObj = [_serverSettingsConfig, "DisableDoorsOnObj", []] call EPOCH_fnc_returnConfigEntry;
|
||||
{
|
||||
_x params ["_ClassX",["_VarsX",[]]];
|
||||
if ((tolower _class) isequalto (tolower _ClassX)) exitwith {
|
||||
{
|
||||
_x params ["_VarNameX","_ValueX"];
|
||||
_newObj setvariable [_VarNameX,_ValueX,true];
|
||||
} foreach _VarsX;
|
||||
};
|
||||
} foreach _DisableDoorsOnObj;
|
||||
if (_UseIndestructible) then {
|
||||
if ({_class iskindof _x} count _ExceptedBaseObjects == 0) then {
|
||||
{
|
||||
if (_class iskindof _x) exitwith {
|
||||
_newObj allowdamage false;
|
||||
};
|
||||
} foreach _IndestructibleBaseObjects;
|
||||
};
|
||||
};
|
||||
// new Dynamicsimulation
|
||||
if([configFile >> "CfgEpochServer", "baseDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then
|
||||
{
|
||||
_newObj enableDynamicSimulation true;
|
||||
_newObj triggerDynamicSimulation false; // this object doesnt need to turn anything on in the server
|
||||
};
|
||||
};
|
||||
};
|
||||
_newObj
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Add HiveFunction: Create Group / Set Data
|
||||
|
||||
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_group/EPOCH_server_createGroup.sqf
|
||||
|
||||
Return:
|
||||
|
||||
true = group has been created and / or successfully saved!
|
||||
false = group exist already and hasn't been saved!
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cIndex","_contentArray","_current_crypto","_groupID","_groupName","_leaderName","_playerCryptoLimit","_return","_textArr","_upgradePrice","_vars"];
|
||||
//[[[end]]]
|
||||
params ["_leader", "_groupName", ["_token","",[""]] ];
|
||||
if !([_leader, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_return = false;
|
||||
_textArr = toArray(_groupName);
|
||||
|
||||
if (count _textArr > 24) exitWith{};
|
||||
// remove any disallowed chars in group name "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -_"
|
||||
{
|
||||
if !(_x in [97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,49,50,51,52,53,54,55,56,57,48,32,45,95]) then {
|
||||
_textArr = _textArr - [_x];
|
||||
};
|
||||
} forEach _textArr;
|
||||
_groupName = toString _textArr;
|
||||
|
||||
// get vars array and current Crypto value
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _leader getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
|
||||
_upgradePrice = parseNumber (EPOCH_group_upgrade_lvl_SEPXVar select 1);
|
||||
|
||||
if (_current_crypto >= _upgradePrice) then {
|
||||
if (_groupName != "") then {
|
||||
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
_current_crypto = ((_current_crypto - _upgradePrice) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_leader setVariable["VARS", _vars];
|
||||
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_leader];
|
||||
|
||||
_groupID = getPlayerUID _leader;
|
||||
|
||||
_leaderName = if (alive _leader) then {name _leader} else {"Dead Player"};
|
||||
|
||||
_contentArray = [_groupName, _leaderName, EPOCH_group_upgrade_lvl_SEPXVar select 0, [], []];
|
||||
|
||||
[["groupUpdate", _contentArray], _leader] call EPOCH_sendRemoteExecClient;
|
||||
[["groupUidUpdate", _groupID], _leader] call EPOCH_sendRemoteExecClient;
|
||||
|
||||
_leader setVariable ["GROUP", _groupID];
|
||||
|
||||
// Save Group Data
|
||||
["Group", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET;
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
_return
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Delete Group
|
||||
|
||||
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_group/EPOCH_server_deleteGroup.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_groupID","_return"];
|
||||
//[[[end]]]
|
||||
params ["_player",["_token","",[""]] ];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_return = false;
|
||||
_groupID = getPlayerUID _player;
|
||||
if (_groupID != "") then {
|
||||
|
||||
{
|
||||
_x setVariable ["GROUP", nil];
|
||||
[["resetGroup", true], _x] call EPOCH_sendRemoteExecClient;
|
||||
[_x] joinSilent (createGroup [west, true]);
|
||||
} forEach (allPlayers select {(_x getVariable["GROUP", ""]) == _groupID});
|
||||
|
||||
_return = ["Group", _groupID] call EPOCH_fnc_server_hiveDEL;
|
||||
[["groupUpdate", []], _player] call EPOCH_sendRemoteExecClient;
|
||||
};
|
||||
_return
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Invite Player
|
||||
|
||||
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_group/EPOCH_server_invitePlayer.sqf
|
||||
*/
|
||||
params ["_playerUID","_var1","_var2","_player",["_token","",[""]]];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
private _targets = allPlayers select {getPlayerUID _x == _playerUID};
|
||||
if !(_targets isEqualTo []) then {
|
||||
[_var1, _var2] remoteExec ['EPOCH_Group_invitePlayer',_targets];
|
||||
};
|
@ -0,0 +1,122 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Add or remove members from a group
|
||||
|
||||
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_group/EPOCH_server_updatePlayerGroup.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_allPlayers","_contentArray","_found","_group","_memberrange","_modOrMember","_modOrMemberArray","_modOrMemberRevert","_removePlayerArray","_response","_selectedPlayerName"];
|
||||
//[[[end]]]
|
||||
params [["_groupID",""],["_selectedPlayerUID",""],["_addOrRemove",false],["_modOrMemberVar",true],["_player",objnull],["_token",""]];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith {};
|
||||
|
||||
if (_groupID == "") exitWith{ diag_log format["Epoch: GROUP: No Group Selected %1", _this]; };
|
||||
|
||||
diag_log format["Epoch: GROUP: Update %1", _this];
|
||||
|
||||
_modOrMember = if (_modOrMemberVar) then [{3},{4}];
|
||||
_modOrMemberRevert = if (_modOrMemberVar) then [{4},{3}];
|
||||
|
||||
_response = ["Group", _groupID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_contentArray = _response select 1;
|
||||
_contentArray params ["_groupName","_leaderName","_groupSize","_modArray","_memberArray"];
|
||||
_allPlayers = allPlayers select {alive _x};
|
||||
|
||||
if (_addOrRemove) then { //Add
|
||||
_selectedPlayerName = "Dead Player";
|
||||
|
||||
{
|
||||
_selectedPlayerName = if (alive _x) then {name _x};
|
||||
if ((_x getVariable ["GROUP",""]) != _groupID) then {
|
||||
_group = grpNull;
|
||||
{
|
||||
if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
|
||||
_group = group _x;
|
||||
};
|
||||
} forEach _allPlayers;
|
||||
|
||||
if (isNull _group) then {
|
||||
_group = createGroup [west, true];
|
||||
};
|
||||
_x setVariable ["GROUP", _groupID];
|
||||
[["groupUidUpdate", _groupID], _x] call EPOCH_sendRemoteExecClient;
|
||||
[_x] joinSilent _group;
|
||||
};
|
||||
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
|
||||
|
||||
// find player name from DB
|
||||
if (_selectedPlayerName == "Dead Player") then {
|
||||
_memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if (count (_memberrange select 1) > 0) then {
|
||||
if ((_memberrange select 1 select 0) isEqualType "STRING") then {
|
||||
_selectedPlayerName = _memberrange select 1 select 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_removePlayerArray = _contentArray select _modOrMemberRevert;
|
||||
|
||||
{
|
||||
if (_x select 0 == _selectedPlayerUID) exitWith {
|
||||
_removePlayerArray deleteAt _forEachIndex;
|
||||
_contentArray set [_modOrMemberRevert, _removePlayerArray];
|
||||
};
|
||||
} forEach _removePlayerArray;
|
||||
|
||||
_modOrMemberArray = _contentArray select _modOrMember;
|
||||
_modOrMemberArray pushBack [_selectedPlayerUID, _selectedPlayerName];
|
||||
|
||||
_contentArray set [_modOrMember, _modOrMemberArray];
|
||||
|
||||
} else {
|
||||
|
||||
//Remove
|
||||
_found = false;
|
||||
|
||||
{
|
||||
_x setVariable ["GROUP", nil];
|
||||
[_x] joinSilent (createGroup [west, true]);
|
||||
[["resetGroup", true], _x] call EPOCH_sendRemoteExecClient;
|
||||
[["groupUpdate", []], _x] call EPOCH_sendRemoteExecClient;
|
||||
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
|
||||
{
|
||||
if (_x select 0 == _selectedPlayerUID) exitWith {
|
||||
_memberArray deleteAt _forEachIndex;
|
||||
_found = true;
|
||||
};
|
||||
} forEach _memberArray;
|
||||
|
||||
if (_found) then {
|
||||
_contentArray set [4, _memberArray];
|
||||
} else {
|
||||
{
|
||||
if (_x select 0 == _selectedPlayerUID) exitWith {
|
||||
_modArray deleteAt _forEachIndex;
|
||||
_found = true;
|
||||
};
|
||||
} forEach _modArray;
|
||||
_contentArray set [3, _modArray];
|
||||
};
|
||||
|
||||
if (!_found) then {
|
||||
diag_log format ["Epoch: %1 cannot remove Player! (%1)", __FILE__, _this]
|
||||
};
|
||||
};
|
||||
|
||||
{
|
||||
[["groupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient;
|
||||
} forEach (_allPlayers select {(_x getVariable["GROUP", ""]) == _groupID});
|
||||
|
||||
// Save Group Data
|
||||
["Group", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET;
|
||||
};
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Upgrade group size
|
||||
|
||||
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_group/EPOCH_server_upgradeGroup.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cIndex","_contentArray","_current_crypto","_found","_groupMemberPUID","_newGroupSize","_playerCryptoLimit","_response","_return","_upgradePrice","_vars"];
|
||||
//[[[end]]]
|
||||
params ["_groupID","_player",["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_return = false;
|
||||
|
||||
// get vars array and current Crypto value
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
|
||||
// [_groupName, _leaderName, _groupSize, _modArray, _memberArray]
|
||||
_response = ["Group", _groupID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_contentArray = (_response select 1);
|
||||
_found = EPOCH_group_upgrade_lvl_SEPXVar find (_contentArray select 2);
|
||||
|
||||
if ((_found != -1) && count EPOCH_group_upgrade_lvl_SEPXVar >= (_found + 3)) then {
|
||||
_newGroupSize = EPOCH_group_upgrade_lvl_SEPXVar select (_found + 2);
|
||||
|
||||
_upgradePrice = parseNumber (EPOCH_group_upgrade_lvl_SEPXVar select (_found+3));
|
||||
|
||||
if (_current_crypto >= _upgradePrice) then {
|
||||
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
_current_crypto = ((_current_crypto - _upgradePrice) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
// send to player
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable["VARS", _vars];
|
||||
|
||||
_contentArray set [2, _newGroupSize];
|
||||
|
||||
_groupMemberPUID = [_groupID];
|
||||
{
|
||||
{
|
||||
_groupMemberPUID pushback(_x select 0);
|
||||
} forEach _x;
|
||||
} forEach [_contentArray select 3, _contentArray select 4];
|
||||
|
||||
{
|
||||
[["groupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient;
|
||||
} forEach (allPlayers select {getPlayerUID _x in _groupMemberPUID});
|
||||
|
||||
// Save Group Data
|
||||
_return = ["Group", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET;
|
||||
};
|
||||
};
|
||||
};
|
||||
_return
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Add HiveFunction: Create Group / Set Data
|
||||
|
||||
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_grouptemp/EPOCH_server_createTempGroup.sqf
|
||||
|
||||
Return:
|
||||
|
||||
true = group has been created and / or successfully saved!
|
||||
false = group exist already and hasn't been saved!
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cIndex","_contentArray","_current_crypto","_groupID","_groupName","_leaderName","_playerCryptoLimit","_return","_textArr","_upgradePrice","_vars"];
|
||||
//[[[end]]]
|
||||
params ["_leader", "_groupName", ["_token","",[""]] ];
|
||||
if !([_leader, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_return = false;
|
||||
_textArr = toArray(_groupName);
|
||||
|
||||
if (count _textArr > 24) exitWith{};
|
||||
// remove any disallowed chars in group name "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -_"
|
||||
{
|
||||
if !(_x in [97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,49,50,51,52,53,54,55,56,57,48,32,45,95]) then {
|
||||
_textArr = _textArr - [_x];
|
||||
};
|
||||
} forEach _textArr;
|
||||
_groupName = toString _textArr;
|
||||
|
||||
if (_groupName != "") then {
|
||||
|
||||
_groupID = getPlayerUID _leader;
|
||||
|
||||
_leaderName = if (alive _leader) then {name _leader} else {"Dead Player"};
|
||||
|
||||
_contentArray = [_groupName, _leaderName, EPOCH_group_upgrade_lvl_SEPXVar select 0, [], []];
|
||||
|
||||
[["tempGroupUpdate", _contentArray], _leader] call EPOCH_sendRemoteExecClient;
|
||||
[["tempGroupUidUpdate", _groupID], _leader] call EPOCH_sendRemoteExecClient;
|
||||
|
||||
_leader setVariable ["TEMPGROUP", _groupID];
|
||||
_leader setVariable ["TEMPGROUPARRAY",_contentArray];
|
||||
|
||||
_return = true;
|
||||
};
|
||||
_return
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Delete Group
|
||||
|
||||
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_grouptemp/EPOCH_server_deleteTempGroup.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_groupID","_return"];
|
||||
//[[[end]]]
|
||||
params ["_player",["_token","",[""]] ];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_return = false;
|
||||
_groupID = getPlayerUID _player;
|
||||
if (_groupID != "") then {
|
||||
_allPlayers = allPlayers select {alive _x};
|
||||
{
|
||||
_group = grpNull;
|
||||
_permGroup = _x getVariable["GROUP",""];
|
||||
if !(_permGroup isEqualTo "")then
|
||||
{
|
||||
{
|
||||
if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
|
||||
_group = group _x;
|
||||
};
|
||||
} forEach _allPlayers;
|
||||
};
|
||||
|
||||
_x setVariable ["TEMPGROUP", nil];
|
||||
[["resetTempGroup", true], _x] call EPOCH_sendRemoteExecClient;
|
||||
if (isNull _group) then {
|
||||
_group = createGroup [west, true];
|
||||
};
|
||||
[_x] joinSilent _group;
|
||||
} forEach (allPlayers select {(_x getVariable["TEMPGROUP", ""]) == _groupID});
|
||||
|
||||
[["tempGroupUpdate", []], _player] call EPOCH_sendRemoteExecClient;
|
||||
_return = true;
|
||||
};
|
||||
_return
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Invite Player
|
||||
|
||||
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_grouptemp/EPOCH_server_invitePlayerTempGroup.sqf
|
||||
*/
|
||||
params ["_playerUID","_var1","_var2","_player",["_token","",[""]]];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
private _targets = allPlayers select {getPlayerUID _x == _playerUID};
|
||||
if !(_targets isEqualTo []) then {
|
||||
[_var1, _var2] remoteExec ['EPOCH_tempGroup_invitePlayer',_targets];
|
||||
};
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Add or remove members from a group
|
||||
|
||||
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_grouptemp/EPOCH_server_updatePlayerTempGroup.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_allPlayers","_contentArray","_found","_group","_memberrange","_modOrMember","_modOrMemberArray","_modOrMemberRevert","_removePlayerArray","_response","_selectedPlayerName","_playerObj"];
|
||||
//[[[end]]]
|
||||
params [["_groupID",""],["_selectedPlayerUID",""],["_addOrRemove",false],["_modOrMemberVar",true],["_player",objnull],["_token",""]];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith {};
|
||||
|
||||
if (_groupID == "") exitWith{ diag_log format["Epoch: GROUP: No Temp Group Selected %1", _this]; };
|
||||
|
||||
diag_log format["Epoch: Temp GROUP: Update %1", _this];
|
||||
|
||||
_modOrMember = if (_modOrMemberVar) then [{3},{4}];
|
||||
_modOrMemberRevert = if (_modOrMemberVar) then [{4},{3}];
|
||||
_contentArray = [];
|
||||
{
|
||||
_contentArray = _x getVariable ["TEMPGROUPARRAY",[]];
|
||||
} forEach (allPlayers select {getPlayerUID _x == _groupID});
|
||||
|
||||
if !(_contentArray isEqualTo []) then {
|
||||
|
||||
_contentArray params ["_groupName","_leaderName","_groupSize","_modArray","_memberArray"];
|
||||
_allPlayers = allPlayers select {alive _x};
|
||||
|
||||
if (_addOrRemove) then { //Add
|
||||
_selectedPlayerName = "Dead Player";
|
||||
|
||||
{
|
||||
_selectedPlayerName = if (alive _x) then {name _x};
|
||||
if ((_x getVariable ["TEMPGROUP",""]) != _groupID) then {
|
||||
_group = grpNull;
|
||||
{
|
||||
_group = group _x;
|
||||
} forEach (_allPlayers select {(_x getVariable["TEMPGROUP", ""]) == _groupID});
|
||||
|
||||
if (isNull _group) then {
|
||||
_group = createGroup [west, true];
|
||||
};
|
||||
_x setVariable ["TEMPGROUP", _groupID];
|
||||
[["tempGroupUidUpdate", _groupID], _x] call EPOCH_sendRemoteExecClient;
|
||||
[_x] joinSilent _group;
|
||||
};
|
||||
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
|
||||
|
||||
|
||||
// find player name from DB
|
||||
if (_selectedPlayerName == "Dead Player") then {
|
||||
_memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if (count (_memberrange select 1) > 0) then {
|
||||
if ((_memberrange select 1 select 0) isEqualType "STRING") then {
|
||||
_selectedPlayerName = _memberrange select 1 select 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_removePlayerArray = _contentArray select _modOrMemberRevert;
|
||||
|
||||
{
|
||||
if (_x select 0 == _selectedPlayerUID) exitWith {
|
||||
_removePlayerArray deleteAt _forEachIndex;
|
||||
_contentArray set [_modOrMemberRevert, _removePlayerArray];
|
||||
};
|
||||
} forEach _removePlayerArray;
|
||||
|
||||
_modOrMemberArray = _contentArray select _modOrMember;
|
||||
_modOrMemberArray pushBack [_selectedPlayerUID, _selectedPlayerName];
|
||||
|
||||
_contentArray set [_modOrMember, _modOrMemberArray];
|
||||
|
||||
} else {
|
||||
|
||||
//Remove
|
||||
_found = false;
|
||||
_group = grpNull;
|
||||
_permGroup = "";
|
||||
{
|
||||
_permGroup = _x getVariable["GROUP",""];
|
||||
_playerObj = _x;
|
||||
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
|
||||
if !(_permGroup isEqualTo "")then
|
||||
{
|
||||
{
|
||||
_group = group _x;
|
||||
} forEach (_allPlayers select {(_x getVariable["GROUP", ""]) == _permGroup});
|
||||
};
|
||||
_playerObj setVariable ["TEMPGROUP", nil];
|
||||
if (isNull _group) then {
|
||||
_group = createGroup [west, true];
|
||||
};
|
||||
[_playerObj] joinSilent _group;
|
||||
[["resetTempGroup", true], _playerObj] call EPOCH_sendRemoteExecClient;
|
||||
[["tempGroupUpdate", []], _playerObj] call EPOCH_sendRemoteExecClient;
|
||||
{
|
||||
if (_x select 0 == _selectedPlayerUID) exitWith {
|
||||
_memberArray deleteAt _forEachIndex;
|
||||
_found = true;
|
||||
};
|
||||
} forEach _memberArray;
|
||||
|
||||
if (_found) then {
|
||||
_contentArray set [4, _memberArray];
|
||||
} else {
|
||||
{
|
||||
if (_x select 0 == _selectedPlayerUID) exitWith {
|
||||
_modArray deleteAt _forEachIndex;
|
||||
_found = true;
|
||||
};
|
||||
} forEach _modArray;
|
||||
_contentArray set [3, _modArray];
|
||||
};
|
||||
|
||||
if (!_found) then {
|
||||
diag_log format ["Epoch: %1 cannot remove Player! (%1)", __FILE__, _this]
|
||||
};
|
||||
};
|
||||
|
||||
{
|
||||
[["tempGroupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient;
|
||||
} forEach (_allPlayers select {(_x getVariable["TEMPGROUP", ""]) == _groupID});
|
||||
|
||||
};
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Upgrade group size
|
||||
|
||||
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_grouptemp/EPOCH_server_upgradeTempGroup.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cIndex","_contentArray","_current_crypto","_found","_groupMemberPUID","_newGroupSize","_playerCryptoLimit","_response","_return","_upgradePrice","_vars"];
|
||||
//[[[end]]]
|
||||
params ["_groupID","_player",["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_return = false;
|
||||
|
||||
// [_groupName, _leaderName, _groupSize, _modArray, _memberArray]
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_contentArray = (_response select 1);
|
||||
_found = EPOCH_group_upgrade_lvl_SEPXVar find (_contentArray select 2);
|
||||
|
||||
if ((_found != -1) && count EPOCH_group_upgrade_lvl_SEPXVar >= (_found + 3)) then {
|
||||
_newGroupSize = EPOCH_group_upgrade_lvl_SEPXVar select (_found + 2);
|
||||
|
||||
_upgradePrice = parseNumber (EPOCH_group_upgrade_lvl_SEPXVar select (_found+3));
|
||||
|
||||
_contentArray set [2, _newGroupSize];
|
||||
|
||||
_groupMemberPUID = [_groupID];
|
||||
{
|
||||
{
|
||||
_groupMemberPUID pushback(_x select 0);
|
||||
} forEach _x;
|
||||
} forEach [_contentArray select 3, _contentArray select 4];
|
||||
|
||||
{
|
||||
[["tempGroupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient;
|
||||
} forEach (allPlayers select {getPlayerUID _x in _groupMemberPUID});
|
||||
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
_return
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side damage and trash looting
|
||||
|
||||
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_destroyTrash.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_antagTable","_antagTableArray","_config","_errorMsg","_item","_nearPlayers","_payout","_posWH","_target","_triggerType","_weightedArray"];
|
||||
//[[[end]]]
|
||||
params [["_object",objNull,[objNull]],["_type",0,[0]],["_player",objNull,[objNull]],["_token","",[""]] ];
|
||||
|
||||
if (isNull _object) exitWith{};
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
if (alive _object) then {
|
||||
|
||||
_config = 'CfgEpochClient' call EPOCH_returnConfig;
|
||||
_payout = getArray(_config >> worldname >> "TrashClasses") param [_type, "Trash"];
|
||||
|
||||
_posWH = getPosATL _player;
|
||||
|
||||
if (isSimpleObject _object) then {
|
||||
// just remove for now, object will respawn on restart.
|
||||
deleteVehicle _object;
|
||||
} else {
|
||||
_object setdamage 1;
|
||||
};
|
||||
|
||||
_item = createVehicle["groundWeaponHolder", _posWH, [], 0.0, "CAN_COLLIDE"];
|
||||
_item setPosATL _posWH;
|
||||
|
||||
_config = (configFile >> "CfgMainTable" >> _payout);
|
||||
if (isClass _config) then {
|
||||
[_player,"LootedObjs",1,true] call EPOCH_server_updatePlayerStats;
|
||||
if (random 1 < getNumber(_config >> "chance")) then {
|
||||
[_item, _payout] call EPOCH_serverLootObject;
|
||||
// force player to open gear on this object.
|
||||
[_item, {player action["Gear", _this]}] remoteExec ["call", _player];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
true
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side damage and tree/bush looting
|
||||
|
||||
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_knockDownTree.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_doPayout","_item","_lootType","_nearbyWH","_posWH"];
|
||||
//[[[end]]]
|
||||
params ["_object","_type","_player",["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
if (isNull _object) exitWith{};
|
||||
if (_player distance2D (getposATL _object) > 6) exitWith{};
|
||||
_doPayout = false;
|
||||
if (alive _object) then {
|
||||
_posWH = getPosATL _object;
|
||||
_posWH set[2, 0];
|
||||
|
||||
if (isSimpleObject _object) then {
|
||||
// just remove for now, object will respawn on restart.
|
||||
deleteVehicle _object;
|
||||
_doPayout = true;
|
||||
} else {
|
||||
if (damage _object > 0.7) then {
|
||||
_object setdamage 1;
|
||||
_doPayout = true;
|
||||
|
||||
} else {
|
||||
_object setdamage((damage _object) + 0.25) min 1;
|
||||
};
|
||||
};
|
||||
|
||||
if (_doPayout) then {
|
||||
_lootType = "Tree";
|
||||
if (_type == 1) then {
|
||||
_lootType = "Bush";
|
||||
};
|
||||
|
||||
_nearbyWH = nearestObjects[_posWH, ["groundWeaponHolder"], 2];
|
||||
if !(_nearbyWH isEqualTo[]) then {
|
||||
[(_nearbyWH select 0), _lootType] call EPOCH_serverLootObject;
|
||||
} else {
|
||||
_item = createVehicle["groundWeaponHolder", _posWH, [], 0, "CAN_COLLIDE"];
|
||||
_item setPosATL _posWH;
|
||||
[_item, _lootType] call EPOCH_serverLootObject;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
true
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side animal looting
|
||||
|
||||
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_lootAnimal.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_class","_classOverride","_config","_errorMsg","_item","_objectClass","_pos"];
|
||||
//[[[end]]]
|
||||
params ["_object","_player",["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
if !(isNull _object) then {
|
||||
_pos = getPosATL _object;
|
||||
_objectClass = typeOf _object;
|
||||
_classOverride = getText (configFile >> "CfgVehicles" >> _objectClass >> "epochLootClass");
|
||||
if (_classOverride != "") then {
|
||||
_objectClass = _classOverride;
|
||||
};
|
||||
deleteVehicle _object;
|
||||
_item = createVehicle["groundWeaponHolder", [0,0,0], [], 0.0, "CAN_COLLIDE"];
|
||||
if (_objectClass isequalto "GreatWhite_F") then {
|
||||
_item setvariable ["EPOCH_Loot",true,true];
|
||||
};
|
||||
_item setPosATL _pos;
|
||||
_class = "SeaFood";
|
||||
_config = configFile >> "CfgMainTable" >> _objectClass;
|
||||
if (isClass(_config)) then {
|
||||
_class = _objectClass;
|
||||
};
|
||||
[_item, _class, true] call EPOCH_serverLootObject;
|
||||
|
||||
// force player to open gear on this object.
|
||||
[_item, {player action["Gear", _this]}] remoteExec ["call", _player];
|
||||
};
|
||||
true
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side container looting
|
||||
|
||||
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_lootContainer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_animated","_antagTable","_antagTableArray","_class","_config","_dir","_errorMsg","_lootClasses","_object","_pos","_triggerType","_type","_weightedArray","_whConfig"];
|
||||
//[[[end]]]
|
||||
params ["_object","_player",["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
if (isNull _object) exitWith{};
|
||||
if !(alive _object) exitWith{};
|
||||
if (_player distance _object > 20) exitWith{};
|
||||
|
||||
if !(_object in EPOCH_cleanupQueue) then {
|
||||
|
||||
[_player,"LootedObjs",1,true] call EPOCH_server_updatePlayerStats;
|
||||
|
||||
_parent = _object getvariable ["Epoch_ParentBuilding",ObjNull];
|
||||
if (isnull _parent) then {
|
||||
EPOCH_cleanupQueue pushBack _object;
|
||||
};
|
||||
|
||||
_type = typeOf _object;
|
||||
|
||||
_animated = configFile >> "CfgVehicles" >> _type >> "Destruction" >> "animations";
|
||||
if (isArray _animated) then {
|
||||
_object setDamage 1;
|
||||
};
|
||||
_config = (configFile >> "CfgMainTable" >> _type);
|
||||
_lootClasses = getArray(_config >> "tables");
|
||||
|
||||
if !(_lootClasses isEqualTo []) then {
|
||||
_whConfig = configFile >> "CfgVehicles" >> _type >> "weaponHolderProxy";
|
||||
if (isText _whConfig) then {
|
||||
_class = getText (_whConfig);
|
||||
_pos = getPosATL _object;
|
||||
_dir = getDir _object;
|
||||
_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;
|
||||
// force player to open gear on this object.
|
||||
if !(_type isequalto "Cargo_Container") then {
|
||||
[_object, {player action["Gear", _this]}] remoteExec ["call", _player];
|
||||
};
|
||||
} else {
|
||||
[_object, "Default"] call EPOCH_serverLootObject;
|
||||
// force player to open gear on this object.
|
||||
[_object, {player action["Gear", _this]}] remoteExec ["call", _player];
|
||||
};
|
||||
|
||||
};
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side rock mining
|
||||
|
||||
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_mineRocks.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_config","_posWH","_selectedConfig"];
|
||||
//[[[end]]]
|
||||
params ["_object","_index","_player",["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
// make sure object still exists and is proper object type and alive.
|
||||
if (_object isEqualType objNull && {!(isNull _object)} && {alive _object}) then {
|
||||
|
||||
_posWH = getPosATL _player;
|
||||
_posWH set[2, 0];
|
||||
|
||||
// define loot table class
|
||||
_selectedConfig = typeOf _object;
|
||||
if (_selectedConfig isEqualTo "") then {
|
||||
// handle simple/terrain objects
|
||||
(getModelInfo _object) params [["_modelName",""]];
|
||||
if (!isnil "_modelName") then {
|
||||
// replace spaces and periods with underscores
|
||||
_selectedConfig = (_modelName splitString " .") joinString "_";
|
||||
};
|
||||
};
|
||||
|
||||
_config = configFile >> "CfgMainTable" >> _selectedConfig;
|
||||
if !(isClass(_config)) then {
|
||||
// allow override with generic loot classes if object class is not in CfgMainTable
|
||||
switch (_index) do {
|
||||
case 0: { _selectedConfig = "Rock" };
|
||||
case 1: { _selectedConfig = "Cinder" };
|
||||
case 2: { _selectedConfig = "Wreck" };
|
||||
case 3: { _selectedConfig = "Ore" };
|
||||
};
|
||||
};
|
||||
|
||||
if (isSimpleObject _object) then {
|
||||
// just remove for now, object will respawn on restart.
|
||||
deleteVehicle _object;
|
||||
} else {
|
||||
_object setdamage 1;
|
||||
};
|
||||
|
||||
// output loot
|
||||
[objNull, _selectedConfig, false, _posWH] call EPOCH_serverLootObject;
|
||||
};
|
||||
true
|
@ -0,0 +1,98 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side spawing of shipwreck loots
|
||||
|
||||
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_spawnBoatLoot.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgEpoch", "_debug", "_worldSize", "_shipwrecks", "_customLocs", "_customWrecks", "_totalCustomLocs", "_customWreck", "_total", "_count", "_distFromOthers", "_spawnedLoot","_tooClose", "_wreck", "_position", "_item", "_debugMkr", "_markers", "_originalColors", "_showMarkers", "_decayMarkerColor", "_compromisedColor", "_rEvents", "_thisEvent"];
|
||||
//[[[end]]]
|
||||
_cfgEpoch = configFile >> "CfgEpoch" >> worldname;
|
||||
_debug = if(getNumber(_cfgEpoch >> "debugShipwreckLoot") isEqualTo 1)then{true}else{false};
|
||||
// Check for shipwreck loot allowed
|
||||
if (getNumber(_cfgEpoch >> "shipwreckLootEnabled") isEqualTo 1) then {
|
||||
// Check for total shipwrecks allowed
|
||||
_total = getNumber(_cfgEpoch >> "maxSpawnedShipwrecks");
|
||||
if(_total isEqualTo 0)exitWith{if(_debug)then{diag_log "EPOCHDebug: no shipwrecks allowed"}};
|
||||
// Load shipwrecks and custom locations
|
||||
_worldSize = worldSize/2;
|
||||
_shipwrecks = (nearestTerrainObjects [ [_worldSize, _worldSize], ["SHIPWRECK"], _worldSize]) select {surfaceiswater (getpos _x)} ;
|
||||
_customLocs = getArray(_cfgEpoch >> "shipwreckCustomLocs");
|
||||
_customWrecks = getArray(_cfgEpoch >> "shipwreckCustomWrecks");
|
||||
_totalCustomLocs = count(_customLocs);
|
||||
if(_totalCustomLocs > 0)then{
|
||||
for "_c" from 0 to _totalCustomLocs-1 do {
|
||||
_customWreck = (selectRandom _customWrecks) createVehicle (_customLocs select _c);
|
||||
_shipwrecks pushBack _customWreck;
|
||||
};
|
||||
};
|
||||
if(_shipwrecks isEqualTo [])exitWith{if(_debug)then{diag_log "EPOCHDebug: no shipwrecks found"}};
|
||||
// Check combined array count
|
||||
_count = count(_shipwrecks);
|
||||
if(_count < _total)then{if(_debug)then{diag_log "EPOCHDebug: not enough shipwrecks to fill your needs on this map, trying all available locations!"}};
|
||||
// Start spawning loot
|
||||
_distFromOthers = getNumber(_cfgEpoch >> "distFromOtherShipwrecks");
|
||||
_spawnedLoot = [];
|
||||
for "_i" from 1 to _total do {
|
||||
if(_shipwrecks isEqualTo [])exitWith{if(_debug)then{diag_log "EPOCHDebug: no more shipwrecks found"}};
|
||||
|
||||
_tooClose = false;
|
||||
_wreck = selectRandom _shipwrecks;
|
||||
if(isNil "_wreck")exitWith{};
|
||||
{
|
||||
if(!(_spawnedLoot isEqualTo []) && ((_wreck distance _x) < _distFromOthers))exitWith{
|
||||
if(_debug)then{diag_log "EPOCHDebug: Shipwreck too close to another shipwreck"};
|
||||
_tooClose = true;
|
||||
_i = (_i - 1);
|
||||
};
|
||||
}forEach _spawnedLoot;
|
||||
|
||||
_shipwrecks = _shipwrecks - [_wreck];
|
||||
if!(_tooClose)then{
|
||||
_position = [_wreck,1,20,3,1,20,0] call BIS_fnc_findSafePos;
|
||||
_item = createVehicle["container_epoch",_position, [], 0, "NONE"];
|
||||
_spawnedLoot pushback _wreck;
|
||||
if(_debug)then{
|
||||
_debugMkr = createMarker [str(_position),_position];
|
||||
_debugMkr setMarkerShape "ICON";
|
||||
_debugMkr setMarkerType "mil_dot";
|
||||
_debugMkr setMarkerColor "ColorRed";
|
||||
};
|
||||
_item setMass 220;
|
||||
_item setVariable["EPOCH_Loot",false,true];
|
||||
|
||||
// SET UP THE MARKER.
|
||||
_markers = [];
|
||||
_originalColors = [];
|
||||
_showMarkers = if(getNumber(_cfgEpoch >> "showBoatLootMarkers") isEqualTo 1)then{true}else{false};
|
||||
_decayMarkerColor = getText(_cfgEpoch >> "shipwreckDecayMarkerColor");
|
||||
_compromisedColor = getText(_cfgEpoch >> "shipwreckCompromisedColor");
|
||||
if (_showMarkers) then{
|
||||
_markers = ["Shipwreck",_position] call EPOCH_server_createGlobalMarkerSet;
|
||||
{
|
||||
_originalColors pushBack (getMarkerColor _x);
|
||||
}forEach _markers;
|
||||
|
||||
// Check for HeightenedPlayerVsPlayer false and remove comprimised coloring
|
||||
if!(getNumber(_cfgEpoch >> "HeightenedPlayerVsPlayer") isEqualTo 1)then{
|
||||
_compromisedColor = getMarkerColor (_markers select 0);
|
||||
};
|
||||
};
|
||||
|
||||
_rEvents = missionNameSpace getVariable["EPOCH_RunningEvents",[]];
|
||||
_thisEvent = [_position, [_item], [], "shipwreckCounter", diag_tickTime, 99999, _showMarkers, _markers, _originalColors, _decayMarkerColor, _compromisedColor];
|
||||
missionNameSpace setVariable["EPOCH_RunningEvents",_rEvents + [_thisEvent]];
|
||||
};
|
||||
};
|
||||
if(_debug)then{
|
||||
diag_log format["EPOCHDebug: Safely spawned %1 loot container(s) at these shipwreck locations:%2",count _spawnedLoot , _spawnedLoot];
|
||||
};
|
||||
};
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
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","_privateDir","_GroundClass"
|
||||
];
|
||||
|
||||
params [["_player",objNull,[objNull]],["_token","",[""]],["_LootsArray",[]]];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
_GroundClass = if (Epoch_UseLootHelper) then {"Epoch_LootHolder_Sphere"} else {"Epoch_LootHolder"};
|
||||
_privateDir = [];
|
||||
_masterConfig = getmissionconfig "CfgBuildingLootPos";
|
||||
{
|
||||
_x params [["_Building",objnull],["_LootType",""],["_buildingLootArray",[]]];
|
||||
if (!isnull _Building) then {
|
||||
if !(_building in Epoch_LootedBuildings) then {
|
||||
_buildingLoot = [];
|
||||
_building setvariable ["Epoch_LootCleanup",diag_ticktime + Epoch_LootCleanupTime];
|
||||
Epoch_LootedBuildings pushBackUnique _building;
|
||||
switch _LootType do {
|
||||
case "EpochLoot": {
|
||||
{
|
||||
_x params ["_class","_pos","_dir","_color"];
|
||||
if (_class in (call Epoch_LootContainers)) then {
|
||||
_item = createVehicle [_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_item setvariable ["Epoch_ParentBuilding",_building];
|
||||
_buildingLoot pushback _item;
|
||||
_item setDir _dir;
|
||||
_privateDir pushback [_item,_dir];
|
||||
if (surfaceIsWater _pos) then {
|
||||
_item setPosASL _pos;
|
||||
}
|
||||
else {
|
||||
_item setPosATL _pos;
|
||||
};
|
||||
if !(_color isEqualTo "") then {
|
||||
_item setObjectTextureGlobal [0, _color];
|
||||
};
|
||||
};
|
||||
} foreach _buildingLootArray;
|
||||
};
|
||||
case "GroundLoot": {
|
||||
{
|
||||
_x params ["_lootType","_pos"];
|
||||
_item = createVehicle [_GroundClass, _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;
|
||||
|
||||
|
||||
} foreach _buildingLootArray;
|
||||
};
|
||||
};
|
||||
if !(_buildingLoot isEqualTo []) then {
|
||||
_building setvariable ["Epoch_BuildingLoot",_buildingLoot];
|
||||
};
|
||||
};
|
||||
};
|
||||
} foreach _LootsArray;
|
||||
if !(_privateDir isEqualTo []) then {
|
||||
{
|
||||
(_x select 0) setowner (owner _player); // switch owner for better simulations on looting
|
||||
} foreach _privateDir;
|
||||
_privateDir remoteexec ['Epoch_fnc_SetFinalDir',_player];
|
||||
};
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors: Aaron Clark
|
||||
|
||||
Description:
|
||||
Creates air drop crate
|
||||
|
||||
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_missions/EPOCH_Server_airDropCrate.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_axeChute","_axeCrate","_axeLight","_crateSmoke","_pos"];
|
||||
//[[[end]]]
|
||||
params ["_object","_player",["_token","",[""]] ];
|
||||
|
||||
if !([_player,_token] call EPOCH_server_getPToken)exitWith{};
|
||||
|
||||
_pos = getPos _object;
|
||||
_pos set [2,(_pos select 2) - 2];
|
||||
_axeCrate = createVehicle ["B_supplyCrate_F", _pos, [], 10, "NONE"];
|
||||
_axeChute = createVehicle ["NonSteerable_Parachute_F", _pos, [], 10, "FLY"];
|
||||
_axeCrate attachTo [_axeChute, [0, 0, 0] ];
|
||||
_crateSmoke = "SmokeShell" createVehicle _pos;
|
||||
_crateSmoke attachTo [_axeChute,[0,0,-0.4]];
|
||||
clearWeaponCargoGlobal _axeCrate;
|
||||
clearItemCargoGlobal _axeCrate;
|
||||
clearMagazineCargoGlobal _axeCrate;
|
||||
clearBackpackCargoGlobal _axeCrate;
|
||||
_axeLight = "Land_Camping_Light_F" createvehicle _pos;
|
||||
_axeLight attachTo [_axeCrate, [0.71, 0.18, -0.22] ];
|
||||
_axeCrate setPos _pos;
|
||||
|
||||
// universal payout system
|
||||
[_axeCrate, "AirDrop_Payout1"] call EPOCH_serverLootObject;
|
@ -0,0 +1,84 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors: Aaron Clark
|
||||
|
||||
Description:
|
||||
Creates helicopter air drop
|
||||
|
||||
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_missions/EPOCH_Server_createAirDrop.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_driver","_drvOwner","_grp","_obj","_objType","_playerOwner","_unit","_unitPos"];
|
||||
//[[[end]]]
|
||||
params ["_player",["_token","",[""]],"_pos"];
|
||||
|
||||
if (!isNil "axenotSent" && {axenotSent}) exitWith {
|
||||
diag_log format ["DEBUG: airdrop script already running %1",_this];
|
||||
};
|
||||
|
||||
if !([_player,_token]call EPOCH_server_getPToken)exitWith{};
|
||||
|
||||
_pos set[2, 2400];
|
||||
|
||||
if !((nearestObjects[_pos, ["B_Heli_Transport_01_F"], 1000]) isEqualTo[]) exitWith{ diag_log "DEBUG: prevented air drop, too many in area." };
|
||||
|
||||
_playerOwner = owner _player;
|
||||
|
||||
_objType = "B_Heli_Transport_01_F";
|
||||
diag_log format["Epoch: Creating %1 for %3 (Owner ID: %4) at %2",_objType, _pos, name _player, owner _player];
|
||||
_obj = createVehicle [_objType, _pos, [], 0, "FLY"];
|
||||
_obj call EPOCH_server_setVToken;
|
||||
addToRemainsCollector[_obj];
|
||||
_obj disableTIEquipment true;
|
||||
|
||||
clearWeaponCargoGlobal _obj;
|
||||
clearItemCargoGlobal _obj;
|
||||
clearMagazineCargoGlobal _obj;
|
||||
clearBackpackCargoGlobal _obj;
|
||||
|
||||
_obj allowdamage false;
|
||||
_obj setPosATL _pos;
|
||||
_obj setFuel 1;
|
||||
_obj flyInHeight 120;
|
||||
_grp = createGroup [RESISTANCE, true];
|
||||
|
||||
_unitPos = _pos;
|
||||
_driver = _grp createUnit["I_helipilot_F", _unitPos, [], 0, "CAN_COLLIDE"];
|
||||
_driver assignAsDriver _obj;
|
||||
_driver moveInDriver _obj;
|
||||
|
||||
_unitPos = _pos findEmptyPosition [1,75,"I_helipilot_F"];
|
||||
|
||||
_unit = _grp createUnit["I_helicrew_F", _unitPos, [], 0, "CAN_COLLIDE"];
|
||||
_unit assignAsGunner _obj;
|
||||
_unit moveInGunner _obj;
|
||||
|
||||
_grp setCombatMode "BLUE";
|
||||
|
||||
(driver _obj) action ["engineOn", _obj];
|
||||
_obj setVehicleLock "LOCKEDPLAYER";
|
||||
|
||||
[_obj,_driver,_player] spawn {
|
||||
axenotSent = true;
|
||||
params ["_obj","_driver","_player"];
|
||||
while {axenotSent} do {
|
||||
if (isNull _obj || isNull _driver ||isNull _player) exitWith {axenotSent = false};
|
||||
_drvOwner = owner _driver;
|
||||
_playerOwner = owner _player;
|
||||
if(_drvOwner == _playerOwner) exitWith {
|
||||
// send airdrop to player
|
||||
_obj remoteExec ['EPOCH_mission_returnObj',_player];
|
||||
// since we found an owner, add cleanup if ownership reverts to server. This can also be used to change ownership instead later.
|
||||
_obj call EPOCH_localCleanup;
|
||||
diag_log format["DEBUG: Transferred ownership of %1 to %2, new owner ID is %3",_driver, name _player, owner _driver];
|
||||
axenotSent = false;
|
||||
};
|
||||
(group _driver) setGroupOwner _playerOwner;
|
||||
uiSleep 1;
|
||||
};
|
||||
};
|
@ -0,0 +1,207 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors: Aaron Clark
|
||||
|
||||
Description:
|
||||
Server side spawing of mission objects
|
||||
|
||||
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_missions/EPOCH_Server_createObject.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_allowedVehicleListName","_allowedVehiclesList","_backpacks","_cfgPricing","_commander","_crew","_driver","_grp","_gunner","_items","_lootTableIndex","_magazines","_obj","_objArr","_pos","_veh","_vehAllowed","_vehicles","_weapons","_wepHolder"];
|
||||
//[[[end]]]
|
||||
params ["_player",["_token","",[""]],["_objArr",[]],["_pos",[]],["_wepHolder",objNull],["_clearCargo",true],["_objSpc","CAN_COLLIDE"],["_driverType",""],["_gunnerType",""],["_commanderType",""],["_crewType",""],["_doDamage",false]];
|
||||
|
||||
if !([_player,_token]call EPOCH_server_getPToken) exitWith {};
|
||||
if !(_objArr isEqualType [])then{_objArr = [_objArr];};
|
||||
if (count _objArr < 1) exitWith {};
|
||||
|
||||
diag_log format["Epoch: Attempt Create Object: %1 for %2",_objArr, name _player];
|
||||
|
||||
_cfgPricing = 'CfgPricing' call EPOCH_returnConfig;
|
||||
_lootTableIndex = if (EPOCH_modCUPVehiclesEnabled) then {if (EPOCH_mod_madArma_Enabled) then {3} else {1}} else {if (EPOCH_mod_madArma_Enabled) then {2} else {0}};
|
||||
_allowedVehicleListName = ["allowedVehiclesList","allowedVehiclesList_CUP","allowedVehiclesList_MAD","allowedVehiclesList_MADCUP"] select _lootTableIndex;
|
||||
if !(EPOCH_forcedVehicleSpawnTable isEqualTo "") then {
|
||||
_allowedVehicleListName = EPOCH_forcedVehicleSpawnTable;
|
||||
};
|
||||
_allowedVehiclesList = getArray(configFile >> "CfgEpoch" >> worldName >> _allowedVehicleListName);
|
||||
//diag_log format ["DEBUG: Allowed Vehs: %1",_allowedVehiclesList];
|
||||
_vehicles = [];
|
||||
_backpacks = [];
|
||||
_weapons = [];
|
||||
_items = [];
|
||||
_magazines = [];
|
||||
|
||||
if (_pos isEqualTo []) then {
|
||||
_pos = (getPosATL _player);
|
||||
};
|
||||
|
||||
if(count _pos < 3)then{
|
||||
_pos set [2,0];
|
||||
};
|
||||
|
||||
|
||||
//Sort Object Array
|
||||
{
|
||||
|
||||
//Weapons / Items
|
||||
if(isClass (configFile >> "CfgWeapons" >> _x))then{
|
||||
|
||||
diag_log format["Epoch: Server_CreateObject: %1 Weapon / Item Found",_x];
|
||||
|
||||
if("ItemCore" in ([configFile >> "CfgWeapons" >> _x, true] call BIS_fnc_returnParents))then{
|
||||
_items pushBack _x;
|
||||
}else{
|
||||
_weapons pushBack _x;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
//Magazines
|
||||
if(isClass (configFile >> "CfgMagazines" >> _x))then{
|
||||
|
||||
diag_log format["Epoch: Server_CreateObject: %1 Magazine Found",_x];
|
||||
|
||||
if("ItemCore" in ([configFile >> "CfgMagazines" >> _x, true] call BIS_fnc_returnParents))then{
|
||||
_items pushBack _x;
|
||||
}else{
|
||||
_magazines pushBack _x;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
//BackPacks / Vehicles
|
||||
if(isClass (configFile >> "CfgVehicles" >> _x))then{
|
||||
if("Bag_Base" in ([configFile >> "CfgVehicles" >> _x, true] call BIS_fnc_returnParents))then{
|
||||
_backpacks pushBack _x;
|
||||
}else{
|
||||
|
||||
_vehAllowed = true;
|
||||
|
||||
//If not destroying vehcile then check if allowed
|
||||
if!(_doDamage)then{
|
||||
_veh = _x;
|
||||
_vehAllowed = false;
|
||||
{
|
||||
if (_veh in _x)then{_vehAllowed = true;};
|
||||
} forEach _allowedVehiclesList;
|
||||
};
|
||||
|
||||
|
||||
if(_vehAllowed)then{
|
||||
//If not destroying (mission object) then find safe position
|
||||
if!(_doDamage)then{
|
||||
if(_x isKindOf "CAR" || _x isKindOf "AIR")then{
|
||||
_pos = [position _player, 0, 250, 6, 0, 1000, 0] call BIS_fnc_findSafePos;
|
||||
_pos = _pos findEmptyPosition [1,75,_x];
|
||||
};
|
||||
|
||||
if(_x isKindOf "SHIP")then{
|
||||
_pos = [position _player, 0, EPOCH_dynamicVehicleArea, 10, 1, 1000, 0] call BIS_fnc_findSafePos;
|
||||
_pos = _pos findEmptyPosition [1,75,_x];
|
||||
};
|
||||
};
|
||||
|
||||
_vehicles pushBack [_x,_pos];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}forEach _objArr;
|
||||
|
||||
//Weapons, ammo, items, backpacks
|
||||
if(count _weapons > 0 || count _items > 0 || count _magazines > 0 || count _backpacks > 0)then{
|
||||
|
||||
if(isNull _wepHolder)then{
|
||||
_wepHolder = createVehicle["groundWeaponHolder", _pos, [], 0.0, "CAN_COLLIDE"];
|
||||
};
|
||||
|
||||
|
||||
//Weapons
|
||||
if(count _weapons > 0)then{
|
||||
{
|
||||
diag_log format["Epoch: Server_CreateObject: %1 Weapon Spawn",_x];
|
||||
_wepHolder addWeaponCargoGlobal [_x,1];
|
||||
} forEach _weapons;
|
||||
};
|
||||
|
||||
//Items
|
||||
if(count _items > 0)then{
|
||||
{
|
||||
diag_log format["Epoch: Server_CreateObject: %1 Item Spawn",_x];
|
||||
_wepHolder addItemCargoGlobal [_x,1];
|
||||
} forEach _items;
|
||||
};
|
||||
|
||||
//Magazines
|
||||
if(count _magazines > 0)then{
|
||||
{
|
||||
diag_log format["Epoch: Server_CreateObject: %1 Magazine Spawn",_x];
|
||||
_wepHolder addMagazineCargoGlobal [_x,1];
|
||||
} forEach _magazines;
|
||||
};
|
||||
|
||||
//Backpacks
|
||||
if(count _backpacks > 0)then{
|
||||
{
|
||||
diag_log format["Epoch: Server_CreateObject: %1 Backpack Spawn",_x];
|
||||
_wepHolder addBackPackCargoGlobal [_x,1];
|
||||
}forEach _backpacks;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
if(count _vehicles > 0)then{
|
||||
{
|
||||
diag_log format["Epoch: Server_CreateObject: %1 Vehicle Spawn",_x];
|
||||
//Need to create slot to createVehicle a persistent Epoch vehicle.
|
||||
//_obj = [_x select 0, _x select 1, random 360, true, (EPOCH_storedVehicleCount + 1), _player, "CAN_COLLIDE", !_clearCargo, false] call EPOCH_spawn_vehicle;
|
||||
|
||||
_obj = createVehicle[(_x select 0), (_x select 1), [], 15, "CAN_COLLIDE"];
|
||||
|
||||
_obj allowdamage false;
|
||||
|
||||
if (_driverType != "" || _gunnerType != "" || _commanderType != "") then {
|
||||
_grp = createGroup [RESISTANCE, true];
|
||||
};
|
||||
|
||||
if (_driverType != "") then {
|
||||
_driver = _grp createUnit[_driverType, position _obj, [], 1, "CAN_COLLIDE"];
|
||||
_driver assignAsDriver _obj;
|
||||
_driver moveInDriver _obj;
|
||||
//if (_doOwner) then {_driver setOwner (owner _player)};
|
||||
};
|
||||
|
||||
if (_gunnerType != "") then {
|
||||
_gunner = _grp createUnit[_gunnerType, position _obj, [], 1, "CAN_COLLIDE"];
|
||||
_gunner assignAsGunner _obj;
|
||||
_gunner moveInGunner _obj;
|
||||
//if (_doOwner) then {_gunner setOwner (owner _player)};
|
||||
};
|
||||
|
||||
if (_commanderType != "") then {
|
||||
_commander = _grp createUnit[_commanderType, position _obj, [], 1, "CAN_COLLIDE"];
|
||||
_commander assignAsCommander _obj;
|
||||
_commander moveInCommander _obj;
|
||||
//if (_doOwner) then {_commander setOwner (owner _player)};
|
||||
};
|
||||
|
||||
if (_crewType != "") then {
|
||||
_crew = _grp createUnit[_crewType, position _obj, [], 1, "CAN_COLLIDE"];
|
||||
_crew assignAsCargo _obj;
|
||||
_crew moveInCargo _obj;
|
||||
//if (_doOwner) then {_crew setOwner (owner _player)};
|
||||
};
|
||||
_obj allowdamage true;
|
||||
|
||||
if(_doDamage)then{_obj setDamage 1;};
|
||||
|
||||
}forEach _vehicles;
|
||||
|
||||
|
||||
};
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Server side spawing of mission loots
|
||||
|
||||
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_missions/EPOCH_Server_fillContainer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_container","_pos"];
|
||||
//[[[end]]]
|
||||
params ["_player",["_token","",[""]],["_container",objNull,[objNull]],["_clearFirst",false],["_chance",25]];
|
||||
_pos = getPosATL _player;
|
||||
|
||||
if !([_player,_token]call EPOCH_server_getPToken)exitWith{};
|
||||
|
||||
if (isNull _container) then {
|
||||
_container = createVehicle ["GroundWeaponHolder", _pos, [], 12, "CAN_COLLIDE"];
|
||||
_container setPosATL _pos;
|
||||
};
|
||||
|
||||
if (_clearFirst) then {
|
||||
clearWeaponCargoGlobal _container;
|
||||
clearItemCargoGlobal _container;
|
||||
clearMagazineCargoGlobal _container;
|
||||
clearBackpackCargoGlobal _container;
|
||||
};
|
||||
|
||||
if (_chance > 0) then {
|
||||
// TODO add separate loot tables for each payout type
|
||||
[_container, "Mission_Payout1"] call EPOCH_serverLootObject;
|
||||
};
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Init and pass vars to mission / task control fsm. fsm will dispose if not being used, this function will restart it as required.
|
||||
|
||||
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_missions/EPOCH_Server_missionComms.sqf
|
||||
*/
|
||||
params["_plyr","_token",["_cmd",-1],["_tmpVar", nil],["_missionIndex",-1],["_item",objNull],["_pos",[]]];
|
||||
|
||||
if !([_plyr, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
if(isNil "missionControlHandle")then{
|
||||
missionControlHandle = [] execFSM "x\addons\a3_epoch_server\system\mission_control.fsm";
|
||||
diag_log format ["MISSION CONTROL INIT: %1",missionControlHandle];
|
||||
|
||||
//Catch first instant if fsm slow to start - may not be necessary.
|
||||
["_clientCmd",[_plyr, _cmd, _missionIndex,_item,_pos]] spawn{
|
||||
waitUntil {!(isNil "missionControlHandle")};
|
||||
missionControlHandle setFSMVariable [_this select 0, _this select 1];
|
||||
};
|
||||
}else{
|
||||
missionControlHandle setFSMVariable ["_clientCmd",[_plyr, _cmd, _missionIndex,_item,_pos]];
|
||||
};
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors: He-Man
|
||||
|
||||
Description:
|
||||
Add items/weapons to player containers
|
||||
|
||||
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_player/EPOCH_fnc_addItemToX.sqf
|
||||
|
||||
Example:
|
||||
[_player, _itemsInContainers] call EPOCH_fnc_addItemToX;
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJECT - player
|
||||
_this select 1: ARRAY -
|
||||
[
|
||||
[["itemClass",1],["anotherClass",5]], // addItemToUniform
|
||||
[["thatClass",2],["thisClass",2]], // addItemToVest
|
||||
[["yourClass",4],["myClass",3]] // addItemToBackpack
|
||||
]
|
||||
*/
|
||||
params ["_player","_slots"];
|
||||
{
|
||||
private _itemSlot = _forEachIndex;
|
||||
_x params ["_items","_itemqtys"];
|
||||
{
|
||||
for "_i" from 1 to (_itemqtys select _forEachIndex) do {
|
||||
switch _itemSlot do {
|
||||
case 0: { _player addItemToUniform _x };
|
||||
case 1: { _player addItemToVest _x };
|
||||
case 2: { _player addItemToBackpack _x };
|
||||
};
|
||||
};
|
||||
} forEach(_items);
|
||||
} forEach (_slots);
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Save player with token check for use with RemoteExec
|
||||
|
||||
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_player/EPOCH_fnc_savePlayer.sqf
|
||||
*/
|
||||
params ["_player","",["_token","",[""]],["_stats",[]],["_UpdateTopStats",false]];
|
||||
if([_player,_token] call EPOCH_server_getPToken)then{
|
||||
{
|
||||
_x params ["_statType","_adjust","_isTotal"];
|
||||
[_player, _statType, _adjust, false,_isTotal] call Epoch_server_updatePlayerStats;
|
||||
} foreach _stats;
|
||||
if (_UpdateTopStats) then {
|
||||
[_player, _player getVariable["COMMUNITY_STATS", []] ] call EPOCH_server_UpdateTopStats;
|
||||
};
|
||||
_this call EPOCH_server_savePlayer;
|
||||
};
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Author: DirtySanchez - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Save player with token check for use with RemoteExec
|
||||
|
||||
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_player/EPOCH_fnc_updatePlayerStats.sqf
|
||||
*/
|
||||
params ["_player",["_killer",ObjNull],["_statType",""],["_adjust",0],["_toClient",false],["_token","",[""]],["_isTotal",false]];
|
||||
|
||||
if(isNull _player)exitWith{
|
||||
diag_log "EPOCHDebug: fnc_updatePlayerStats -1a- player is Null";
|
||||
};
|
||||
if(!isplayer _player)exitWith{
|
||||
diag_log "EPOCHDebug: fnc_updatePlayerStats -1b- is not a player";
|
||||
};
|
||||
|
||||
if([_player,_token] call EPOCH_server_getPToken)then{
|
||||
if (!isnull _killer) then {
|
||||
_player = _killer;
|
||||
};
|
||||
[_player, _statType, _adjust, _toClient, _isTotal] call EPOCH_server_updatePlayerStats;
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
params [["_player",objNull,[objNull]],["_crypto",0,[0]],["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (_crypto > 0) exitwith { // This is only for pay Crypto, not for give Crypto ;)
|
||||
diag_log format ['Player %1 (%2) killed for Code hack',name _player, getplayeruid _player];
|
||||
_player setdamage 1
|
||||
};
|
||||
_this call EPOCH_server_effectCrypto;
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Author: He-Man - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Set final Player position on login
|
||||
|
||||
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_player/EPOCH_server_SetFinalPlayerPos.sqf
|
||||
*/
|
||||
|
||||
params ["_player","_newPlyr"];
|
||||
private ["_finalpos","_fallbackpos"];
|
||||
if (isnull _player || isnull _newPlyr) exitwith {
|
||||
diag_log "DEBUG: SetFinalPlayerPos failed - Player or PlayerObj is Null";
|
||||
};
|
||||
if !(typeof _player isequalto "VirtualMan_EPOCH") exitwith {
|
||||
diag_log "DEBUG: SetFinalPlayerPos failed - PlayerObj != VirtualMan_EPOCH";
|
||||
};
|
||||
_finalpos = _newPlyr getvariable ["FinalDest",[]];
|
||||
if (_finalpos isequalto []) exitwith {
|
||||
diag_log "DEBUG: SetFinalPlayerPos failed - No FinalPos Variable set";
|
||||
};
|
||||
if !(_finalpos isequaltype []) exitwith {
|
||||
diag_log "DEBUG: SetFinalPlayerPos failed - FinalPos is not an Array";
|
||||
};
|
||||
if (count _finalpos < 2) exitwith {
|
||||
diag_log "DEBUG: SetFinalPlayerPos failed - count FinalPos < 2";
|
||||
};
|
||||
_fallbackpos = getmarkerpos "respawn_west";
|
||||
_fallbackpos set [2,0];
|
||||
_finalpos params [["_location",_fallbackpos],["_dir",0]];
|
||||
_newPlyr setDir _dir;
|
||||
_newPlyr setPosATL _location;
|
||||
_newPlyr setVariable["SETUP", true, true];
|
||||
_player setPosATL _location;
|
||||
_newPlyr allowdamage true;
|
||||
_newPlyr hideobjectglobal false;
|
||||
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
Author: He-Man - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Login
|
||||
|
||||
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_player/EPOCH_server_SetUnitLoadout.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_type","_loadabs"];
|
||||
//[[[end]]]
|
||||
|
||||
params ["_newPlyr","_loadout"];
|
||||
|
||||
// _loadout params ["_primaryarr","_secondaryarr","_handgunarr","_uniformarr","_vestarr","_bpackarr","_HeadGear","_Glasses","_Rangefinderarr","_LinedItemsarr"];
|
||||
_loadout params ["","","","_uniformarr","_vestarr","_bpackarr","","","",""];
|
||||
_loadout set [3,[]];
|
||||
_loadout set [4,[]];
|
||||
_loadout set [5,[]];
|
||||
_newPlyr setunitloadout _loadout;
|
||||
_uniformarr params [["_uniform",""],["_uniformitems",[]]];
|
||||
_vestarr params [["_vest",""],["_vestitems",[]]];
|
||||
_bpackarr params [["_bpack",""],["_bpackitems",[]]];
|
||||
if !(_uniform isequalto "") then {
|
||||
_newPlyr forceadduniform _uniform;
|
||||
};
|
||||
if !(_vest isequalto "") then {
|
||||
_newPlyr addVest _vest;
|
||||
};
|
||||
if !(_bpack isequalto "") then {
|
||||
_newPlyr addBackpack _bpack;
|
||||
};
|
||||
{
|
||||
_x params ["_container","_items"];
|
||||
if !(isnull _container) then {
|
||||
clearitemcargoglobal _container;
|
||||
clearbackpackcargoglobal _container;
|
||||
clearmagazinecargoglobal _container;
|
||||
clearweaponcargoglobal _container;
|
||||
{
|
||||
if (count _x > 2) then {
|
||||
_container addMagazineAmmoCargo _x;
|
||||
}
|
||||
else {
|
||||
if ((_x select 0) isequaltype []) then {
|
||||
_container addWeaponWithAttachmentsCargoGlobal _x;
|
||||
}
|
||||
else {
|
||||
_x params [["_type",""],["_cnt",1]];
|
||||
if !(_cnt isequaltype 1) then {
|
||||
_cnt = 1;
|
||||
};
|
||||
if (_type iskindof "Bag_Base") then {
|
||||
_container addBackpackCargoGlobal [_type,_cnt];
|
||||
}
|
||||
else {
|
||||
_container addItemCargoGlobal [_type,_cnt];
|
||||
};
|
||||
};
|
||||
};
|
||||
} foreach _items;
|
||||
};
|
||||
} foreach [
|
||||
[Uniformcontainer _newPlyr, _uniformitems],
|
||||
[Vestcontainer _newPlyr, _vestitems],
|
||||
[BackpackContainer _newPlyr, _bpackitems]
|
||||
];
|
||||
|
||||
_loadabs = loadabs _newPlyr;
|
||||
if !(uniform _newPlyr isequalto _uniform && vest _newPlyr isequalto _vest && backpack _newPlyr isequalto _bpack) then {
|
||||
diag_log format ["EPOCH Debug: Setunitloadout failed - Unifmorm should: %1 is: %2 - Vest should: %3 is: %4 - Backpack should: %5 is: %6",_uniform,uniform _newPlyr,_vest,vest _newPlyr,_bpack,backpack _newPlyr];
|
||||
_loadabs = -1;
|
||||
};
|
||||
|
||||
_loadabs
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Check
|
||||
|
||||
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_player/EPOCH_server_checkPlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_apperance","_arr","_class","_dead","_deadPlayer","_defaultData","_instanceID","_isMale","_medical","_playerUID","_response","_return","_vars"];
|
||||
//[[[end]]]
|
||||
params [["_playerObj",objNull],["_fsmHandle",0]];
|
||||
if (_playerObj isEqualType objNull) then {
|
||||
if (!isNull _playerObj) then {
|
||||
_playerUID = getPlayerUID _playerObj;
|
||||
if (_playerUID != "") then {
|
||||
|
||||
_response = ["Player", _playerUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
|
||||
_dead = false;
|
||||
_isMale = true;
|
||||
_instanceID = call EPOCH_fn_InstanceID;
|
||||
|
||||
_arr = [];
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_arr = (_response select 1);
|
||||
};
|
||||
|
||||
// empty default data format, if "Player" data format is changed update this array!
|
||||
_defaultData = [[], [], [], [], [], [], [], [], [], [], "", true];
|
||||
|
||||
// If data does not validate against default or is too short, assume player is new or already dead.
|
||||
if !(_arr isEqualTypeParams _defaultData) then {
|
||||
_dead = true;
|
||||
} else {
|
||||
_arr params ["","_medical","_apperance","","_vars"];
|
||||
_class = _apperance param [5, "Epoch_Female_F"];
|
||||
_isMale = (_class == "Epoch_Male_F");
|
||||
_medical params ["","","","_damage",["_hitpoints",[0,0,0,0,0,0,0,0,0,0,0]] ];
|
||||
_deadPlayer = ["PlayerStats", _playerUID, 0] call EPOCH_fnc_server_hiveGETBIT;
|
||||
// check if player is already dead or was critically hit HitHead = 2 or HitBody = 7 and if blood pressure too high.
|
||||
if (_deadPlayer || (_damage == 1) || (_hitpoints select 2 == 1) || (_hitpoints select 7 == 1) || (_vars select 12 >= 180)) then {
|
||||
_dead = true;
|
||||
};
|
||||
};
|
||||
|
||||
/* true => New Char
|
||||
false => load old Char */
|
||||
[_fsmHandle,['_checkPlayer_PVC', _dead]] remoteExecCall ['setFSMVariable', _playerObj];
|
||||
|
||||
if (!_dead) then { //Load old Char
|
||||
[_playerObj, _isMale, _fsmHandle, _arr] call EPOCH_server_loadPlayer;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,143 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Death for use with RemoteExec
|
||||
|
||||
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_player/EPOCH_server_deadPlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_bankBalance","_bankData","_cIndex","_current_crypto","_defaultVars","_playerName","_playerUID","_pos","_response","_triggerType","_vars","_killerUID","_deathType","_killerCommunityStats","_mIndex","_current_murders","_communityStats","_sIndex","_current_suicides","_dIndex","_current_deaths","_playerKarmaAdj","_killerKarmaAdj","_kIndex","_playerCStats","_playerKarma","_playerIsNeutral","_playerIsBandit","_playerIsHero","_killerCStats","_killerKarma","_karmaLimitsArray","_lowKarmaLevel1","_highKarmaLevel1"];
|
||||
//[[[end]]]
|
||||
params ["_playerObj","_killer","_playerName",["_token","",[""]] ];
|
||||
|
||||
// handle token check and isnull for _player
|
||||
if !([_playerObj, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_playerUID = getPlayerUID _playerObj;
|
||||
_killerUID = getPlayerUID _killer;
|
||||
_pos = getposATL _playerObj;
|
||||
|
||||
// find player's Karma status
|
||||
_kIndex = EPOCH_communityStats find "Karma";
|
||||
_playerCStats = _playerObj getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
_playerKarma = _playerCStats select _kIndex;
|
||||
|
||||
// set config karma levels
|
||||
_karmaLimitsArray = EPOCH_communityStatsLimits select _kIndex;
|
||||
_lowKarmaLevel1 = ((_karmaLimitsArray select 2) select 0);
|
||||
_highKarmaLevel1 = ((_karmaLimitsArray select 3) select 0);
|
||||
|
||||
_playerIsNeutral = (_playerKarma < _highKarmaLevel1 && _playerKarma > _lowKarmaLevel1);
|
||||
_playerIsBandit = (_playerKarma <= _lowKarmaLevel1);
|
||||
_playerIsHero = (_playerKarma >= _highKarmaLevel1);
|
||||
|
||||
// default deathType is suicide
|
||||
_deathType = 666;
|
||||
_playerKarmaAdj = -2;
|
||||
|
||||
if (_playerObj != _killer) then {
|
||||
_playerKarmaAdj = -5;
|
||||
if (random 1 <= EPOCH_antagonistChancePDeath) then {
|
||||
_triggerType = 2;
|
||||
if (surfaceIsWater _pos) then {
|
||||
_triggerType = 3;
|
||||
};
|
||||
[_killer, "Sapper"] call EPOCH_server_triggerEvent;
|
||||
};
|
||||
|
||||
// backwards compat for now -
|
||||
if (_playerName isEqualType []) then{
|
||||
_playerName = toString (_playerName);
|
||||
};
|
||||
|
||||
['deathlog', format['%1 (%2) Killed By %3 (%4) with weapon %5 from %6m at %7', _playerName, _playerUID, name _killer, _killerUID, currentWeapon _killer, _playerObj distance _killer, _pos]] call EPOCH_fnc_server_hiveLog;
|
||||
|
||||
// player karma changes
|
||||
if(_playerIsNeutral)then{_playerKarmaAdj = abs((-_playerKarma) * 0.03)};
|
||||
if(_playerIsBandit)then{_playerKarmaAdj = abs((-_playerKarma) * 0.055)};
|
||||
if(_playerIsHero)then{_playerKarmaAdj = abs((-_playerKarma) * 0.025)};
|
||||
_deathType = 0;
|
||||
if!(_killerUID isEqualTo "")then{
|
||||
if !((group _playerObj) isEqualTo (group _killer)) then {
|
||||
[_killer, "Murders", 1, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
|
||||
// find killer's Karma status
|
||||
_killerCStats = _killer getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
_killerKarma = _killerCStats select _kIndex;
|
||||
|
||||
// killer karma changes
|
||||
_killerKarmaAdj = -5;
|
||||
if(_killerKarma < _highKarmaLevel1 && _killerKarma > _lowKarmaLevel1)then{
|
||||
if(_playerIsNeutral)then{_killerKarmaAdj = abs((-_killerKarma) * 0.03) + _playerKarmaAdj};
|
||||
if(_playerIsBandit)then{_killerKarmaAdj = abs((_killerKarma) * 0.05) + _playerKarmaAdj};
|
||||
if(_playerIsHero)then{_killerKarmaAdj = abs((-_killerKarma) * 0.025) + _playerKarmaAdj};
|
||||
};
|
||||
if(_killerKarma <= _lowKarmaLevel1)then{
|
||||
if(_playerIsNeutral)then{_killerKarmaAdj = abs((_killerKarma) * 0.05) + _playerKarmaAdj};
|
||||
if(_playerIsBandit)then{_killerKarmaAdj = abs((-_killerKarma) * 0.15) + _playerKarmaAdj};
|
||||
if(_playerIsHero)then{_killerKarmaAdj = abs((_killerKarma) * 0.15) + _playerKarmaAdj};
|
||||
};
|
||||
if(_killerKarma >= _highKarmaLevel1)then{
|
||||
if(_playerIsNeutral)then{_killerKarmaAdj = abs((-_killerKarma) * 0.10) + _playerKarmaAdj};
|
||||
if(_playerIsBandit)then{_killerKarmaAdj = abs((_killerKarma) * 0.15) + _playerKarmaAdj};
|
||||
if(_playerIsHero)then{_killerKarmaAdj = abs((-_killerKarma) * 0.25) + _playerKarmaAdj};
|
||||
};
|
||||
[_killer, "Karma", _killerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
|
||||
_deathType = 1;
|
||||
};
|
||||
};
|
||||
|
||||
switch(_deathType)do{
|
||||
case 666: {
|
||||
[_playerObj, "Suicides", 1, true] call EPOCH_server_updatePlayerStats;
|
||||
[_playerObj, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
case 1: {
|
||||
[_playerObj, "Deaths", 1, true] call EPOCH_server_updatePlayerStats;
|
||||
[_playerObj, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
case 0: {
|
||||
[_playerObj, "AIDeaths", 1, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
};
|
||||
_defaultVars = call EPOCH_defaultVars_SEPXVar;
|
||||
// get vars array and current Crypto value
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _playerObj getVariable["VARS", _defaultVars];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
|
||||
if (_current_crypto > 0) then{
|
||||
_playerObj setVariable["Crypto", _current_crypto, true];
|
||||
diag_log format["Epoch: ADMIN: Crypto added to dead body for %1 with %2 at %3", getPlayerUID _playerObj, _current_crypto, _pos];
|
||||
};
|
||||
|
||||
// save community stats (skipped in EPOCH_server_savePlayer for dead Players)
|
||||
_stats = _playerObj getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
["CommunityStats", _playerUID, EPOCH_expiresCommunityStats, [_stats]] call EPOCH_fnc_server_hiveSETEX;
|
||||
[_playerObj,_stats] call EPOCH_server_UpdateTopStats;
|
||||
|
||||
[_playerObj, _defaultVars] call EPOCH_server_savePlayer;
|
||||
|
||||
// death cost
|
||||
if (EPOCH_cloneCost > 0) then {
|
||||
_response = ["Bank", _playerUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_bankData = _response select 1;
|
||||
_bankBalance = 0;
|
||||
|
||||
if !(_bankData isEqualTo[]) then {
|
||||
_bankBalance = _bankData select 0;
|
||||
};
|
||||
|
||||
_bankBalance = _bankBalance - EPOCH_cloneCost;
|
||||
["Bank", _playerUID, EPOCH_expiresBank, [_bankBalance]] call EPOCH_fnc_server_hiveSETEX;
|
||||
};
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors: Aaron Clark
|
||||
|
||||
Description:
|
||||
Detonate a boss sapper bomb at player position.
|
||||
|
||||
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_antagonists/EPOCH_server_playerDeathOptions.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_bomb","_pos"];
|
||||
//[[[end]]]
|
||||
params ["_player", "_token"];
|
||||
diag_log format["Epoch: ADMIN: Attempting player detonate on %1.", getPlayerUID _player];
|
||||
if !([_player,_token]call EPOCH_server_getPToken)exitWith{};
|
||||
|
||||
_pos = getPosATL _player;
|
||||
_bomb = createVehicle["Sapper_Charge_Ammo", _pos, [], 0, "CAN_COLLIDE"];
|
||||
_bomb setDamage 1;
|
||||
hideObjectGlobal _player;
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Radio Channel handler
|
||||
|
||||
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_player/EPOCH_server_equippedItem.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_channelID","_config","_selectedChannel"];
|
||||
//[[[end]]]
|
||||
params ["_class","_status","_player"];
|
||||
|
||||
_selectedChannel = EPOCH_customChannels select 0;
|
||||
_config = (configfile >> "CfgWeapons" >> _class);
|
||||
if (isClass(_config)) then {
|
||||
_channelID = getNumber(_config >> "channelID");
|
||||
_selectedChannel = EPOCH_customChannels select _channelID;
|
||||
};
|
||||
|
||||
if (_status) then {
|
||||
{_x radioChannelRemove[_player];} ForEach EPOCH_customChannels;
|
||||
_selectedChannel radioChannelAdd[_player];
|
||||
} else {
|
||||
{_x radioChannelRemove[_player];} ForEach EPOCH_customChannels;
|
||||
};
|
@ -0,0 +1,313 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors: He-Man
|
||||
|
||||
Description:
|
||||
Player Login
|
||||
|
||||
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_player/EPOCH_server_loadPlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_Primary","_CheckLocation","_allGroupMembers","_alreadyDead","_assignedItems","_attachments","_backpack","_backpackItems","_canBeRevived","_class","_communityStats","_communityStatsArray","_currentWeapon","_deadPlayer","_defaultData","_dir","_equipped","_found","_goggles","_group","_handgunWeapon","_headgear","_instanceID","_jammer","_jammers","_linkedItems","_loadout","_location","_newLocation","_newPlyr","_playerData","_playerGroup","_playerGroupArray","_playerNetID","_playerUID","_primaryWeapon","_reject","_secondaryWeapon","_serverSettingsConfig","_type","_uniform","_uniformItems","_vars","_vest","_vestItems","_wMags","_wMagsArray","_weapon"];
|
||||
//[[[end]]]
|
||||
_reject = true;
|
||||
|
||||
params [["_player",objNull,[objNull]],["_isMale",true],["_fsmHandle",0],["_playerData",[]]];
|
||||
|
||||
if (!isNull _player) then {
|
||||
|
||||
// load server settings
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_instanceID = call EPOCH_fn_InstanceID;
|
||||
|
||||
_playerNetID = owner _player;
|
||||
_playerUID = getPlayerUID _player;
|
||||
|
||||
if (_playerUID != "") then {
|
||||
|
||||
if (_playerdata isequalto []) then {
|
||||
// Make Hive call
|
||||
(["Player", _playerUID] call EPOCH_fnc_server_hiveGETRANGE) params [
|
||||
["_status", 0 ],
|
||||
["_playerDataTmp", [] ]
|
||||
];
|
||||
if (_status == 1 && _playerDataTmp isEqualType []) then {
|
||||
_playerData = _playerDataTmp;
|
||||
};
|
||||
};
|
||||
|
||||
// Apperance defaults
|
||||
_uniform = [_serverSettingsConfig, "defaultUniformFemale", "U_Test_uniform"] call EPOCH_fnc_returnConfigEntry;
|
||||
_class = "Epoch_Female_F";
|
||||
_vest = [_serverSettingsConfig, "defaultVestFemale", "V_F41_EPOCH"] call EPOCH_fnc_returnConfigEntry;
|
||||
if (_isMale) then {
|
||||
_uniform = [_serverSettingsConfig, "defaultUniformMale", "U_Test1_uniform"] call EPOCH_fnc_returnConfigEntry;
|
||||
_class = "Epoch_Male_F";
|
||||
_vest = [_serverSettingsConfig, "defaultVestMale", "V_41_EPOCH"] call EPOCH_fnc_returnConfigEntry;
|
||||
};
|
||||
_goggles = [_serverSettingsConfig, "defaultGoggles", ""] call EPOCH_fnc_returnConfigEntry;
|
||||
_headgear = [_serverSettingsConfig, "defaultHeadgear", ""] call EPOCH_fnc_returnConfigEntry;
|
||||
_backpack = [_serverSettingsConfig, "defaultBackpack", ""] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
// Inventory defaults
|
||||
_primaryWeapon = [_serverSettingsConfig, "defaultprimaryWeapon", []] call EPOCH_fnc_returnConfigEntry; // ["arifle_MX_pointer_F","","acc_pointer_IR","",["30Rnd_65x39_caseless_mag",29],[],""];
|
||||
_secondaryWeapon = [_serverSettingsConfig, "defaultsecondaryWeapon", []] call EPOCH_fnc_returnConfigEntry; // ["launch_NLAW_F","","","",["NLAW_F",1],[],""];
|
||||
_handgunWeapon = [_serverSettingsConfig, "defaulthandgunWeapon", []] call EPOCH_fnc_returnConfigEntry; // ["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""];
|
||||
_uniformItems = [_serverSettingsConfig, "defaultuniformItems", []] call EPOCH_fnc_returnConfigEntry; // [["FAK",1],["30Rnd_65x39_caseless_mag",2,30],["Chemlight_green",1,1]];
|
||||
_vestItems = [_serverSettingsConfig, "defaultvestItems", []] call EPOCH_fnc_returnConfigEntry; // [["30Rnd_65x39_caseless_mag",3,30],["16Rnd_9x21_Mag",2,16],["SmokeShell",1,1],["SmokeShellGreen",1,1],["SmokeShellBlue",1,1],["SmokeShellOrange",1,1],["Chemlight_green",1,1]];
|
||||
_backpackItems = [_serverSettingsConfig, "defaultbackpackItems", []] call EPOCH_fnc_returnConfigEntry; // [["Medikit",1],["FAK",10],[["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],1]];
|
||||
_assignedItems = [_serverSettingsConfig, "defaultassignedItems", ["","","","",[],[],""]] call EPOCH_fnc_returnConfigEntry; // ["Rangefinder","","","",[],[],""]
|
||||
_linkedItems = [_serverSettingsConfig, "defaultlinkedItems", ["ItemMap","","EpochRadio0","","",""]] call EPOCH_fnc_returnConfigEntry; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]
|
||||
_currentWeapon = [_serverSettingsConfig, "defaultSelectedWeapon", ""] call EPOCH_fnc_returnConfigEntry; // class of selected weapon
|
||||
|
||||
_loadout = [
|
||||
_primaryWeapon,
|
||||
_secondaryWeapon,
|
||||
_handgunWeapon,
|
||||
[_uniform,_uniformItems],
|
||||
[_vest,_vestItems],
|
||||
[_backpack,_backpackItems],
|
||||
_headgear,
|
||||
_goggles,
|
||||
_assignedItems,
|
||||
_linkedItems
|
||||
];
|
||||
|
||||
// default data, if "Player" data format is changed update this array!
|
||||
_defaultData = [[0, [], _instanceID, 1.0], [0, 0, 1, 0, [0,0,0,0,0,0,0,0,0,0,0]], ["", "", "", "", _currentWeapon, _class], [], call EPOCH_defaultVars_SEPXVar, _loadout, [], [], [], [], "", true];
|
||||
|
||||
// If data does not validate against default or is too short, override with default data.
|
||||
if !(_playerData isEqualTypeParams _defaultData) then {
|
||||
diag_log format["DEBUG: Invaild player data %1, defaults used instead.", _playerData];
|
||||
_playerData = _defaultData;
|
||||
};
|
||||
|
||||
_playerData params ["_worldspace","_medical","","_server_vars","_vars","","","","","","_playerGroup","_canBeRevived"];
|
||||
|
||||
// Load world space and previous instance id
|
||||
_worldspace params ["_dir","_location","_prevInstance",["_schemaVersion",0.5]];
|
||||
|
||||
if (count _location == 2) then{
|
||||
_location = (_location select 0) vectorAdd (_location select 1);
|
||||
};
|
||||
|
||||
// Get player group
|
||||
_playerGroupArray = [];
|
||||
// check players group
|
||||
if (_playerGroup != "") then {
|
||||
_found = false;
|
||||
(["Group", _playerGroup] call EPOCH_fnc_server_hiveGETRANGE) params [
|
||||
["_status", 0 ],
|
||||
["_playerGroupArrayTmp", [] ]
|
||||
];
|
||||
if (_status == 1 && !(_playerGroupArrayTmp isEqualTo[])) then {
|
||||
_playerGroupArrayTmp params ["","","","_modArray","_memberArray"];
|
||||
_found = _playerGroup == _playerUID;
|
||||
if (!_found) then {
|
||||
_allGroupMembers = (_modArray + _memberArray) apply {_x select 0};
|
||||
_found = _playerUID in _allGroupMembers;
|
||||
};
|
||||
if (_found) then {
|
||||
_playerGroupArray = _playerGroupArrayTmp;
|
||||
};
|
||||
};
|
||||
if (!_found) then {
|
||||
_playerGroup = "";
|
||||
};
|
||||
// diag_log format["DEBUG (Load Player) Set Group: %1", _playerGroup];
|
||||
};
|
||||
|
||||
_medical params ["_bleedingRemaining","_fatigue","_oxygenRemaining","_damage",["_hitpoints",[0,0,0,0,0,0,0,0,0,0,0]] ];
|
||||
|
||||
_deadPlayer = ["PlayerStats", _playerUID, 0] call EPOCH_fnc_server_hiveGETBIT;
|
||||
|
||||
// check if player is already dead or was critically hit HitHead = 2 or HitBody = 7 and if blood pressure too high.
|
||||
_alreadyDead = (_deadPlayer || (_damage == 1) || (_hitpoints select 2 == 1) || (_hitpoints select 7 == 1) || (_vars select 12 >= 180));
|
||||
|
||||
if (_alreadyDead || _prevInstance != _instanceID || (count _location) < 3 || !(_location isEqualType [])) then {
|
||||
// reset hitpoints
|
||||
_hitpoints = [0,0,0,0,0,0,0,0,0,0,0];
|
||||
_dir = random 360;
|
||||
// try to find respawn point by position
|
||||
_newLocation = _server_vars param [0,[]]; // 0 = RESPAWN POS
|
||||
// normal respawn location
|
||||
_location = getMarkerPos "respawn_west";
|
||||
_location set[2, 0];
|
||||
if (_location isEqualTo [0,0,0]) then {
|
||||
_location set [2, 10];
|
||||
if (surfaceiswater _location) then {
|
||||
_location = asltoatl _location;
|
||||
};
|
||||
};
|
||||
if (_newLocation isEqualType [] && {(count _newLocation) == 3}) then {
|
||||
_CheckLocation = _newLocation;
|
||||
if (surfaceiswater _newLocation) then {
|
||||
_CheckLocation = ATLToASL _newLocation;
|
||||
};
|
||||
_jammers = nearestObjects[_CheckLocation, call EPOCH_JammerClasses, 6];
|
||||
if !(_jammers isEqualTo[]) then {
|
||||
// get nearby object
|
||||
_jammer = _jammers param [0,objNull];
|
||||
// check if object is not null and is alive.
|
||||
if (!isNull _jammer && {alive _jammer}) then {
|
||||
// check if player is still a member of object group.
|
||||
if ((_jammer getVariable["BUILD_OWNER", "-1"]) in [_playerUID, _playerGroup]) then {
|
||||
// Override location with that of object
|
||||
_location = _newLocation;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_alreadyDead) then {
|
||||
_vars = call EPOCH_defaultVars_SEPXVar;
|
||||
_canBeRevived = true;
|
||||
};
|
||||
};
|
||||
|
||||
_group = grpNull;
|
||||
|
||||
// find existing group
|
||||
if (_playerGroup != "") then {
|
||||
{
|
||||
if ((_x getVariable["GROUP", ""]) == _playerGroup) exitWith{
|
||||
_group = group _x;
|
||||
};
|
||||
} forEach (allPlayers select {alive _x});
|
||||
};
|
||||
|
||||
if (isNull _group) then {
|
||||
_group = createGroup [west, true];
|
||||
};
|
||||
_spawnpos = getMarkerPos "respawn_west";
|
||||
_spawnpos set[2, 0];
|
||||
if (_spawnpos isEqualTo [0,0,0]) then {
|
||||
_spawnpos set [2, 10];
|
||||
if (surfaceiswater _spawnpos) then {
|
||||
_spawnpos = asltoatl _spawnpos;
|
||||
};
|
||||
};
|
||||
_newPlyr = _group createUnit[_class, _spawnpos, [], 0, "CAN_COLLIDE"];
|
||||
_newPlyr setposatl _spawnpos;
|
||||
_newPlyr hideobjectglobal true;
|
||||
if !(isNull _newPlyr) then {
|
||||
|
||||
// disable AI on temp unit
|
||||
_newPlyr disableAI "ALL";
|
||||
|
||||
if (!_alreadyDead) then {
|
||||
// Medical
|
||||
_newPlyr setBleedingRemaining _bleedingRemaining;
|
||||
// _newPlyr setFatigue _fatigue;
|
||||
_newPlyr setOxygenRemaining _oxygenRemaining;
|
||||
_newPlyr setDamage _damage;
|
||||
} else {
|
||||
// player dead use default Data for appearance and loadout data
|
||||
_playerData = _defaultData;
|
||||
};
|
||||
|
||||
// disable further damage server side
|
||||
_newPlyr allowDamage false;
|
||||
|
||||
// set player loadout
|
||||
_playerData params ["","","_appearance","","","_loadout"];
|
||||
// get current weapon to send to param for selectWeapon
|
||||
_currentWeapon = _appearance param [4,""];
|
||||
// _newPlyr setUnitLoadout [_loadout, false];
|
||||
|
||||
// Workaround for Client / Server synchronizing issue in SetUnitLoadout
|
||||
_loadabs = [_newPlyr,_loadout] call Epoch_server_SetUnitLoadout;
|
||||
if (_loadabs isequalto -1) then {
|
||||
deleteVehicle _newPlyr;
|
||||
};
|
||||
|
||||
// Final Push
|
||||
if (isNull _player) then {
|
||||
deleteVehicle _newPlyr;
|
||||
diag_log "Epoch: DEBUG: _player object was null reject connection";
|
||||
} else {
|
||||
|
||||
// add to cleanup
|
||||
addToRemainsCollector[_newPlyr];
|
||||
|
||||
_reject = false;
|
||||
|
||||
if (_playerGroup != "") then {
|
||||
_newPlyr setVariable["GROUP", _playerGroup];
|
||||
};
|
||||
|
||||
_newPlyr setVariable["PUID", _playerUID];
|
||||
|
||||
if !(_vars isEqualTo[]) then {
|
||||
_newPlyr setVariable["VARS", _vars];
|
||||
};
|
||||
|
||||
if !(_server_vars isEqualTo[]) then{
|
||||
_newPlyr setVariable["SERVER_VARS", _server_vars];
|
||||
};
|
||||
|
||||
if (!_canBeRevived) then {
|
||||
_newPlyr setVariable["REVIVE", _canBeRevived];
|
||||
};
|
||||
|
||||
// load community stats
|
||||
_communityStatsArray = ["CommunityStats", _playerUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
_communityStats = (_communityStatsArray param [1,[]]) param [0,[]];
|
||||
if (_communityStats isEqualTo []) then {
|
||||
_communityStats = EPOCH_defaultStatVars;
|
||||
};
|
||||
if (count _communityStats < EPOCH_communityStatsCount) then {
|
||||
{
|
||||
private _check = _communityStats select _foreachindex;
|
||||
if (isnil '_check') then {
|
||||
_communityStats pushback _x;
|
||||
};
|
||||
} foreach EPOCH_defaultStatVars;
|
||||
};
|
||||
_Index = EPOCH_communityStats find "ConnectCount";
|
||||
if (_Index > -1) then {
|
||||
_currentStat = _communityStats select _Index;
|
||||
_communityStats set[_Index, _currentStat + 1];
|
||||
};
|
||||
_Index = EPOCH_communityStats find "PlayTime";
|
||||
if (_Index > -1) then {
|
||||
_currentStat = _communityStats select _Index;
|
||||
_newPlyr setVariable["EPOCH_playerPlayTime", _currentStat, true];
|
||||
};
|
||||
|
||||
_newPlyr setVariable["COMMUNITY_STATS", _communityStats];
|
||||
|
||||
// Flag new body as ready for use.
|
||||
_newPlyr setVariable["FinalDest", [_location,_dir], true];
|
||||
|
||||
// Send message to player so they can take over the new body.
|
||||
[_playerNetID, _playerUID, [_newPlyr, _vars, _currentWeapon, _loadabs, _playerGroup, _canBeRevived, _newPlyr call EPOCH_server_setPToken,_playerGroupArray, _communityStats, _hitpoints], _fsmHandle, _player] call EPOCH_server_pushPlayer;
|
||||
|
||||
// revive test
|
||||
_newPlyr setVariable ['#rev_enabled', true, true];
|
||||
// [] remoteExec ["bis_fnc_reviveInit",_player];
|
||||
|
||||
// new Dynamicsimulation
|
||||
if([configFile >> "CfgEpochServer", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then
|
||||
{
|
||||
_newPlyr enableDynamicSimulation true;
|
||||
_newPlyr triggerDynamicSimulation true;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
diag_log format["LOGIN FAILED UNIT NULL: %1 [%2|%3]", _player, _group, count allgroups];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
if (_reject) then {
|
||||
diag_log format ["DEBUG PLAYER NOT SETUP OR INVAILD: %1", _player];
|
||||
true remoteExec ['EPOCH_client_rejectPlayer',_player];
|
||||
};
|
||||
|
||||
true
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Select spawn point
|
||||
|
||||
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_player/EPOCH_server_selectSpawnpoint.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_currentPos","_server_vars"];
|
||||
//[[[end]]]
|
||||
params [["_jammer",objNull],["_player",objNull],["_token",""]];
|
||||
// check token
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
// require object
|
||||
if (isNull _jammer) exitWith {};
|
||||
// reject if player is too far away
|
||||
if (_player distance _jammer > 20) exitWith{};
|
||||
// check if in group with owner
|
||||
if (alive _jammer) then {
|
||||
if ((_jammer getVariable["BUILD_OWNER", "-1"]) in [getPlayerUID _player, _player getVariable["GROUP", ""]]) then {
|
||||
_server_vars = _player getVariable["SERVER_VARS", []];
|
||||
_currentPos = _server_vars param [0,[]];
|
||||
// invalidate previous position
|
||||
if (!(_currentPos isequaltype [])) then {
|
||||
_currentPos = [];
|
||||
};
|
||||
if (!(_currentPos isEqualTo []) && {_jammer distance _currentPos > 20}) then { _currentPos = [] };
|
||||
if (_currentPos isEqualTo []) then {
|
||||
// set position of spawnpoint to players SERVER_VARS
|
||||
_server_vars set [0, getposATL _player]; // 0 = RESPAWN POS
|
||||
_player setVariable ["SERVER_VARS", _server_vars];
|
||||
[_player, _player getVariable["VARS", []]] call EPOCH_server_savePlayer;
|
||||
["Spawnpoint set", 5] remoteExec ['Epoch_message',_player];
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove position of spawnpoint from players SERVER_VARS
|
||||
_server_vars set [0, []]; // 0 = RESPAWN POS
|
||||
_player setVariable ["SERVER_VARS", _server_vars];
|
||||
[_player, _player getVariable["VARS", []]] call EPOCH_server_savePlayer;
|
||||
["Spawnpoint removed", 5] remoteExec ['Epoch_message',_player];
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
["This is not one of your Group's Jammers", 5] remoteExec ['Epoch_message',_player];
|
||||
};
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Disconnect
|
||||
|
||||
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_player/EPOCH_server_onPlayerDisconnect.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_return"];
|
||||
//[[[end]]]
|
||||
params ["_player","_id","_uid","_name"];
|
||||
_return = false;
|
||||
if (!isNull _player) then {
|
||||
if (_player getVariable["SETUP", false]) then {
|
||||
[_player, _player getVariable["VARS", []] ] call EPOCH_server_savePlayer;
|
||||
if (alive _player) then {
|
||||
_player setVariable ["VARS", nil];
|
||||
deleteVehicle _player;
|
||||
};
|
||||
} else {
|
||||
deleteVehicle _player;
|
||||
};
|
||||
};
|
||||
// Delete any left over units with same PUID
|
||||
{
|
||||
deleteVehicle _x;
|
||||
} forEach (allUnits select {_x getVariable["PUID", "0"] == _uid});
|
||||
_uid call EPOCH_server_disconnect;
|
||||
['Disconnected', [_uid, _name]] call EPOCH_fnc_server_hiveLog;
|
||||
_return
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Call setVariable on specific client.
|
||||
|
||||
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_antagonists/EPOCH_server_playerSetVariable.sqf
|
||||
*/
|
||||
params ["_player","_token","_obj", "_var", "_value", "_local"];
|
||||
if !([_player,_token]call EPOCH_server_getPToken)exitWith{};
|
||||
diag_log format["Epoch: ADMIN: Attempting Set variable [%2,%3,%4] on %1.", _obj, _var, _value,_local];
|
||||
[_obj, _var,_value,_local] remoteExec ['EPOCH_fnc_playerSetVariable', _obj];
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Respawn (unused)
|
||||
|
||||
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_player/EPOCH_server_respawnPlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_class","_defaultUniform","_dir","_location","_vest"];
|
||||
//[[[end]]]
|
||||
params ["_player",["_token","",[""]],"_isMale"];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_defaultUniform = "U_Test_uniform";
|
||||
_class = "Epoch_Female_F";
|
||||
_vest = "V_F41_EPOCH";
|
||||
if (_isMale) then {
|
||||
_defaultUniform = "U_Test1_uniform";
|
||||
_class = "Epoch_Male_F";
|
||||
_vest = "V_41_EPOCH";
|
||||
};
|
||||
|
||||
_dir = random 360;
|
||||
_location = getMarkerPos "respawn_west";
|
||||
_location set[2, 0];
|
||||
|
||||
_player = (group _player) createUnit [_class, _location, [], 0, "CAN_COLLIDE"];
|
||||
_player disableAI "ALL";
|
||||
|
||||
_player setDir _dir;
|
||||
_player setPosATL _location;
|
||||
|
||||
// send player object to player
|
||||
["_switchPlayer_PVC",_player] remoteExec ['EPOCH_playerGenderInit',_player];
|
||||
|
||||
_player setVariable ["REVIVE", true];
|
||||
true
|
@ -0,0 +1,179 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors: He-Man
|
||||
|
||||
Description:
|
||||
Player Revive
|
||||
|
||||
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_player/EPOCH_server_revivePlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_caller","_loadabs","_loadout","_CorpseCrypto","_PlayerCrypto","_attachments","_cIndex","_class","_currwh","_deleteprimary","_deletesecondary","_dir","_droppedPrimary","_droppedSecondary","_droppedWeapons","_equipped","_group","_garbage","_location","_newPlyr","_playerGroup","_playerUID","_token","_type","_vars","_wMags","_wMagsArray","_weapon","_wh","_kIndex","_reviver","_reviverCStats","_reviverKarma","_reviverKarmaAdj"];
|
||||
//[[[end]]]
|
||||
params ["_player","_reviver",["_token","",[""]] ];
|
||||
_caller = if (remoteExecutedOwner == (owner _reviver)) then {_reviver} else {_player};
|
||||
if !([_caller, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _player) exitWith{};
|
||||
if !(isplayer _reviver) exitWith{};
|
||||
if (_player distance _reviver > 20) exitWith{};
|
||||
|
||||
if (!local _player) then {
|
||||
_playerUID = getPlayerUID _player;
|
||||
if (!isNil "_playerUID" && !alive _player) then {
|
||||
|
||||
if (_player == _reviver) exitWith {
|
||||
'epochserver' callExtension format['820|%1|EpochMod.com Autoban #R1',getPlayerUID _reviver];
|
||||
['ahb', format['%1 (%2): Tried to Revive yourself (%3)', name _reviver, getPlayerUID _reviver, _this]] call EPOCH_fnc_server_hiveLog;
|
||||
};
|
||||
|
||||
_class = typeOf _player;
|
||||
|
||||
if (_class in ["Epoch_Male_F", "Epoch_Female_F"]) then {
|
||||
|
||||
if (_player getVariable["REVIVE", true]) then {
|
||||
if (_player getvariable ['Reviving', false]) exitwith {
|
||||
diag_log format['DEBUG Reviving skipped - Player already reviving : %1', _this];
|
||||
};
|
||||
_player setvariable ['Reviving',true];
|
||||
|
||||
diag_log format["DEBUG server_revivePlayer : %1", _this];
|
||||
|
||||
_location = getPosATL _player;
|
||||
_dir = getDir _player;
|
||||
_playerGroup = _player getVariable["GROUP", ""];
|
||||
|
||||
// Load Inventory
|
||||
_loadout = getUnitLoadout _player;
|
||||
|
||||
_wh = nearestObjects[_player, ["WeaponHolderSimulated"], 12];
|
||||
_droppedPrimary = [];
|
||||
_droppedSecondary = [];
|
||||
_deleteprimary = [];
|
||||
_deletesecondary = [];
|
||||
reverse _wh;
|
||||
{
|
||||
_currwh = _x;
|
||||
{
|
||||
_type = getNumber(configfile >> "cfgweapons" >> (_x select 0) >> "type");
|
||||
switch _type do {
|
||||
case 1: {_droppedPrimary = _x; _deleteprimary = [_currwh]};
|
||||
case 4: {_droppedSecondary = _x; _deletesecondary = [_currwh]};
|
||||
};
|
||||
} forEach (weaponsItemsCargo _x);
|
||||
} foreach _wh;
|
||||
{
|
||||
if (!isnull _x) then {deletevehicle _x};
|
||||
} foreach (_deleteprimary+_deletesecondary);
|
||||
if (count _droppedPrimary == 6) then {
|
||||
_droppedPrimary set [6,_droppedPrimary select 5];
|
||||
_droppedPrimary set [5,[]];
|
||||
|
||||
};
|
||||
if (count _droppedSecondary == 6) then {
|
||||
_droppedSecondary set [6,_droppedSecondary select 5];
|
||||
_droppedSecondary set [5,[]];
|
||||
};
|
||||
|
||||
hideObjectGlobal _player;
|
||||
|
||||
// create new player unit change this class later
|
||||
_group = grpNull;
|
||||
if (_playerGroup != "") then {
|
||||
{
|
||||
if ((_x getVariable["GROUP",""]) == _playerGroup) exitWith {
|
||||
_group = group _x;
|
||||
};
|
||||
}forEach (allPlayers select {alive _x});
|
||||
|
||||
if (isNull _group) then {
|
||||
_group = createGroup [west, true];
|
||||
};
|
||||
|
||||
diag_log format["DEBUG Group Found: %1", _group];
|
||||
} else {
|
||||
_group = createGroup [west, true];
|
||||
diag_log format["DEBUG Group Created: %1", _group];
|
||||
};
|
||||
|
||||
_newPlyr = _group createUnit[_class, _location, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
// new Dynamicsimulation
|
||||
if([configFile >> "CfgEpochServer", "playerDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry)then
|
||||
{
|
||||
_newPlyr enableDynamicSimulation true;
|
||||
_newPlyr triggerDynamicSimulation true;
|
||||
};
|
||||
|
||||
addToRemainsCollector[_newPlyr];
|
||||
|
||||
_newPlyr disableAI "ALL";
|
||||
|
||||
_newPlyr setVariable ["SETUP", true];
|
||||
_newPlyr setVariable ["PUID", _playerUID];
|
||||
_newPlyr setVariable ["GROUP", _playerGroup];
|
||||
_newPlyr setVariable ["REVIVE", false];
|
||||
_newPlyr setVariable ["SERVER_VARS",_player getVariable ["SERVER_VARS",[]]];
|
||||
_newPlyr setVariable ["EPOCH_playerPlayTime",_player getvariable ["EPOCH_playerPlayTime",0],true];
|
||||
|
||||
// _player playActionNow "Die";
|
||||
|
||||
_newPlyr setDir _dir;
|
||||
_newPlyr setPosATL _location;
|
||||
|
||||
// Medical
|
||||
_newPlyr setFatigue 1;
|
||||
_newPlyr setDamage 0.25;
|
||||
|
||||
// Add inventory
|
||||
_loadout set [0,_droppedPrimary];
|
||||
_loadout set [1,_droppedSecondary];
|
||||
// _newPlyr setUnitLoadout [_loadout, false];
|
||||
|
||||
// Workaround for Client / Server synchronizing issue in SetUnitLoadout
|
||||
_loadabs = [_newPlyr,_loadout] call Epoch_server_SetUnitLoadout;
|
||||
if (_loadabs isequalto -1) exitwith {
|
||||
removeFromRemainsCollector [_newPlyr];
|
||||
deletevehicle _newPlyr;
|
||||
_player setvariable ['Reviving',false];
|
||||
_player hideObjectGlobal false;
|
||||
};
|
||||
|
||||
_garbage = createVehicle [selectrandom ["MedicalGarbage_01_1x1_v1_F","MedicalGarbage_01_1x1_v3_F","MedicalGarbage_01_1x1_v2_F"], _location, [], 0, "CAN_COLLIDE"];
|
||||
EPOCH_cleanupQueue pushBack _garbage;
|
||||
|
||||
// Final Push
|
||||
_token = _newPlyr call EPOCH_server_setPToken;
|
||||
|
||||
_CorpseCrypto = _player getVariable['Crypto', 0];
|
||||
if (_CorpseCrypto > 0) then {
|
||||
_cIndex = EPOCH_customVars find 'Crypto';
|
||||
_vars = _player getVariable['VARS', call EPOCH_defaultVars_SEPXVar];
|
||||
_PlayerCrypto = _CorpseCrypto;
|
||||
_PlayerCrypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
_vars set[_cIndex, _PlayerCrypto];
|
||||
_newPlyr setVariable['VARS', _vars];
|
||||
};
|
||||
_newPlyr setvariable ["COMMUNITY_STATS",_player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars]];
|
||||
|
||||
// send to player
|
||||
[_newPlyr, _token, _loadabs] remoteExec ['EPOCH_clientRevive',_player];
|
||||
|
||||
// send stat to reviver
|
||||
[_reviver, "Revives", 1, true] call EPOCH_server_updatePlayerStats;
|
||||
|
||||
// send karma stat to reviver
|
||||
_kIndex = EPOCH_communityStats find "Karma";
|
||||
_reviverCStats = _reviver getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
_reviverKarma = _reviverCStats select _kIndex;
|
||||
_reviverKarmaAdj = 5;
|
||||
if(_reviverKarma < 0)then{_reviverKarmaAdj = -5};
|
||||
[_reviver, "Karma", _reviverKarmaAdj, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Save
|
||||
|
||||
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_player/EPOCH_server_savePlayer.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_Svars","_allowSave","_appearance","_bloodPIndex","_bloodPressure","_group","_hitpoints","_loadout","_medical","_playerUID","_pos","_return","_return2","_revive","_schemaVersion","_server_vars","_stats","_vehiclePlyr"];
|
||||
//[[[end]]]
|
||||
params [["_player",objNull], ["_vars",[]] ];
|
||||
|
||||
if (isNull _player) exitWith {
|
||||
diag_log "DEBUG SAVE ABORT null player object";
|
||||
};
|
||||
|
||||
if !(_player getVariable ["SETUP", false]) exitWith {
|
||||
diag_log format ["DEBUG SAVE ABORT not setup: %1", _player]
|
||||
};
|
||||
|
||||
_playerUID = _player getVariable ["PUID", ""]; // getPlayerUID _player
|
||||
if (_playerUID == "") exitWith {
|
||||
diag_log format ["DEBUG SAVE ABORT %1", _playerUID]
|
||||
};
|
||||
|
||||
if !(alive _player) exitWith{
|
||||
// Dead Stat bit index 0
|
||||
_return = ["PlayerStats", _playerUID, 0, 1] call EPOCH_fnc_server_hiveSETBIT;
|
||||
};
|
||||
|
||||
// add vehicle to update queue
|
||||
_vehiclePlyr = vehicle _player;
|
||||
if (_vehiclePlyr != _player) then {
|
||||
EPOCH_saveVehQueue pushBackUnique _vehiclePlyr;
|
||||
};
|
||||
|
||||
_allowSave = _vars isEqualTypeParams EPOCH_defaultVars;
|
||||
if (_allowSave) then{
|
||||
|
||||
if !(_vars isEqualTo (call EPOCH_defaultVars_SEPXVar)) then{
|
||||
private _serverOnly = ["Crypto"];
|
||||
_Svars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
{
|
||||
private _cIndex = EPOCH_customVars find _x;
|
||||
if (_cIndex != -1) then{
|
||||
_vars set[_cIndex, (_Svars select _cIndex)];
|
||||
};
|
||||
} forEach _serverOnly;
|
||||
};
|
||||
_player setVariable ["VARS", _vars];
|
||||
|
||||
/* SERVER_VARS INUSE INDEX:
|
||||
0 = RESPAWN POS
|
||||
*/
|
||||
_server_vars = _player getVariable["SERVER_VARS", []];
|
||||
|
||||
_group = _player getVariable ["GROUP", ""];
|
||||
_revive = _player getVariable ["REVIVE", true];
|
||||
|
||||
_pos = (getposATL _player call EPOCH_precisionPos);
|
||||
|
||||
if (vehicle _player != _player) then {
|
||||
|
||||
private _staticTraderLocationsDistances = [];
|
||||
{
|
||||
_staticTraderLocationsDistances pushBack [_x distance _player, _x]
|
||||
} forEach EPOCH_staticTraderLocations;
|
||||
|
||||
if !(_staticTraderLocationsDistances isEqualTo []) then{
|
||||
_staticTraderLocationsDistances sort true;
|
||||
_pos = _staticTraderLocationsDistances select 0 select 1;
|
||||
_pos set[2, 0];
|
||||
};
|
||||
};
|
||||
|
||||
// get players hitpoint damage
|
||||
_hitpoints = (getAllHitPointsDamage _player) param [2,[]];
|
||||
|
||||
// build medical array
|
||||
_medical = [getBleedingRemaining _player, 0, getOxygenRemaining _player, damage _player, _hitpoints];
|
||||
|
||||
// appearance now handled with getUnitLoadout, typeof is still needed to determine players class.
|
||||
_appearance = ["", "", "", "", currentWeapon _player, typeOf _player];
|
||||
|
||||
// new save format
|
||||
_loadout = getUnitLoadout _player;
|
||||
|
||||
// change this if needed
|
||||
_schemaVersion = 1.0;
|
||||
|
||||
// Finally check, if Loadout is a valid Array (will never return an empty Array on units!)
|
||||
if !(_loadout isequalto []) then {
|
||||
// save player
|
||||
_return = ["Player", _playerUID, EPOCH_expiresPlayer, [[getDir _player, _pos, (call EPOCH_fn_InstanceID), _schemaVersion], _medical, _appearance, _server_vars, _vars, _loadout, [], [], [], [], _group, _revive]] call EPOCH_fnc_server_hiveSETEX;
|
||||
};
|
||||
// save community stats
|
||||
_stats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
_return2 = ["CommunityStats", _playerUID, EPOCH_expiresCommunityStats, [_stats]] call EPOCH_fnc_server_hiveSETEX;
|
||||
|
||||
// blood pressure must stay within 11-179 range
|
||||
_bloodPIndex = EPOCH_customVars find "BloodP";
|
||||
_bloodPressure = _vars param [_bloodPIndex,100];
|
||||
if (_bloodPressure >= 180 || _bloodPressure <= 10) then {
|
||||
_player setDamage 1;
|
||||
["PlayerStats", _playerUID, 0, 1] call EPOCH_fnc_server_hiveSETBIT;
|
||||
} else {
|
||||
// set player alive bit
|
||||
["PlayerStats", _playerUID, 0, 0] call EPOCH_fnc_server_hiveSETBIT;
|
||||
};
|
||||
};
|
@ -0,0 +1,118 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Player Bank
|
||||
|
||||
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_player/EPOCH_server_storeCrypto.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_bankBalance","_bankBalanceBefore","_bankData","_cIndex","_current_crypto","_playerCryptoLimit","_playerUID","_response","_return","_transferAmountIn","_transferAmountOut","_transferBalance","_transferBankBalance","_transferBankBalanceBefore","_transferBankData","_transferResponse","_transferTarget","_transferTargetUID","_vars"];
|
||||
//[[[end]]]
|
||||
params ["_player","_tradeArray",["_token","",[""]] ];
|
||||
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
|
||||
_playerUID = getPlayerUID _player;
|
||||
|
||||
// load players account
|
||||
_response = ["Bank", _playerUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
|
||||
_bankData = _response select 1;
|
||||
_bankBalance = 0;
|
||||
_bankBalanceBefore = 0;
|
||||
if !(_bankData isEqualTo[]) then {
|
||||
_bankBalance = _bankData select 0;
|
||||
_bankBalanceBefore = _bankBalance;
|
||||
};
|
||||
|
||||
// return balance to player
|
||||
if (_tradeArray isEqualTo[]) then {
|
||||
[["bankBalance", _bankBalance], _player] call EPOCH_sendRemoteExecClient;
|
||||
} else {
|
||||
|
||||
// Transaction Data - TODO add check for validity of transaction
|
||||
_transferAmountIn = _tradeArray select 0;
|
||||
_transferAmountOut = _tradeArray select 1;
|
||||
|
||||
// Send to another player
|
||||
_transferBalance = _tradeArray select 2 select 0;
|
||||
_transferTarget = objectFromNetId (_tradeArray select 2 select 1);
|
||||
|
||||
// get vars array and current Crypto value
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
|
||||
// Make Transaction
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
|
||||
if (_transferAmountIn > 0) then {
|
||||
if (_current_crypto >= _transferAmountIn) then {
|
||||
_bankBalance = _bankBalance + _transferAmountIn;
|
||||
_current_crypto = ((_current_crypto - _transferAmountIn) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable["VARS", _vars];
|
||||
};
|
||||
};
|
||||
|
||||
if (_transferAmountOut > 0) then {
|
||||
if (_bankBalance >= _transferAmountOut) then {
|
||||
_bankBalance = _bankBalance - _transferAmountOut;
|
||||
_current_crypto = ((_current_crypto + _transferAmountOut) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
// send to player
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable["VARS", _vars];
|
||||
};
|
||||
};
|
||||
|
||||
// send money to another players account
|
||||
if (!(isNull _transferTarget) && _bankBalance >= _transferBalance) then {
|
||||
|
||||
if (_transferBalance > 0) then {
|
||||
|
||||
_transferTargetUID = getPlayerUID _transferTarget;
|
||||
_transferResponse = ["Bank", _transferTargetUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
|
||||
if ((_transferResponse select 0) == 1 && (_transferResponse select 1) isEqualType []) then {
|
||||
|
||||
_transferBankData = _transferResponse select 1;
|
||||
_transferBankBalance = 0;
|
||||
_transferBankBalanceBefore = 0;
|
||||
|
||||
if !(_transferBankData isEqualTo[]) then {
|
||||
_transferBankBalance = _transferBankData select 0;
|
||||
_transferBankBalanceBefore = _transferBankBalance;
|
||||
};
|
||||
|
||||
// take from player
|
||||
_bankBalance = _bankBalance - _transferBalance;
|
||||
|
||||
// give to player
|
||||
_transferBankBalance = _transferBankBalance + _transferBalance;
|
||||
|
||||
if (_transferBankBalanceBefore != _transferBankBalance) then {
|
||||
_return = ["Bank", _transferTargetUID, EPOCH_expiresPlayer, [_transferBankBalance]] call EPOCH_fnc_server_hiveSETEX;
|
||||
[["bankBalance", _transferBankBalance], _transferTarget] call EPOCH_sendRemoteExecClient;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_bankBalanceBefore != _bankBalance) then {
|
||||
_return = ["Bank", _playerUID, EPOCH_expiresBank, [_bankBalance]] call EPOCH_fnc_server_hiveSETEX;
|
||||
};
|
||||
};
|
||||
};
|
||||
diag_log format["Epoch: BANK - %1 (%2) TRADE: %3", _player, _playerUID, _tradeArray];
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Unpack backpack
|
||||
|
||||
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_player/EPOCH_server_unpackBackpack.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_nearByHolder","_wH","_wHPos"];
|
||||
//[[[end]]]
|
||||
params ["_item","_player",["_token","",[""]] ];
|
||||
|
||||
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
||||
if (_item isKindOf "Bag_Base") then {
|
||||
_wH = objNull;
|
||||
_nearByHolder = nearestObjects [_player,["groundWeaponHolder"],3];
|
||||
if (_nearByHolder isEqualTo []) then {
|
||||
_wHPos = _player modelToWorld [0,1,0];
|
||||
if (surfaceIsWater _wHPos) then {
|
||||
_wHPos = ASLToATL _wHPos;
|
||||
};
|
||||
_wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"];
|
||||
} else {
|
||||
_wH = _nearByHolder select 0;
|
||||
};
|
||||
_wH addBackpackCargoGlobal [_item,1];
|
||||
};
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
|
||||
Author: DirtySanchez - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Save player community stats - default server only update, _this select 3 = true will send stat update to client
|
||||
|
||||
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_player/EPOCH_server_updatePlayerStats.sqf
|
||||
|
||||
usage:
|
||||
|
||||
example 1:
|
||||
[_playerObj, "AIKills", 1] call Epoch_server_updatePlayerStats;
|
||||
|
||||
usage example
|
||||
[_playerObj, _statType, _adjust, true] call Epoch_server_updatePlayerStats;
|
||||
|
||||
_playerObj - OBJECT: the player object to receive the stat adjust and send to database/player
|
||||
|
||||
_statType - STRING: the name of the variable as set in the EpochClientConfig defineCommunityStats[] = {};
|
||||
|
||||
_adjust - NUMBER: set the positive or negative adjustment, a value of 0 will exit the script
|
||||
|
||||
_toClient - BOOLEAN: (OPTIONAL) by default this script is server side variables/hive changes only.
|
||||
by setting this true the client will receive the stat update.
|
||||
Use true when the stat change originates from the server and not the client.
|
||||
*/
|
||||
params [ ["_playerObj",objNull], ["_statType",""], ["_adjust",0], ["_toClient",false], ["_isTotal",false]];
|
||||
|
||||
if(isNull _playerObj)exitWith{
|
||||
diag_log "EPOCHDebug: playerUpdateStats -1- player is null object";
|
||||
};
|
||||
if(_statType isEqualTo "")exitWith{
|
||||
diag_log "EPOCHDebug: playerUpdateStats -2- stat type not defined";
|
||||
};
|
||||
if(_adjust isEqualTo 0 && !_isTotal)exitWith{
|
||||
diag_log "EPOCHDebug: playerUpdateStats -3- stat adjustment is 0";
|
||||
};
|
||||
_playerUID = getplayerUID _playerObj;
|
||||
if(_playerUID isEqualTo "")exitWith{
|
||||
diag_log "EPOCHDebug: playerUpdateStats -4- player UID is empty";
|
||||
};
|
||||
if(!isplayer _playerObj)exitWith{
|
||||
diag_log "EPOCHDebug: playerUpdateStats -5- is not a player";
|
||||
};
|
||||
|
||||
//get this playerObj stats
|
||||
_playerStats = _playerObj getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
//get this stats index #
|
||||
_sIndex = EPOCH_communityStats find _statType;
|
||||
if (_sIndex > -1) then {
|
||||
//get this stat value
|
||||
_currentStat = _playerStats select _sIndex;
|
||||
//set the new stat value
|
||||
if (_isTotal) then {
|
||||
_playerStats set[_sIndex, _adjust];
|
||||
}
|
||||
else {
|
||||
_playerStats set[_sIndex, _currentStat + _adjust];
|
||||
};
|
||||
//set the new stats array back onto this playerObj
|
||||
_playerObj setVariable["COMMUNITY_STATS", _playerStats];
|
||||
|
||||
//send to hive
|
||||
// ["CommunityStats", _playerUID, EPOCH_expiresCommunityStats, [_playerStats]] call EPOCH_fnc_server_hiveSETEX;
|
||||
// Prevent saving to DB too much often, as it is already saved on Player Save Loop / Disconnect / Kill
|
||||
|
||||
//send to player
|
||||
if(_toClient)then{
|
||||
[_statType,_adjust,false,_isTotal] remoteExecCall ["EPOCH_client_updatePlayerStat",(owner _playerObj)];
|
||||
};
|
||||
};
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Cleanup server side temp spawned objects by players
|
||||
|
||||
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_server/EPOCH_localCleanup.sqf
|
||||
|
||||
Example:
|
||||
_object(s) call EPOCH_localCleanup;
|
||||
|
||||
Parameter(s):
|
||||
_this: OBJECT or ARRAY of Objects
|
||||
|
||||
Returns:
|
||||
NOTHING
|
||||
*/
|
||||
if !(_this isEqualType []) then {
|
||||
_this = [_this];
|
||||
};
|
||||
{
|
||||
if (!isNull _x) then {
|
||||
_x addEventHandler["local", {
|
||||
params ["_unit","_isLocal"];
|
||||
if (_isLocal) then {
|
||||
if (!isNull _unit) then{
|
||||
{
|
||||
_unit removeAllMPEventHandlers _x;
|
||||
}forEach["mpkilled", "mphit", "mprespawn"];
|
||||
{
|
||||
_unit removeAllEventHandlers _x;
|
||||
}forEach["FiredNear", "HandleDamage", "Killed", "Fired", "GetOut", "GetIn", "Local"];
|
||||
deleteVehicle _unit;
|
||||
deleteGroup(group _unit);
|
||||
};
|
||||
};
|
||||
}];
|
||||
};
|
||||
}forEach _this;
|
||||
addToRemainsCollector _this;
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Splits a position into two arrays: Whole number array and decimal array.
|
||||
|
||||
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_server/EPOCH_precisionPos.sqf
|
||||
*/
|
||||
private["_low"];
|
||||
_low = _this apply {_x - (_x % 1)};
|
||||
[_low, _this vectorDiff _low]
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Simple misson config override function
|
||||
|
||||
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_server/EPOCH_returnConfig.sqf
|
||||
*/
|
||||
private["_return", "_config"];
|
||||
_return = (configfile >> _this);
|
||||
_config = (getMissionConfig _this);
|
||||
if (isClass _config) then{
|
||||
_return = _config;
|
||||
};
|
||||
_return
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Uses Epoch server extension to perform various functions like: kick, ban, shutdown, message, unlock/lock
|
||||
|
||||
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_server/EPOCH_serverCommand.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_playerUID"];
|
||||
//[[[end]]]
|
||||
params ["_command","_param1","_param2","_param3"];
|
||||
switch (_command) do {
|
||||
case 'shutdown': { 'epochserver' callExtension '991' };
|
||||
case 'message': { 'epochserver' callExtension format['901|%1', _param1] };
|
||||
case 'lock': { 'epochserver' callExtension '931' };
|
||||
case 'unlock': { 'epochserver' callExtension '930' };
|
||||
case 'kick': {
|
||||
_playerUID = _param1;
|
||||
if (_playerUID isEqualType objNull) then{
|
||||
_playerUID = getPlayerUID _playerUID;
|
||||
};
|
||||
if !(_playerUID isEqualTo '') then{
|
||||
'epochserver' callExtension format['911|%1|%2', _playerUID, _param2];
|
||||
};
|
||||
};
|
||||
case 'ban': {
|
||||
_playerUID = _param1;
|
||||
if (_playerUID isEqualType objNull) then{
|
||||
_playerUID = getPlayerUID _playerUID;
|
||||
};
|
||||
if !(_playerUID isEqualTo '') then{
|
||||
'epochserver' callExtension format['921|%1|%2|%3', _playerUID, _param2, _param3];
|
||||
};
|
||||
};
|
||||
};
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Uses Epoch server extension to perform various functions like: kick, ban, shutdown, message, unlock/lock
|
||||
|
||||
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_server/EPOCH_serverLootObject.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_config","_debug","_exit","_loop","_lootItemArray","_lootItemWeightedArray","_lootTable","_lootTableClass","_lootTableIndex","_loots","_magazineSize","_mags","_maxLoot","_maxPayout","_minLoot","_pricingConfig","_quan","_randomItem","_randomItemArray","_randomizeMagazineAmmoCount","_weightedItemArray","_LootWHs"];
|
||||
//[[[end]]]
|
||||
params ["_object","_type",["_forceSpawn",false],["_pos",[]],["_scatter",[]]];
|
||||
_debug = true;
|
||||
_LootWHs = [];
|
||||
_pricingConfig = 'CfgPricing' call EPOCH_returnConfig;
|
||||
|
||||
_lootTableIndex = if (EPOCH_modCUPVehiclesEnabled) then {if (EPOCH_mod_madArma_Enabled) then {3} else {1}} else {if (EPOCH_mod_madArma_Enabled) then {2} else {0}};
|
||||
_lootTableClass = ["CfgLootTable","CfgLootTable_CUP","CfgLootTable_MAD","CfgLootTable_MADCUP"] select _lootTableIndex;
|
||||
if !(EPOCH_forcedLootSpawnTable isEqualTo "") then {
|
||||
_lootTableClass = EPOCH_forcedLootSpawnTable;
|
||||
};
|
||||
_randomizeMagazineAmmoCount = ["CfgEpochClient", "randomizeMagazineAmmoCount", true] call EPOCH_fnc_returnConfigEntryV2;
|
||||
if (isnull _object && !(_pos isequalto []) && (_scatter isequalto [])) then {
|
||||
_object = createVehicle ["groundWeaponHolder",_pos,[],0,"CAN_COLLIDE"];
|
||||
_object setPosATL _pos;
|
||||
};
|
||||
if (!isNull _object || !(_scatter isequalto [])) then{
|
||||
_scatter params [["_doScatter",false],["_ScatterRadiusArr",[6,12]]];
|
||||
_lootTable = ["CfgMainTable", _type, "tables"] call EPOCH_fnc_weightedArray;
|
||||
if !(_lootTable isEqualTo []) then {
|
||||
_loots = [];
|
||||
_config = configFile >> "CfgMainTable" >> _type;
|
||||
_minLoot = getNumber(_config >> "lootMin");
|
||||
_maxLoot = getNumber(_config >> "lootMax");
|
||||
_maxPayout = (round (random(_maxLoot * EPOCH_lootMultiplier))) max _minLoot;
|
||||
for "_k" from 1 to _maxPayout do {
|
||||
_loots pushBack (selectRandomWeighted _lootTable);
|
||||
};
|
||||
{
|
||||
if (_doScatter) then {
|
||||
_randomPos = [_pos,_ScatterRadiusArr call BIS_fnc_randomInt,[0,359] call BIS_fnc_randomInt] call BIS_fnc_relPos;
|
||||
_object = createVehicle ["Epoch_LootHolder",_randomPos,[],0,"CAN_COLLIDE"];
|
||||
_object setPosATL [_randomPos select 0, _randomPos select 1, 0.1];
|
||||
_LootWHs pushback _object;
|
||||
};
|
||||
_lootItemWeightedArray = [_lootTableClass, _x, "items"] call EPOCH_fnc_weightedArray;
|
||||
if !(_lootItemWeightedArray isEqualTo[]) then {
|
||||
_randomItemArray = selectRandomWeighted _lootItemWeightedArray;
|
||||
_randomItem = _randomItemArray select 0;
|
||||
_type = _randomItemArray select 1;
|
||||
_quan = 1;
|
||||
_loop = true;
|
||||
_exit = false;
|
||||
while {_loop} do {
|
||||
switch _type do {
|
||||
case "item": {
|
||||
if (isClass (_pricingConfig >> _randomItem) || _forceSpawn) then {
|
||||
_object additemCargoGlobal [_randomItem, _quan];
|
||||
} else {
|
||||
if (_debug) then {diag_log format["DEBUG: suppress spawn of %1 does not have price.",_randomItem]};
|
||||
};
|
||||
_loop = false;
|
||||
};
|
||||
case "magazine": {
|
||||
if (isClass (_pricingConfig >> _randomItem) || _forceSpawn) then {
|
||||
if (_randomizeMagazineAmmoCount) then {
|
||||
// spawn a single Magazine with a random ammo count
|
||||
_magazineSize = getNumber (configFile >> "CfgMagazines" >> _randomItem >> "count");
|
||||
_object addMagazineAmmoCargo[_randomItem, _quan, ceil(random(_magazineSize))];
|
||||
} else {
|
||||
// spawn a single full Magazine
|
||||
_object addMagazineCargoGlobal [_randomItem, _quan];
|
||||
};
|
||||
} else {
|
||||
if (_debug) then {diag_log format["DEBUG: suppress spawn of %1 does not have price.",_randomItem]};
|
||||
};
|
||||
_loop = false;
|
||||
};
|
||||
case "backpack": {
|
||||
if (isClass (_pricingConfig >> _randomItem) || _forceSpawn) then {
|
||||
_object addBackpackCargoGlobal [_randomItem, _quan];
|
||||
} else {
|
||||
if (_debug) then {diag_log format["DEBUG: suppress spawn of %1 does not have price.",_randomItem]};
|
||||
};
|
||||
_loop = false;
|
||||
};
|
||||
case "weapon": {
|
||||
if (isClass (_pricingConfig >> _randomItem) || _forceSpawn) then {
|
||||
_object addWeaponCargoGlobal [_randomItem, _quan];
|
||||
// only spawn mags that have prices
|
||||
_mags = getArray (configFile >> "CfgWeapons" >> _randomItem >> "magazines") select {isClass (_pricingConfig >> _x)};
|
||||
if !(_mags isEqualTo []) then {
|
||||
if (_randomizeMagazineAmmoCount) then {
|
||||
// spawn a single Magazine with a random ammo count
|
||||
_magazineSize = getNumber (configFile >> "CfgMagazines" >> (_mags select 0) >> "count");
|
||||
_object addMagazineAmmoCargo[_mags select 0, 1, ceil(random(_magazineSize))];
|
||||
} else {
|
||||
// spawn a single full Magazine with weapon
|
||||
_object addMagazineCargoGlobal [_mags select 0, 1];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if (_debug) then {diag_log format["DEBUG: suppress spawn of %1 does not have price.",_randomItem]};
|
||||
};
|
||||
_loop = false;
|
||||
};
|
||||
case "CfgLootTable": {
|
||||
// go down the rabit hole
|
||||
_lootItemWeightedArray = [_lootTableClass, _randomItem, "items"] call EPOCH_fnc_weightedArray;
|
||||
if !(_lootItemWeightedArray isEqualTo[]) then {
|
||||
_randomItemArray = selectRandomWeighted _lootItemWeightedArray;
|
||||
_randomItem = _randomItemArray select 0;
|
||||
_type = _randomItemArray select 1;
|
||||
} else {
|
||||
_exit = true;
|
||||
};
|
||||
};
|
||||
default {
|
||||
_exit = true;
|
||||
};
|
||||
};
|
||||
if (_exit) exitWith{if (_debug) then {diag_log "DEBUG: exit from spawn with default state."}};
|
||||
};
|
||||
};
|
||||
} forEach _loots;
|
||||
};
|
||||
};
|
||||
_LootWHs
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Author: He-Man - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Defuse server side bombs (triggerd by Clients)
|
||||
|
||||
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_server/EPOCH_server_Defusebomb.sqf
|
||||
|
||||
Example:
|
||||
[_bomb,true,player,Epoch_personalToken] remoteexec ["EPOCH_server_DefuseBomb",2];
|
||||
|
||||
Returns:
|
||||
NOTHING
|
||||
*/
|
||||
|
||||
params [
|
||||
["_object",objNull,[objNull]],
|
||||
["_value",true,[true]],
|
||||
["_player",objNull,[objNull]],
|
||||
["_token","",[""]]
|
||||
];
|
||||
if (isNull _object) exitWith{};
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (_player distance _object > 50) exitWith{};
|
||||
if (_value) then {
|
||||
'HelicopterExploSmall' createVehicle (position _object);
|
||||
deletevehicle _object;
|
||||
}
|
||||
else {
|
||||
deletevehicle _object;
|
||||
_reward = gettext (configfile >> "cfgammo" >> (typeof _object) >> "defaultMagazine");
|
||||
if !(_reward isequalto "") then {
|
||||
_reward remoteexec ["EPOCH_fnc_addItemOverflow",_player];
|
||||
[format ['Sucessfully defused %1 - You have it now in your Inventory',_reward call Epoch_fnc_Itemdisplayname],5] remoteexec ["Epoch_Message",_player];
|
||||
};
|
||||
};
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Author: He-Man - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description: Puts Crypto Items on the Ground
|
||||
|
||||
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_server\EPOCH_server_PutCrypto.sqf
|
||||
|
||||
Usage:
|
||||
[player,_value,Epoch_personalToken] remoteexec ['EPOCH_server_PutCrypto',2]
|
||||
|
||||
RETURNS: NOTHING
|
||||
*/
|
||||
|
||||
private ["_cIndex","_vars","_current_crypto","_pos","_dist","_direction","_randomPos","_itemclass","_var","_item"];
|
||||
params ["_player","_Putcrypto",["_token","",[""]]];
|
||||
diag_log format ["PutCrypto Server Side - %1",_this];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
_cIndex = EPOCH_customVars find 'Crypto';
|
||||
_vars = _player getVariable['VARS', call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
if (_current_crypto < _Putcrypto) exitwith {
|
||||
["Not enough money",5] remoteexec ["Epoch_Message",_player];
|
||||
};
|
||||
_current_crypto = _current_crypto - _Putcrypto;
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable['VARS', _vars];
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
[format ["You put %1 Crypto on the Ground",_Putcrypto],5] remoteexec ["Epoch_Message",_player];
|
||||
[_player,_vars,_token] call EPOCH_fnc_savePlayer;
|
||||
_pos = getposatl _player;
|
||||
while {_Putcrypto > 0} do {
|
||||
_itemclass = if (_Putcrypto >= 1000) then {"Land_Suitcase_F"} else {"Land_Money_F"};
|
||||
_var = if (_Putcrypto >= 1000) then {1000} else {_Putcrypto min 100};
|
||||
_Putcrypto = _Putcrypto - _var;
|
||||
_item = createVehicle [_itemclass,_pos,[],1,"CAN_COLLIDE"];
|
||||
_item setvariable ["RemoveOnTake",true];
|
||||
_item allowdamage false;
|
||||
_item enablesimulationglobal false;
|
||||
_item setvariable ["Crypto",_var,true];
|
||||
};
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Author: He-Man - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Update Server TopStats
|
||||
|
||||
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_server/EPOCH_server_UpdateTopStats.sqf
|
||||
*/
|
||||
|
||||
|
||||
private ["_playername","_playeruid","_makepublic","_publicindex","_tempStats","_ThisStatArr","_playerisin","_idx","_playerValue"];
|
||||
params [['_player',ObjNull],['_vars',[]]];
|
||||
_playername = name _player;
|
||||
_playeruid = getplayeruid _player;
|
||||
if !((_playerUID isequalto '') || (_vars isequalto [])) then {
|
||||
_makepublic = 1;
|
||||
_publicindex = EPOCH_communityStats find 'PublicStats';
|
||||
if !(_publicindex isequalto -1) then {
|
||||
_makepublic = _vars select _publicindex;
|
||||
};
|
||||
_tempStats = EPOCH_TopStats;
|
||||
{
|
||||
_ThisStatArr = _x;
|
||||
_playerisin = false;
|
||||
_idx = EPOCH_communityStats find (EPOCH_TopStatsVars select _foreachindex);
|
||||
if (_idx > -1) then {
|
||||
_playerValue = _vars select _idx;
|
||||
{
|
||||
_x params ["_value","_UID","_name"];
|
||||
if (_UID isequalto _playerUID) exitwith {
|
||||
_playerisin = true;
|
||||
if (_makepublic isEqualTo 0) exitwith {
|
||||
_ThisStatArr deleteat _foreachindex;
|
||||
};
|
||||
_x set [0,_playerValue];
|
||||
_x set [2,_playername];
|
||||
};
|
||||
} foreach _x;
|
||||
if (!_playerisin && (_makepublic > 0)) then {
|
||||
_x pushback [(_vars select _idx),_playerUID,_playername];
|
||||
};
|
||||
_x sort false;
|
||||
if (count _x > 10) then {
|
||||
_x resize 10;
|
||||
};
|
||||
};
|
||||
} foreach _tempStats;
|
||||
EPOCH_TopStats = _tempStats;
|
||||
["CommunityStats", "0_TopStats", EPOCH_expiresCommunityStats, EPOCH_TopStats] call EPOCH_fnc_server_hiveSETEX;
|
||||
publicvariable "EPOCH_TopStats";
|
||||
};
|
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Adds killed handler to base 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_server/compile/epoch_server/EPOCH_server_buildingInit.sqf
|
||||
*/
|
||||
_this addMPEventHandler["MPKilled", { _this call EPOCH_server_save_killedBuilding; }];
|
@ -0,0 +1,97 @@
|
||||
/*
|
||||
|
||||
Author: DirtySanchez
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Utilize new Epoch Active Markers, Backgrounds and Icons courtesy of DrokZ.
|
||||
|
||||
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_server/EPOCH_server_createGlobalMarkerSet.sqf
|
||||
|
||||
usage:
|
||||
[_markerClass, _position] call EPOCH_server_createGlobalMarkerSet;
|
||||
|
||||
_markerClass(_mClass) - use one of the class markers in the epoch_configs/Configs/CfgMarkerSets.hpp or create new
|
||||
|
||||
_position(_mPos) - position you would like to place the marker set on the map
|
||||
|
||||
Example:
|
||||
1. ['DeathMarker',_pos] call EPOCH_server_createGlobalMarkerSet;
|
||||
|
||||
2. ['PlayerMarker',_pos] call EPOCH_server_createGlobalMarkerSet;
|
||||
|
||||
*/
|
||||
private["_config", "_markerArray", "_ccText"];
|
||||
|
||||
params [ ["_mClass",""], ["_mPos",[0,0,0]], ["_OverrideTxt",""] ];
|
||||
if(_mClass isEqualTo "") exitWith {
|
||||
diag_log "EPOCHDebug: createGlobalMarkerSet -1- empty markerClass, nothing to create";
|
||||
};
|
||||
|
||||
// get config for custom marker sets
|
||||
_config = 'CfgMarkerSets' call EPOCH_returnConfig;
|
||||
if !(isclass (_config >> _mClass)) exitwith {
|
||||
diag_log "EPOCHDebug: createGlobalMarkerSet -2- not a class markerClass, nothing to create";
|
||||
};
|
||||
|
||||
// get array for custom marker set
|
||||
_markerArray = getArray(_config >> _mClass >> "markerArray");
|
||||
if(_markerArray isEqualTo []) exitWith {
|
||||
diag_log "EPOCHDebug: createGlobalMarkerSet -3- empty markerArray, nothing to create";
|
||||
};
|
||||
|
||||
// check for defined Marker counter
|
||||
if(isNil {Epoch_markerCounterGlobal})then{Epoch_markerCounterGlobal = 0};
|
||||
|
||||
_return = [];
|
||||
// run forEach loop on array
|
||||
{
|
||||
// double check all, use these defaults if not defined
|
||||
_x params [
|
||||
["_mName",format["EPOCH_globalMarker_%1", Epoch_markerCounterGlobal]],
|
||||
["_mShape","ICON"],
|
||||
["_mType","hd_dot"],
|
||||
["_mColor","ColorBlack"],
|
||||
["_mAlpha",1],
|
||||
["_mSize",[0.8,0.8]],
|
||||
["_mDir",0],
|
||||
["_mText",""]
|
||||
];
|
||||
_mName = format["EPOCH_globalMarker_%1", Epoch_markerCounterGlobal];
|
||||
_marker = createMarker [_mName, _mPos];
|
||||
_return pushBack _mName;
|
||||
_mName setMarkerShape _mShape;
|
||||
if!(_mShape isEqualTo "ICON")then{
|
||||
if!(_mType in (getArray(_config >> "brushes")))exitWith{
|
||||
diag_log "EPOCHDebug: createGlobalMarkerSet -5- Shape is Ellipse or Rectangle and needs a Brush Type";
|
||||
};
|
||||
};
|
||||
_mName setMarkerType _mType;
|
||||
_mName setMarkerAlpha _mAlpha;
|
||||
_mName setMarkerSize _mSize;
|
||||
_mName setMarkerDir _mDir;
|
||||
|
||||
if (!(_OverrideTxt isequalto "") && _OverrideTxt isequaltype "") then {
|
||||
_mName setMarkerText _OverrideTxt;
|
||||
}
|
||||
else {
|
||||
if!(_mText isEqualTo "")then{
|
||||
_ccText = call compile _mText;
|
||||
_mName setMarkerText _ccText;
|
||||
};
|
||||
};
|
||||
|
||||
if!(_mColor isEqualTo "")then{
|
||||
_mName setMarkerColor _mColor
|
||||
};
|
||||
|
||||
missionNameSpace setVariable[_mName, _mSize, true];
|
||||
Epoch_markerCounterGlobal = Epoch_markerCounterGlobal + 1;
|
||||
}forEach _markerArray;
|
||||
|
||||
_return
|
@ -0,0 +1,195 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Creates inital teleport zones and sets up trader city props.
|
||||
|
||||
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_server/EPOCH_server_createTeleport.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_array","_center","_class","_cloneClasses","_config","_configWorld","_deSimulate","_debug","_debug1","_debugBox","_debugLocation","_dir","_dir1","_dir2","_enterClass","_ep","_exitClass","_light","_lightLocation","_loadBaseTemplateConfig","_markerName","_part","_partPos","_pos","_pos1","_pro1","_pro2","_protection","_useWorldPos","_veh1","_veh2"];
|
||||
//[[[end]]]
|
||||
_loadBaseTemplateConfig = {
|
||||
private ["_partPos","_part","_array","_center","_deSimulate"];
|
||||
params ["_templateClass","_selectedTemplate","_pos","_class"];
|
||||
_array = getArray(configfile >> "CfgPropTemplate" >> _selectedTemplate);
|
||||
_pos set [2,0];
|
||||
_center = createVehicle [_templateClass, _pos, [], 0, "CAN_COLLIDE"];
|
||||
{
|
||||
_partPos = _center modelToWorld (_x select 1);
|
||||
_partPos set [2,0];
|
||||
if ((_x select 0) isKindOf "Man") then {
|
||||
EPOCH_staticNPCTraderPos pushBack [(_x select 0), _partPos, (_x select 2)];
|
||||
} else {
|
||||
_part = createVehicle [_x select 0, _partPos, [], 0, "CAN_COLLIDE"];
|
||||
_part setDir (_x select 2);
|
||||
_part setPos _partPos;
|
||||
|
||||
_deSimulate = _class isKindOf "ThingX";
|
||||
// disable simulation if true
|
||||
if (count _x >= 4) then {
|
||||
_deSimulate = (_x select 3) isEqualTo "true";
|
||||
};
|
||||
|
||||
if (_deSimulate) then{
|
||||
_part enableSimulationGlobal false;
|
||||
};
|
||||
};
|
||||
} forEach _array;
|
||||
};
|
||||
|
||||
// load map config
|
||||
_config = configFile >> "CfgEpoch";
|
||||
_configWorld = _config >> worldname;
|
||||
if !(isclass _configWorld) then {
|
||||
_configWorld = _config >> "Default";
|
||||
};
|
||||
|
||||
_debugBox = getText(_configWorld >> "debugBoxClass"); // debugBoxClass = "" to disable
|
||||
if !(_debugBox isEqualTo "") then {
|
||||
_debugLocation = getMarkerPos "respawn_west";
|
||||
_debugLocation set[2, 0];
|
||||
if (_debugLocation isEqualTo [0,0,0]) then {
|
||||
_debugLocation set [2, 10];
|
||||
};
|
||||
_debug = createVehicle[_debugBox, _debugLocation, [], 0, "CAN_COLLIDE"];
|
||||
_debug setposATL _debugLocation;
|
||||
_protection = createVehicle["ProtectionZone_Invisible_F", _debugLocation, [], 0, "CAN_COLLIDE"];
|
||||
_protection setposATL _debugLocation;
|
||||
if (_debugLocation distance2d [0,0,0] < 10) then {
|
||||
_debug setvectorup [0,0,1];
|
||||
if (surfaceiswater _debugLocation) then {
|
||||
_debug setposASL _debugLocation;
|
||||
_protection setposASL _debugLocation;
|
||||
};
|
||||
};
|
||||
_cloneClasses = getArray(_configWorld >> "cloneClasses");
|
||||
if !(_cloneClasses isEqualTo []) then {
|
||||
for "_i" from 1 to 4 do {
|
||||
_class = selectRandom _cloneClasses;
|
||||
_debug1 = createVehicle[_class, (_debug modelToWorld(_debug selectionPosition(str _i))), [], 0, "CAN_COLLIDE"];
|
||||
_debug1 setDir-90;
|
||||
|
||||
};
|
||||
for "_i" from 5 to 8 do {
|
||||
_class = selectRandom _cloneClasses;
|
||||
_debug1 = createVehicle[_class, (_debug modelToWorld(_debug selectionPosition(str _i))), [], 0, "CAN_COLLIDE"];
|
||||
_debug1 setDir 90;
|
||||
};
|
||||
};
|
||||
// spawn lights
|
||||
{
|
||||
_lightLocation = _debug modelToWorld _x;
|
||||
_light = createVehicle["Land_PortableLight_double_F", _lightLocation, [], 0, "CAN_COLLIDE"];
|
||||
_light setDir (_debugLocation getDir _lightLocation);
|
||||
_light setpos _lightLocation;
|
||||
} forEach (getArray(_configWorld >> "lightPos"));
|
||||
};
|
||||
|
||||
// spawn area props
|
||||
{
|
||||
_x params [
|
||||
["_class",""],
|
||||
["_pos",[0,0,0]],
|
||||
["_dir",0],
|
||||
["_disableSim","false"],
|
||||
["_dynSim","false"],
|
||||
["_allowDmg","false"],
|
||||
["_dmg",0]
|
||||
];
|
||||
|
||||
_ep = createVehicle[_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_ep setposATL _pos;
|
||||
if (_dir isEqualType []) then{
|
||||
_ep setVectorDirAndUp _dir;
|
||||
} else {
|
||||
_ep setDir _dir;
|
||||
};
|
||||
_deSimulate = _class isKindOf "ThingX";
|
||||
if((_deSimulate) || (_disableSim isEqualTo "true"))then{
|
||||
_ep enableSimulationGlobal false;
|
||||
};
|
||||
if([configFile >> "CfgEpochServer", "enableDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry) then {
|
||||
_ep enableDynamicSimulation (_dynSim isEqualTo "true");
|
||||
};
|
||||
_ep allowDamage (_allowDmg isEqualTo "true");
|
||||
_ep setDamage (_dmg min 0.75);
|
||||
} forEach(getArray(_configWorld >> "propsPos"));
|
||||
|
||||
{
|
||||
_x params ["_enterClass","_pos1","_exitClass","_pos",["_useWorldPos",false]];
|
||||
|
||||
// allow forth position element to set direction if set
|
||||
_dir1 = 0;
|
||||
_dir2 = 0;
|
||||
if (count _pos1 >= 4) then {
|
||||
_dir1 = _pos1 deleteAt 3;
|
||||
};
|
||||
|
||||
if !(_useWorldPos) then {
|
||||
_pos1 = asltoatl (_debug modeltoworldworld _pos1);
|
||||
};
|
||||
|
||||
// allow forth position element to set direction if set
|
||||
if (_pos isEqualType [] && {count _pos >= 4}) then {
|
||||
_dir2 = _pos deleteAt 3;
|
||||
};
|
||||
|
||||
// load template props for marker location
|
||||
if (_pos isEqualType "") then {
|
||||
_markerName = _pos;
|
||||
_pos = getMarkerPos _markerName;
|
||||
if (_pos isEqualTo [0,0,0]) then {
|
||||
for "_i" from 0 to 10 do {
|
||||
_pos = switch _markerName do {
|
||||
case "north": {[epoch_centerMarkerPosition vectorAdd [0,worldsize/3,0], 0, worldsize/8, 5, 0, 0.1] call BIS_fnc_findSafePos};
|
||||
case "south": {[epoch_centerMarkerPosition vectorAdd [0,-worldsize/3,0], 0, worldsize/8, 5, 0, 0.1] call BIS_fnc_findSafePos};
|
||||
case "east": {[epoch_centerMarkerPosition vectorAdd [worldsize/3,0,0], 0, worldsize/8, 5, 0, 0.1] call BIS_fnc_findSafePos};
|
||||
case "west": {[epoch_centerMarkerPosition vectorAdd [-worldsize/3,0,0], 0, worldsize/8, 5, 0, 0.1] call BIS_fnc_findSafePos};
|
||||
default {[epoch_centerMarkerPosition, 0, worldsize/8, 5, 0, 0.1] call BIS_fnc_findSafePos};
|
||||
};
|
||||
if (count _pos == 2) exitwith {
|
||||
_pos pushback 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
["ProtectionZone_Invisible_F",_markerName,_pos,_class] call _loadBaseTemplateConfig;
|
||||
} else {
|
||||
_pro2 = createVehicle ["ProtectionZone_Invisible_F", _pos, [], 0, "CAN_COLLIDE"];
|
||||
};
|
||||
|
||||
|
||||
|
||||
_pro1 = createVehicle ["ProtectionZone_Invisible_F", _pos1, [], 0, "CAN_COLLIDE"];
|
||||
_veh1 = createVehicle[_enterClass, _pos1, [], 0, "CAN_COLLIDE"];
|
||||
// force addaction on any other objects that are not setup properly
|
||||
if !(_veh1 isKindOf "Transport_EPOCH") then {
|
||||
[_veh1, [(localize "STR_EPOCH_Teleport"), {(_this select 0) call EPOCH_EnterBuilding}, [], 1, true, true, "Action", "alive _target", 3, false, ""]] remoteExec ["addAction", -2, _veh1, true];
|
||||
};
|
||||
_veh1 enableSimulationGlobal false;
|
||||
_veh1 allowDamage false;
|
||||
_veh1 setVariable["ParentBuilding", _pos];
|
||||
_veh1 setDir _dir1;
|
||||
_veh1 setposATL _pos1;
|
||||
|
||||
if (_exitClass != "") then {
|
||||
_veh2 = createVehicle[_exitClass, _pos, [], 0, "CAN_COLLIDE"];
|
||||
// force addaction on any other objects that are not setup properly
|
||||
if !(_veh2 isKindOf "Transport_EPOCH") then {
|
||||
[_veh2, [(localize "STR_EPOCH_Teleport"), {(_this select 0) call EPOCH_EnterBuilding}, [], 1, true, true, "Action", "alive _target", 3, false, ""]] remoteExec ["addAction", -2, _veh1, true];
|
||||
};
|
||||
_veh2 enableSimulationGlobal false;
|
||||
_veh2 allowDamage false;
|
||||
_veh2 setVariable["ParentBuilding", _pos1];
|
||||
_veh2 setDir _dir2;
|
||||
_veh2 setposATL _pos;
|
||||
};
|
||||
|
||||
EPOCH_staticTraderLocations pushBack _pos;
|
||||
} foreach (getArray(_configWorld >> "telePos"));
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Author: DirtySanchez - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Delete Marker Set
|
||||
|
||||
License:
|
||||
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_server/EPOCH_server_deleteGlobalMarkerSet.sqf
|
||||
|
||||
usage:
|
||||
[_markerArray] call EPOCH_server_deleteGlobalMarkerSet;
|
||||
|
||||
_markerArray - 1 or more in game marker names
|
||||
*/
|
||||
private["_mName"];
|
||||
|
||||
params [ ["_markerArray",[]], ["_data",[]] ];
|
||||
|
||||
if(_markerArray isEqualTo []) exitWith {
|
||||
diag_log "EPOCHDebug: deleteGlobalMarkerSet -1- empty markerArray, nothing to delete";
|
||||
};
|
||||
|
||||
{
|
||||
_mName = _x;
|
||||
deleteMarker _mName;
|
||||
}forEach _markerArray;
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Returns Real Time in HH:MM string format
|
||||
|
||||
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_server/EPOCH_server_getRealTime.sqf
|
||||
*/
|
||||
// make call to get real time
|
||||
(parseSimpleArray ('epochserver' callExtension '510')) params ["","","",["_hour",0],["_min",0]];
|
||||
// fix 0 prefix if lower than 10
|
||||
if (_min < 10) then {_min = '0'+str _min};
|
||||
if (_hour < 10) then {_hour = '0'+str _hour};
|
||||
// output HH:MM format
|
||||
format ['%1:%2',_hour,_min]
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
EPOCH_server_isNearChecks
|
||||
|
||||
Author: DirtySanchez
|
||||
|
||||
Description:
|
||||
Checks the position provided against distances configured for Traders, Jammers and Players.
|
||||
|
||||
_position - position on map
|
||||
_traderCheck - BOOL - check _position distance near ProtectionZone_Invisible_F
|
||||
_jammerCheck - BOOL - check _position distance near PlotPoles
|
||||
_playerCheck - BOOL - check _position distance near other Players
|
||||
_others - ARRAY - positions to check with _distFromOthers
|
||||
_distFromOthers - NUMBER - How far away from _others array in meters
|
||||
*/
|
||||
|
||||
params [ ["_position",[]], ["_traderCheck",true], ["_jammerCheck",true], ["_playerCheck",true], ["_others",[[0,0,0]]], ["_distFromOthers",2000] ];
|
||||
_distFromTraders = getNumber(_cfgEpoch >> "spawnDistanceFromTraders");
|
||||
_distFromJammers = getNumber(_cfgEpoch >> "spawnDistanceFromJammers");
|
||||
_distFromPlayers = getNumber(_cfgEpoch >> "spawnDistanceFromPlayers");
|
||||
_return = true;
|
||||
|
||||
//CHECK FOR PROTECTED AREA WITIN CONFIG RANGE
|
||||
if(_traderCheck)then{
|
||||
_restricted = nearestObjects [_position, ["ProtectionZone_Invisible_F"], _distFromTraders];
|
||||
if(count _restricted > 0) then {
|
||||
_return = false;
|
||||
};
|
||||
};
|
||||
|
||||
//CHECK FOR JAMMERS IN THE AREA WITHIN CONFIG RANGE
|
||||
if(_jammerCheck)then{
|
||||
_jammers = nearestObjects[_position, call EPOCH_JammerClasses, _distFromJammers];
|
||||
if(count _jammers > 0) then {
|
||||
_return = false;
|
||||
};
|
||||
};
|
||||
|
||||
//CHECK TO SEE IF PLAYERS WITHIN CONFIG RANGE
|
||||
if(_playerCheck)then{
|
||||
_playersNearby = _position nearEntities[["Epoch_Male_F", "Epoch_Female_F"], _distFromPlayers];
|
||||
if(count _playersNearby > 0) then {
|
||||
_return = false;
|
||||
};
|
||||
};
|
||||
|
||||
//CHECK FOR OTHERS
|
||||
if!(_others isEqualTo [[0,0,0]])then{
|
||||
{
|
||||
if!(_x distance _position > _distFromOthers)then{
|
||||
_return = false;
|
||||
};
|
||||
}forEach _others;
|
||||
};
|
||||
_return
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Create map marker for everyone, group or individual.
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: ARRAY - [Target Type 0-Player 1-Group Members 2-All players 3-Multiple custom players, Object(s) - Player, Group, Array of Players or markerName for option 3]
|
||||
_this select 1-9: STRING(S) - Marker parameters.
|
||||
|
||||
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/master/Sources/epoch_server/compile/epoch_server/EPOCH_server_makeMarker.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_mrkr","_mrkrName","_trgtObj","_trgtType"];
|
||||
//[[[end]]]
|
||||
params ["_trgt","_mPos",["_mShape","ICON"],["_mType","mil_dot"],["_mText",""],["_mColor","ColorBlack"],["_mSize",[0.7,0.7]],"_mBrush","_mDir","_mAlpha",["_mrkrName",""]];
|
||||
|
||||
diag_log format["Epoch: ADMIN: Creating marker at %1 called by %2.", _mPos, _trgt];
|
||||
if(count _trgt < 2)exitWith{};
|
||||
_trgtType = _trgt select 0;
|
||||
_trgtObj = _trgt select 1;
|
||||
if(_mrkrName == "")then{_mrkrName = str(_trgtObj) + str(diag_tickTime);};
|
||||
|
||||
switch _trgtType do {
|
||||
|
||||
case 0: {
|
||||
if(isPlayer _trgtObj)then{
|
||||
[_trgtObj,_mPos,_mShape,_mType,_mColor,_mSize,_mBrush,_mDir,_mText,_mAlpha,_mrkrName] remoteExec ['EPOCH_makeMarker',_trgtObj];
|
||||
};
|
||||
};
|
||||
|
||||
case 1: {
|
||||
if!(isNull _trgtObj)then{
|
||||
private _targets = (units group _trgtObj);
|
||||
if !(_targets isEqualTo []) then {
|
||||
[nil,_mPos,_mShape,_mType,_mColor,_mSize,_mBrush,_mDir,_mText,_mAlpha,_mrkrName] remoteExec ['EPOCH_makeMarker',_targets];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
case 2: {
|
||||
if(_trgtObj == "")then{_trgtObj=diag_tickTime;};
|
||||
_mrkr = createMarker [_mrkrName, _mPos];
|
||||
_mrkr setMarkerShape _mShape;
|
||||
_mrkr setMarkerType _mType;
|
||||
if!(_mText == "")then{_mrkr setMarkerText _mText;};
|
||||
_mrkr setMarkerColor _mColor;
|
||||
_mrkr setMarkerSize _mSize;
|
||||
if!(isNil "_mBrush")then{_mrkr setMarkerBrush _mBrush;};
|
||||
if!(isNil "_mDir")then{_mrkr setMarkerDir _mDir;};
|
||||
if!(isNil "_mAlpha")then{_mrkr setMarkerAlpha _mAlpha;};
|
||||
};
|
||||
|
||||
case 3: {
|
||||
if(_trgtObj isEqualType [] && {!(_trgtObj isEqualTo [])})then{
|
||||
[nil,_mPos,_mShape,_mType,_mColor,_mSize,_mBrush,_mDir,_mText,_mAlpha,_mrkrName] remoteExec ['EPOCH_makeMarker',_trgtObj];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
default {diag_log format["Epoch: ADMIN: Marker failed at %1 called by %2.", _mPos, _trgt];};
|
||||
};
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Author: Andrew Gregory - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Delete map marker.
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJECT (Player) / ARRAY - Players.
|
||||
_this select 1: INTEGER - 0 - Player Only, 1 - Player Group, 2 - Everyone, 3 - Custom Array of players.
|
||||
_this select 2: STRING - Marker Name
|
||||
|
||||
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/master/Sources/epoch_server/compile/epoch_server/EPOCH_server_removeMarker.sqf
|
||||
*/
|
||||
params [["_trgtObj",[]],["_trgtType",0],["_mrkrName",""]];
|
||||
diag_log format["Epoch: ADMIN: Deleting marker %1 | %2.", _mrkrName, _trgtObj];
|
||||
|
||||
|
||||
switch _trgtType do {
|
||||
|
||||
case 0: {
|
||||
if(isPlayer _trgtObj)then{
|
||||
[_mrkrName] remoteExec ['EPOCH_removeMarker',_trgtObj];
|
||||
};
|
||||
};
|
||||
|
||||
case 1: {
|
||||
if!(isNull _trgtObj)then{
|
||||
private _targets = (units group _trgtObj);
|
||||
if !(_targets isEqualTo []) then {
|
||||
[_mrkrName] remoteExec ['EPOCH_removeMarker',_targets];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
case 2: {
|
||||
deleteMarker _mrkrName;
|
||||
};
|
||||
|
||||
case 3: {
|
||||
if(_trgtObj isEqualType [] && {!(_trgtObj isEqualTo [])})then{
|
||||
if !(_trgtObj isEqualTo []) then {
|
||||
[_mrkrName] remoteExec ['EPOCH_removeMarker',_trgtObj];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
default {diag_log format["Epoch: ADMIN: Marker delete failed at %1 called by %2.", _mrkrName, _trgtObj];};
|
||||
};
|
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Adds killed handler to storage object.
|
||||
|
||||
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_server/EPOCH_server_storageInit.sqf
|
||||
*/
|
||||
_this addMPEventHandler["MPKilled", { _this call EPOCH_server_save_killedStorage }];
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Adds killed handler to storage object.
|
||||
|
||||
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_server/EPOCH_server_teleportPlayer.sqf
|
||||
*/
|
||||
private ["_tp"];
|
||||
params ["_player","_teleporter",["_token","",[""]]];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _teleporter) exitWith{};
|
||||
if (_player distance _teleporter > 20) exitWith{};
|
||||
|
||||
_tp = _teleporter getVariable["ParentBuilding", []];
|
||||
if !(_tp isEqualTo []) then {
|
||||
_player setPosATL _tp;
|
||||
};
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Sets marker for trader to red and triggers drone to spawn on killer
|
||||
|
||||
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_server/EPOCH_server_traderKilled.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_markers","_objHiveKey","_slot","_playerCStats","_playerKarma","_playerKarmaAdj","_kIndex"];
|
||||
//[[[end]]]
|
||||
params ["_trader","_player"];
|
||||
if (!isNull _trader) then {
|
||||
_markers = _trader getVariable["MARKER_REF",[]];
|
||||
if !(_markers isequalto []) then {
|
||||
{
|
||||
_x setMarkerColor "ColorRed";
|
||||
}forEach _markers;
|
||||
};
|
||||
_slot = _trader getVariable["AI_SLOT", -1];
|
||||
if (_slot != -1) then {
|
||||
// Spawn Drone on player
|
||||
[_player, "UAV"] call EPOCH_server_triggerEvent;
|
||||
_objHiveKey = format ["%1:%2", (call EPOCH_fn_InstanceID), _slot];
|
||||
["AI", _objHiveKey] call EPOCH_fnc_server_hiveDEL;
|
||||
["AI_ITEMS", _objHiveKey] call EPOCH_fnc_server_hiveDEL;
|
||||
};
|
||||
// send karma stat to seller
|
||||
_kIndex = EPOCH_communityStats find "Karma";
|
||||
_playerCStats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
_playerKarma = _playerCStats select _kIndex;
|
||||
_playerKarmaAdj = -5;
|
||||
if(_playerKarma < 0)then{_playerKarmaAdj = 5};
|
||||
[_player, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Vehicle Event Handlers to enable saving to DB
|
||||
|
||||
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_server/EPOCH_server_vehicleInit.sqf
|
||||
*/
|
||||
_this addMPEventHandler["MPKilled", { _this call EPOCH_server_save_killedVehicle }];
|
||||
_this addMPEventHandler["MPHit", { EPOCH_saveVehQueue pushBackUnique (_this select 0) }];
|
||||
_this addEventHandler["Local", { EPOCH_saveVehQueue pushBackUnique (_this select 0) }];
|
||||
_this addEventHandler["GetOut", { EPOCH_saveVehQueue pushBackUnique (_this select 0) }];
|
||||
|
||||
// fix to prevent rope break
|
||||
if (_this iskindof "AIR") then {
|
||||
_this addEventHandler ["RopeAttach", {
|
||||
params ["_object1", "_rope", "_object2"];
|
||||
if (isnull (driver _object2)) then {
|
||||
if !(owner _object1 == owner _object2) then {
|
||||
_object2 setowner (owner _object1);
|
||||
};
|
||||
};
|
||||
}];
|
||||
};
|
@ -0,0 +1,237 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Splits a position into two arrays: Whole number array and decimal array.
|
||||
|
||||
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_traders/EPOCH_server_loadTraders.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private [ "_TraderGodMode","_StaticTraderItemPurge","_DynamicTraderRespawnCount","_TraderItemsDeleteRestart","_TraderInit","_TraderItemsClean","_newstock","_agent","_aiTables",
|
||||
"_arr","_config","_currentStock","_existingStock","_indexStock","_markers","_objHiveKey","_pos","_randomAIUniform","_response","_response2","_schedule",
|
||||
"_serverSettingsConfig","_staticTrader","_staticTradersArrCount","_staticTradersArray","_storedVehicleLimit","_traderSlotIndex","_work","_arrchanged","_deleteat","_maxrnd",
|
||||
"_WinterDeco","_HelloweenDeco","_TraderDeco"
|
||||
];
|
||||
//[[[end]]]
|
||||
params [["_maxTraderLimit",0]];
|
||||
|
||||
_staticTradersArray = +EPOCH_staticNPCTraderPos;
|
||||
EPOCH_staticNPCTraderPos = nil;
|
||||
_config = (configFile >> "CfgEpoch" >> worldName);
|
||||
if !(isclass _config) then {
|
||||
_config = (configFile >> "CfgEpoch" >> "Default");
|
||||
};
|
||||
_staticTradersArray append getArray(_config >> "staticNpcPos");
|
||||
_staticTradersArrCount = count _staticTradersArray;
|
||||
_aiTables = getArray(_config >> "traderUniforms");
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_TraderGodMode = [_serverSettingsConfig, "TraderGodMode", false] call EPOCH_fnc_returnConfigEntry;
|
||||
_storedVehicleLimit = [_serverSettingsConfig, "storedVehicleLimit", 20] call EPOCH_fnc_returnConfigEntry;
|
||||
_StaticTraderItemPurge = [_serverSettingsConfig, "StaticTraderItemPurge", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_DynamicTraderRespawnCount = [_serverSettingsConfig, "DynamicTraderRespawnCount", 150] call EPOCH_fnc_returnConfigEntry;
|
||||
_TraderItemCountPerItem = [_serverSettingsConfig, "TraderItemCountPerItem", [100,100]] call EPOCH_fnc_returnConfigEntry;
|
||||
_TraderItemsDeleteRestart = [_serverSettingsConfig, "TraderItemsDeleteRestart", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_TraderDeco = [_serverSettingsConfig, "TraderDeco", true] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
_WinterDeco = (Epoch_ServerRealtime select 1) == 12 && (Epoch_ServerRealtime select 2) > 20 && _TraderDeco;
|
||||
_HelloweenDeco = (((Epoch_ServerRealtime select 1) == 10 && (Epoch_ServerRealtime select 2) >= 24) || ((Epoch_ServerRealtime select 1) == 11 && (Epoch_ServerRealtime select 2) <= 3)) && _TraderDeco;
|
||||
|
||||
_TraderInit = {
|
||||
_this allowdamage !_TraderGodMode;
|
||||
_this setDir _dir;
|
||||
_this setVariable ["AI_SLOT", _i, true];
|
||||
_this setVariable ["AI_ITEMS", _arr, true];
|
||||
_this addEventHandler ["Killed", { _this call EPOCH_server_traderKilled; }];
|
||||
EPOCH_Traders pushback _this;
|
||||
addToRemainsCollector[_this];
|
||||
_this addUniform _randomAIUniform;
|
||||
_this disableAI "FSM";
|
||||
_this setBehaviour "CARELESS";
|
||||
_this setCombatMode "RED";
|
||||
_this setSkill 0;
|
||||
if (_HelloweenDeco) then {
|
||||
removeHeadgear _this;
|
||||
_this addHeadgear (selectrandom ["thor_mask_epoch","iron_mask_epoch","wolf_mask_epoch","pkin_mask_epoch","clown_mask_epoch","hockey_mask_epoch","plague_mask_epoch","ghostface_mask_epoch","skull_mask_epoch","witch_mask_epoch"]);
|
||||
}
|
||||
else {
|
||||
if (_WinterDeco) then {
|
||||
removeHeadgear _this;
|
||||
_this addHeadgear "santa_hat_epoch";
|
||||
};
|
||||
};
|
||||
};
|
||||
_TraderItemsClean = {
|
||||
private ["_idx","_delete","_k"];
|
||||
_idx = 0;
|
||||
for "_k" from 1 to (count (_arr select 0)) do {
|
||||
_delete = false;
|
||||
_item = _arr select 0 select _idx;
|
||||
_currentStock = (_arr select 1) param[_idx, 0];
|
||||
_maxrnd = 1;
|
||||
if ([_item,"cfgMagazines"] call Epoch_fnc_isAny) then {
|
||||
_maxrnd = getnumber (configfile >> "cfgMagazines" >> _item >> "count");
|
||||
};
|
||||
_currentStock = _currentStock / _maxrnd;
|
||||
if (_currentStock >= (_TraderItemCountPerItem select 0)) then {
|
||||
_currentStock = _TraderItemCountPerItem select 1;
|
||||
(_arr select 1) set [_idx,_currentStock*_maxrnd];
|
||||
_arrchanged = true;
|
||||
};
|
||||
if (_currentStock == 0) then {
|
||||
_arrchanged = true;
|
||||
_delete = true;
|
||||
}
|
||||
else {
|
||||
if (_item in _TraderItemsDeleteRestart) then {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Removed %2 from Trader (Items to remove on Restart)",_i,str _item];
|
||||
_arrchanged = true;
|
||||
_delete = true;
|
||||
}
|
||||
else {
|
||||
if (_item isKindOf "Air" || _item isKindOf "Ship" || _item isKindOf "LandVehicle" || _item isKindOf "Tank") then {
|
||||
_newstock = 0;
|
||||
for "_k" from 1 to _currentStock do {
|
||||
if (EPOCH_storedVehicleCount < _storedVehicleLimit) then {
|
||||
_newstock = _newstock + 1;
|
||||
EPOCH_storedVehicleCount = EPOCH_storedVehicleCount + 1;
|
||||
if !(_item in EPOCH_traderStoredVehicles) then {
|
||||
EPOCH_traderStoredVehicles pushBack _item;
|
||||
EPOCH_traderStoredVehiclesCnt pushBack 1;
|
||||
}
|
||||
else {
|
||||
_indexStock = EPOCH_traderStoredVehicles find _item;
|
||||
if (_indexStock != -1) then {
|
||||
_existingStock = EPOCH_traderStoredVehiclesCnt select _indexStock;
|
||||
EPOCH_traderStoredVehiclesCnt set [_indexStock, (_existingStock + 1)];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
if !(_newstock == _currentStock) then {
|
||||
_arrchanged = true;
|
||||
if (_newstock > 0) then {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Changed stock of %2 from Trader | _currentStock: %3 | _newstock: %4 | EPOCH_storedVehicleCount: %5 | _storedVehicleLimit: %6",_i,str _item,_currentStock,_newstock,EPOCH_storedVehicleCount,_storedVehicleLimit];
|
||||
(_arr select 1) set [_idx,_newstock];
|
||||
}
|
||||
else {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Removed %2 from Trader | EPOCH_storedVehicleCount: %3 | _storedVehicleLimit: %4",_i,str _item,EPOCH_storedVehicleCount,_storedVehicleLimit];
|
||||
_delete = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_delete) then {
|
||||
(_arr select 0) deleteat _idx;
|
||||
(_arr select 1) deleteat _idx;
|
||||
}
|
||||
else {
|
||||
_idx = _idx + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
EPOCH_storedVehicleCount = 0;
|
||||
|
||||
for "_i" from 0 to (_maxTraderLimit-1) do {
|
||||
_traderSlotIndex = EPOCH_TraderSlots pushBack _i;
|
||||
_randomAIUniform = selectRandom _aiTables;
|
||||
_arr = [[], []];
|
||||
_arrchanged = false;
|
||||
_objHiveKey = format ["%1:%2", (call EPOCH_fn_InstanceID), _i];
|
||||
_response = ["AI_ITEMS", _objHiveKey] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_arr = (_response select 1);
|
||||
if (_arr isEqualTo []) then {
|
||||
_arr = [[], []];
|
||||
};
|
||||
};
|
||||
if (_arr isEqualTo [[], []]) then{
|
||||
_arr = EPOCH_starterTraderItems;
|
||||
_arrchanged = true;
|
||||
};
|
||||
call _TraderItemsClean;
|
||||
|
||||
// Spawn static traders first
|
||||
if (_staticTradersArrCount > 0 && _i < _staticTradersArrCount) then {
|
||||
_staticTrader = _staticTradersArray select _i;
|
||||
_staticTrader params ["_class","_pos","_dir"];
|
||||
if (count (_arr select 0) > (_StaticTraderItemPurge select 0)) then {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Cleaning %2 Items from Trader | before: %3",_i,((count (_arr select 0))*(_StaticTraderItemPurge select 1)/100), count (_arr select 0)];
|
||||
_arrchanged = true;
|
||||
for "_j" from 1 to ((count (_arr select 0))*(_StaticTraderItemPurge select 1)/100) do {
|
||||
_deleteat = (round random (count (_arr select 0)-1));
|
||||
(_arr select 0) deleteAt _deleteat;
|
||||
(_arr select 1) deleteAt _deleteat;
|
||||
};
|
||||
};
|
||||
EPOCH_TraderSlots deleteAt _traderSlotIndex;
|
||||
_agent = createAgent [_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_agent call _TraderInit;
|
||||
_agent setPosATL _pos;
|
||||
if (_arrchanged) then {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Saved",_i];
|
||||
["AI_ITEMS", _objHiveKey, EPOCH_expiresAIdata, _arr] call EPOCH_fnc_server_hiveSETEX;
|
||||
};
|
||||
if (EPOCH_SHOW_TRADERS) then {
|
||||
_markers = ["StaticTrader",_pos] call EPOCH_server_createGlobalMarkerSet;
|
||||
_agent setVariable["MARKER_REF", _markers];
|
||||
};
|
||||
}
|
||||
else {
|
||||
// Spawn dynamic traders
|
||||
_response2 = ["AI", _objHiveKey] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if ((_response2 select 0) == 1 && (_response2 select 1) isEqualType [] && !((_response2 select 1) isEqualTo [])) then {
|
||||
(_response2 select 1) params ["_class","_home","_work"];
|
||||
if (_home isEqualType [] && _work isEqualType []) then {
|
||||
// check schedule
|
||||
_pos = _home;
|
||||
_schedule = [9, 17];
|
||||
if ((_work select 1) isEqualType []) then {
|
||||
_schedule = _work select 1;
|
||||
}
|
||||
else {
|
||||
// diag_log format ["DEBUG INVAILD SCHEDULE: SLOT: %1 CLASS: %2 POS: %3 WORK: %4", _i, _class, _pos, _work];
|
||||
};
|
||||
if (daytime > (_schedule select 0) && daytime < (_schedule select 1)) then {
|
||||
_pos = (_work select 0);
|
||||
};
|
||||
if (!(count (_arr select 0) >= _DynamicTraderRespawnCount) && (nearestobjects [_pos,call EPOCH_JammerClasses,call EPOCH_MaxJammerRange]) isequalto []) then {
|
||||
EPOCH_TraderSlots deleteAt _traderSlotIndex;
|
||||
_agent = createAgent [_class, _pos, [], 0, "NONE"];
|
||||
if !(EPOCH_forceStaticTraders) then {
|
||||
[_agent, _home, _work] execFSM "\epoch_server\system\Trader_brain.fsm";
|
||||
};
|
||||
_dir = random 360;
|
||||
_agent call _TraderInit;
|
||||
if (surfaceiswater _pos) then {
|
||||
_agent setPosASL _pos;
|
||||
}
|
||||
else {
|
||||
_agent setPosATL _pos;
|
||||
};
|
||||
if (_arrchanged) then {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Saved",_i];
|
||||
["AI_ITEMS", _objHiveKey, EPOCH_expiresAIdata, _arr] call EPOCH_fnc_server_hiveSETEX;
|
||||
};
|
||||
if (EPOCH_SHOW_TRADERS) then {
|
||||
_markers = ["DynamicTrader",_pos] call EPOCH_server_createGlobalMarkerSet;
|
||||
_agent setVariable["MARKER_REF", _markers];
|
||||
};
|
||||
}
|
||||
else {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Supressed Trader Load - Too much items (%2) and will respawn",_i,count (_arr select 0)];
|
||||
["AI", _objHiveKey] call EPOCH_fnc_server_hiveDEL;
|
||||
["AI_ITEMS", _objHiveKey] call EPOCH_fnc_server_hiveDEL;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
true
|
@ -0,0 +1,128 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Splits a position into two arrays: Whole number array and decimal array.
|
||||
|
||||
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_traders/EPOCH_server_spawnTraders.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private [ "_serverSettingsConfig","_acceptableBlds","_agent","_aiClass","_aiTables","_buildingHome","_buildingWork","_buildings","_checkBuilding","_config","_endTime","_home",
|
||||
"_homes","_markers","_objHiveKey","_pos","_position","_randomAIUniform","_return","_schedule","_slot","_spawnCount","_startTime","_traderHomes","_usedBuildings","_work",
|
||||
"_WinterDeco","_HelloweenDeco","_TraderDeco","_TraderMinDistance","_traderblockblds","_Traderblocks"
|
||||
];
|
||||
//[[[end]]]
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_TraderGodMode = [_serverSettingsConfig, "TraderGodMode", false] call EPOCH_fnc_returnConfigEntry;
|
||||
_spawnCount = count EPOCH_TraderSlots;
|
||||
_config = (configFile >> "CfgEpoch" >> worldName);
|
||||
if !(isclass _config) then {
|
||||
_config = (configFile >> "CfgEpoch" >> "Default");
|
||||
};
|
||||
_aiTables = getArray(_config >> "traderUniforms");
|
||||
_acceptableBlds = getArray(_config >> "traderBlds");
|
||||
_TraderMinDistance = getnumber(_config >> "TraderMinDistance");
|
||||
if (_TraderMinDistance isEqualto 0) then {
|
||||
_TraderMinDistance = worldsize / 12;
|
||||
};
|
||||
_traderblockblds = getArray(_config >> "traderblockblds");
|
||||
if (_traderblockblds isEqualto []) then {
|
||||
_traderblockblds = ["pier","bridge","fireescape","medevac_house","pillboxbunker","containerine"];
|
||||
};
|
||||
_traderHomes = getArray(_config >> "traderHomes");
|
||||
_TraderDeco = [_serverSettingsConfig, "TraderDeco", true] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
_WinterDeco = (Epoch_ServerRealtime select 1) == 12 && (Epoch_ServerRealtime select 2) > 20 && _TraderDeco;
|
||||
_HelloweenDeco = (((Epoch_ServerRealtime select 1) == 10 && (Epoch_ServerRealtime select 2) >= 24) || ((Epoch_ServerRealtime select 1) == 11 && (Epoch_ServerRealtime select 2) <= 3)) && _TraderDeco;
|
||||
|
||||
_usedBuildings = [];
|
||||
_checkBuilding = {
|
||||
private ["_return"];
|
||||
params ["_building","_aiClass"];
|
||||
_return = !(_building in _usedBuildings);
|
||||
if !(_return) exitWith {_return};
|
||||
_return = !((_building buildingPos -1) isEqualTo []);
|
||||
if !(_return) exitWith {_return};
|
||||
_return = (_building nearEntities [_aiClass, 50]) isEqualTo [];
|
||||
if !(_return) exitWith {_return};
|
||||
_return = ({(tolower (typeOf _building) find _x) > -1} count _traderblockblds) < 1;
|
||||
_return
|
||||
};
|
||||
_Traderblocks = [];
|
||||
{
|
||||
if (alive _x) then {
|
||||
_Traderblocks pushback [getpos _x, _TraderMinDistance];
|
||||
};
|
||||
} foreach EPOCH_Traders;
|
||||
|
||||
for "_i" from 1 to _spawnCount do {
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 0, 0, 1000, 0, _Traderblocks] call BIS_fnc_findSafePos;
|
||||
if (count _position == 2) then {
|
||||
_randomAIUniform = selectRandom _aiTables;
|
||||
_aiClass = "C_man_1";
|
||||
_homes = (nearestObjects[_position, _traderHomes, 500]) select {[_x,_aiClass] call _checkBuilding};
|
||||
if !(_homes isEqualTo []) then {
|
||||
_buildingHome = selectRandom _homes;
|
||||
_usedBuildings pushBack _buildingHome;
|
||||
_buildings = (nearestObjects[_buildingHome, _acceptableBlds, 500]) select {[_x,_aiClass] call _checkBuilding};
|
||||
if !(_buildings isEqualTo []) then {
|
||||
_buildingWork = selectRandom _buildings;
|
||||
_usedBuildings pushBack _buildingWork;
|
||||
_home = selectRandom (_buildingHome buildingPos -1);
|
||||
_work = selectRandom (_buildingWork buildingPos -1);
|
||||
if ((nearestobjects [_home,call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) isequalto [] && (nearestobjects [_work,call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) isequalto []) then {
|
||||
_startTime = floor(random 16);
|
||||
_endTime = _startTime + 8;
|
||||
_schedule = [_startTime, _endTime];
|
||||
_pos = _home;
|
||||
if (daytime > _startTime && daytime < _endTime) then {
|
||||
_pos = _work;
|
||||
};
|
||||
_agent = createAgent [_aiClass, _pos, [], 0, "CAN_COLLIDE"];
|
||||
addToRemainsCollector[_agent];
|
||||
_agent addUniform _randomAIUniform;
|
||||
if !(EPOCH_forceStaticTraders) then {
|
||||
[_agent, _home, [_work, _schedule]] execFSM "\epoch_server\system\Trader_brain.fsm";
|
||||
};
|
||||
if (_HelloweenDeco) then {
|
||||
removeHeadgear _agent;
|
||||
_agent addHeadgear (selectrandom ["thor_mask_epoch","iron_mask_epoch","wolf_mask_epoch","pkin_mask_epoch","clown_mask_epoch","hockey_mask_epoch","plague_mask_epoch","ghostface_mask_epoch","skull_mask_epoch","witch_mask_epoch"]);
|
||||
}
|
||||
else {
|
||||
if (_WinterDeco) then {
|
||||
removeHeadgear _agent;
|
||||
_agent addHeadgear "santa_hat_epoch";
|
||||
};
|
||||
};
|
||||
_agent allowdamage !_TraderGodMode;
|
||||
if (surfaceiswater _pos) then {
|
||||
_agent setPosASL _pos;
|
||||
}
|
||||
else {
|
||||
_agent setPosATL _pos;
|
||||
};
|
||||
_slot = EPOCH_TraderSlots deleteAt 0;
|
||||
_agent setVariable["AI_SLOT", _slot, true];
|
||||
_agent setVariable["AI_ITEMS", EPOCH_starterTraderItems, true];
|
||||
_objHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _slot];
|
||||
["AI_ITEMS", _objHiveKey, EPOCH_expiresAIdata, EPOCH_starterTraderItems] call EPOCH_fnc_server_hiveSETEX;
|
||||
_agent addEventHandler["Killed", { _this call EPOCH_server_traderKilled; }];
|
||||
["AI", _objHiveKey, [_aiClass, _home, [_work, _schedule]] ] call EPOCH_fnc_server_hiveSET;
|
||||
if (EPOCH_SHOW_TRADERS) then {
|
||||
_markers = ["NewDynamicTrader",_pos] call EPOCH_server_createGlobalMarkerSet;
|
||||
_agent setVariable["MARKER_REF", _markers];
|
||||
};
|
||||
EPOCH_Traders pushback _agent;
|
||||
_Traderblocks pushback [getpos _agent, _TraderMinDistance];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
true
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Epoch Mod - Server side effect crypto main function
|
||||
|
||||
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_trading/EPOCH_server_effectCrypto.sqf
|
||||
|
||||
Example:
|
||||
[_player,100] call EPOCH_server_effectCrypto; // adds 100
|
||||
[_player,-100] call EPOCH_server_effectCrypto; // removes 100
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJECT - player
|
||||
_this select 1: NUMBER - amount to add to existing crypto
|
||||
Returns:
|
||||
MIXED
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cIndex","_current_crypto","_vars"];
|
||||
//[[[end]]]
|
||||
params [["_player",objNull,[objNull]],["_crypto",0,[0]] ];
|
||||
if (!isNull _player && isPlayer _player) then {
|
||||
// get index of custom variable
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
// get custom variables
|
||||
_vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
// select current value
|
||||
_current_crypto = _vars select _cIndex;
|
||||
// get min and max limits for selected custom variable
|
||||
(EPOCH_customVarLimits select _cIndex) params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
// add input number to existing variable while keeping it within min and max range.
|
||||
_current_crypto = ((_current_crypto + _crypto) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
// send final value back to the player
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
// set final variable
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
// save modified custom variables array
|
||||
_player setVariable["VARS", _vars];
|
||||
};
|
@ -0,0 +1,348 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors: He-Man - Ignatz-Gaming
|
||||
|
||||
Description:
|
||||
NPC trade mech
|
||||
|
||||
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_trading/EPOCH_server_makeNPCTrade.sqf
|
||||
*/
|
||||
|
||||
private [ "_MaxBankDebit","_SkipOut","_VAL","_aiItems","_bankBalance","_bankData","_cIndex","_config","_currQty","_current_crypto","_current_cryptoRaw","_errorMsg","_final_location","_foundSmoke",
|
||||
"_group","_helipad","_helipads","_item","_itemClasses","_itemQty","_itemQtys","_itemTax","_itemWorth","_itemsIn","_itemsOut","_lockOwner","_makeTradeIn","_message","_nearByHolder",
|
||||
"_objHiveKey","_objOwner","_playerCryptoLimit","_playerGroup","_playerNetID","_playerUID","_position","_qtyIndex","_response","_return","_returnIn","_returnOut","_road",
|
||||
"_serverSettingsConfig","_slot","_smoke","_tax","_tmpposition","_tradeIn","_tradeOut","_tradeQtyTotal","_tradeTotal","_vars","_vehHiveKey","_vehObj","_vehSlot","_vehicle","_vehicleBought",
|
||||
"_vehicleSold","_vehicles","_vehslot","_wH","_wHPos","_wp","_kIndex","_playerCStats","_playerKarma","_playerKarmaAdj","_EnableTempVehTrade","_MaxVehTradeDist"
|
||||
];
|
||||
params ["_trader","_itemsIn","_itemsOut","_player",["_token","",[""]] ];
|
||||
|
||||
_playerUID = getplayeruid _player;
|
||||
|
||||
_EnableTempVehTrade = ["CfgEpochClient", "EnableTempVehTrade", false] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_vehicleSold = false;
|
||||
_vehicleBought = false;
|
||||
|
||||
_returnIn = [];
|
||||
_returnOut = [];
|
||||
_final_location = [];
|
||||
|
||||
if (isNull _trader) exitWith{};
|
||||
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
||||
if (_player distance _trader > 20) exitWith{};
|
||||
|
||||
_slot = _trader getVariable["AI_SLOT", -1];
|
||||
if (_slot != -1) then {
|
||||
|
||||
_tradeTotal = 0;
|
||||
_tradeIn = 0;
|
||||
_tradeOut = 0;
|
||||
_tradeQtyTotal = 0;
|
||||
_message = "";
|
||||
_SkipOut = false;
|
||||
|
||||
_config = 'CfgPricing' call EPOCH_returnConfig;
|
||||
|
||||
// get vars array and current Crypto value
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
_current_cryptoRaw = _current_crypto;
|
||||
|
||||
// SELL ITEMS TO TRADER
|
||||
_aiItems = _trader getVariable["AI_ITEMS", [[], []] ];
|
||||
_itemClasses = _aiItems select 0;
|
||||
_itemQtys = _aiItems select 1;
|
||||
_MaxVehTradeDist = ["CfgEpochClient", "MaxVehTradeDist", 30] call EPOCH_fnc_returnConfigEntryV2;
|
||||
{
|
||||
_x params ["_item","_itemQty"];
|
||||
if (isClass (_config >> _item)) then {
|
||||
_itemWorth = getNumber(_config >> _item >> "price");
|
||||
_maxrnd = 1;
|
||||
if ([_item,"cfgMagazines"] call Epoch_fnc_isAny) then {
|
||||
_maxrnd = getnumber (configfile >> "cfgMagazines" >> _item >> "count");
|
||||
};
|
||||
_itemWorth = round (_itemWorth*(_itemQty/_maxrnd));
|
||||
_makeTradeIn = false;
|
||||
if (_item isKindOf "Air" || _item isKindOf "Ship" || _item isKindOf "LandVehicle" || _item isKindOf "Tank") then{
|
||||
_vehicles = (nearestobjects [_trader,[_item],_MaxVehTradeDist]) select {owner _x == owner _player && alive _x};
|
||||
if !(_vehicles isEqualTo[]) then {
|
||||
_vehicle = _vehicles select 0;
|
||||
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
|
||||
if (!_vehicleSold && (_vehSlot != "ABORT" || _EnableTempVehTrade)) then {
|
||||
_vehicleSold = true;
|
||||
_makeTradeIn = true;
|
||||
if (_vehSlot == "ABORT") exitwith {
|
||||
_itemQty = 0;
|
||||
_itemsIn set [_foreachindex,[_item,_itemQty]];
|
||||
removeFromRemainsCollector [_vehicle];
|
||||
deleteVehicle _vehicle;
|
||||
};
|
||||
_BaseClass = _vehicle getvariable ["VEHICLE_BaseClass",""];
|
||||
if !(_BaseClass isequalto "") then {
|
||||
_item = _BaseClass;
|
||||
_itemsIn set [_foreachindex,[_item,_itemQty]];
|
||||
};
|
||||
removeFromRemainsCollector [_vehicle];
|
||||
deleteVehicle _vehicle;
|
||||
_vehHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _vehSlot];
|
||||
_VAL = [];
|
||||
["Vehicle", _vehHiveKey, _VAL] call EPOCH_fnc_server_hiveSET;
|
||||
EPOCH_VehicleSlots pushBack _vehSlot;
|
||||
missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true];
|
||||
};
|
||||
};
|
||||
}
|
||||
else {
|
||||
_makeTradeIn = true;
|
||||
};
|
||||
if (_makeTradeIn) then {
|
||||
_returnIn pushBack [_item,_itemQty];
|
||||
_tradeIn = _tradeIn + _itemWorth;
|
||||
_current_crypto = _current_crypto + _itemWorth;
|
||||
_tradeQtyTotal = _tradeQtyTotal + _itemQty;
|
||||
if !(_item in ([_serverSettingsConfig, "TraderItemsDeleteInstant", []] call EPOCH_fnc_returnConfigEntry)) then {
|
||||
_qtyIndex = _itemClasses find _item;
|
||||
if (_qtyIndex == -1) then {
|
||||
_itemClasses pushBack _item;
|
||||
_itemQtys pushBack _itemQty;
|
||||
} else {
|
||||
_currQty = _itemQtys select _qtyIndex;
|
||||
_itemQtys set [_qtyIndex, (_currQty + _itemQty)];
|
||||
};
|
||||
};
|
||||
// send karma stat to seller
|
||||
_kIndex = EPOCH_communityStats find "Karma";
|
||||
_playerCStats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
_playerKarma = _playerCStats select _kIndex;
|
||||
_playerKarmaAdj = 1;
|
||||
if(_playerKarma < 0)then{_playerKarmaAdj = -1};
|
||||
[_player, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
};
|
||||
} forEach _itemsIn;
|
||||
_response = ["Bank", _playerUID] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_bankData = _response select 1;
|
||||
if !(_bankData isEqualTo[]) then {
|
||||
_MaxBankDebit = [_serverSettingsConfig, "MaxBankDebitforTrade", -999999] call EPOCH_fnc_returnConfigEntry;
|
||||
_bankBalance = _bankData select 0;
|
||||
if (_bankBalance < _MaxBankDebit) then {
|
||||
if (_tradeIn > 0) then {
|
||||
_bankBalance = _bankBalance + _tradeIn;
|
||||
_return = ["Bank", _playerUID, EPOCH_expiresBank, [_bankBalance]] call EPOCH_fnc_server_hiveSETEX;
|
||||
_message = _message + "Items sold, but the Money goes to your Bank - to much Bank-Debit";
|
||||
}
|
||||
else {
|
||||
_message = _message + "Purchase not possible - to much Bank-Debit";
|
||||
};
|
||||
_current_crypto = _current_cryptoRaw;
|
||||
_tradeIn = 0;
|
||||
_itemsIn = [];
|
||||
_itemsOut = [];
|
||||
_SkipOut = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (!_SkipOut) then {
|
||||
{
|
||||
_x params ["_item","_itemQty"];
|
||||
if (isClass (_config >> _item)) then{
|
||||
_itemWorth = getNumber(_config >> _item >> "price");
|
||||
_itemTax = getNumber(_config >> _item >> "tax");
|
||||
_tax = _itemWorth * (EPOCH_taxRate + _itemTax);
|
||||
_itemWorth = ceil (_itemWorth + _tax);
|
||||
_maxrnd = 1;
|
||||
if ([_item,"cfgMagazines"] call Epoch_fnc_isAny) then {
|
||||
_maxrnd = getnumber (configfile >> "cfgMagazines" >> _item >> "count");
|
||||
};
|
||||
_itemWorth = round (_itemWorth*(_itemQty/_maxrnd));
|
||||
_qtyIndex = _itemClasses find _item;
|
||||
if (_qtyIndex != -1) then {
|
||||
_currQty = _itemQtys select _qtyIndex;
|
||||
if (_currQty >= _itemQty) then {
|
||||
if (_current_crypto >= _itemWorth) then {
|
||||
if (_item isKindOf "Air" || _item isKindOf "Ship" || _item isKindOf "LandVehicle" || _item isKindOf "Tank") then{
|
||||
if (!_vehicleBought) then {
|
||||
if !(EPOCH_VehicleSlots isEqualTo[]) then {
|
||||
_position = getPosATL _player;
|
||||
_helipad = nearestObjects[_player, ["Land_HelipadEmpty_F", "Land_HelipadCircle_F"], 100];
|
||||
_helipads = [];
|
||||
_smoke = nearestObject[_player, "SmokeShell"];
|
||||
if (!isNull _smoke) then {
|
||||
_helipad pushBack _smoke;
|
||||
};
|
||||
if (_item isKindOf "Ship") then {
|
||||
{
|
||||
if (surfaceIsWater (getposATL _x)) then {
|
||||
_helipads pushBack _x;
|
||||
}
|
||||
} forEach _helipad;
|
||||
}
|
||||
else {
|
||||
{
|
||||
if !(surfaceIsWater (getposATL _x)) then {
|
||||
_helipads pushBack _x;
|
||||
}
|
||||
} forEach _helipad;
|
||||
};
|
||||
if !(_helipads isEqualTo[]) then {
|
||||
_foundSmoke = false;
|
||||
{
|
||||
if (_x isKindOf "SmokeShell") then {
|
||||
_objOwner = owner _x;
|
||||
if (_objOwner == owner _player) then {
|
||||
_position = getPosATL _x;
|
||||
_foundSmoke = true;
|
||||
}
|
||||
else {
|
||||
{
|
||||
if (_objOwner == owner _x) exitWith{
|
||||
_position = getPosATL _x;
|
||||
_foundSmoke = true;
|
||||
};
|
||||
} forEach (units _player);
|
||||
};
|
||||
};
|
||||
if (_foundSmoke) exitWith {};
|
||||
} forEach _helipads;
|
||||
if !(_foundSmoke) then {
|
||||
_position = getPosATL (_helipads select 0);
|
||||
};
|
||||
}
|
||||
else {
|
||||
_tmpposition = [];
|
||||
if (_item isKindOf "Ship") then {
|
||||
_tmpposition = [_position, 20, 150, 5, 0, 1000, 1] call BIS_fnc_findSafePos;
|
||||
_tmpposition = [_tmpposition, 0, 60, 10, 2, 1000, 0] call BIS_fnc_findSafePos;
|
||||
}
|
||||
else {
|
||||
_tmpposition = [_position, 20, 120, 5, 0, 2000, 0] call BIS_fnc_findSafePos;
|
||||
};
|
||||
if ((count _tmpposition) == 2) then {
|
||||
_tmpposition set [2, 0];
|
||||
if (surfaceIsWater _tmpposition) then {
|
||||
_tmpposition = ATLtoASL _tmpposition;
|
||||
};
|
||||
_position = _tmpposition;
|
||||
}
|
||||
else {
|
||||
_road = [getpos _player,100] call BIS_fnc_nearestRoad;
|
||||
if (!isnull _road) then {
|
||||
_position = getpos _road;
|
||||
};
|
||||
};
|
||||
};
|
||||
_vehslot = EPOCH_VehicleSlots select 0;
|
||||
EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_vehslot];
|
||||
missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true];
|
||||
_vehicleBought = true;
|
||||
_lockOwner = getPlayerUID _player;
|
||||
_playerGroup = _player getVariable["GROUP", ""];
|
||||
if (_playerGroup != "") then {
|
||||
_lockOwner = _playerGroup;
|
||||
};
|
||||
_vehObj = [_item,_position,random 360,true,_vehslot,_lockOwner,"NONE",false,false] call EPOCH_spawn_vehicle;
|
||||
_final_location = getPosATL _vehObj;
|
||||
_group = group _player;
|
||||
_wp = _group addWaypoint [_final_location, 0];
|
||||
deleteWaypoint [_group, 0];
|
||||
_returnOut pushBack [_item,_itemQty];
|
||||
_itemQtys set[_qtyIndex, (_currQty - _itemQty)];
|
||||
_tradeOut = _tradeOut - _itemWorth;
|
||||
_current_crypto = _current_crypto - _itemWorth;
|
||||
_tradeQtyTotal = _tradeQtyTotal + _itemQty;
|
||||
}
|
||||
else {
|
||||
_errorMsg = "Failed to purchase vehicle.";
|
||||
[_errorMsg, 5] remoteExec ['Epoch_message',_player];
|
||||
};
|
||||
};
|
||||
}
|
||||
else {
|
||||
if (_item isKindOf "Bag_Base") then {
|
||||
_wH = objNull;
|
||||
_nearByHolder = nearestObjects [_player,["groundWeaponHolder"],3];
|
||||
if (_nearByHolder isEqualTo []) then {
|
||||
_wHPos = _player modelToWorld [0,1,0];
|
||||
if (surfaceIsWater _wHPos) then {
|
||||
_wHPos = ASLToATL _wHPos;
|
||||
};
|
||||
_wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"];
|
||||
}
|
||||
else {
|
||||
_wH = _nearByHolder select 0;
|
||||
};
|
||||
_wH addBackpackCargoGlobal [_item,1];
|
||||
};
|
||||
_returnOut pushBack [_item,_itemQty];
|
||||
_itemQtys set [_qtyIndex, (_currQty - _itemQty)];
|
||||
_tradeOut = _tradeOut - _itemWorth;
|
||||
_current_crypto = _current_crypto - _itemWorth;
|
||||
_tradeQtyTotal = _tradeQtyTotal + _itemQty;
|
||||
};
|
||||
// send karma stat to buyer
|
||||
_kIndex = EPOCH_communityStats find "Karma";
|
||||
_playerCStats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
|
||||
_playerKarma = _playerCStats select _kIndex;
|
||||
_playerKarmaAdj = 1;
|
||||
if(_playerKarma < 0)then{_playerKarmaAdj = -1};
|
||||
[_player, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _itemsOut;
|
||||
};
|
||||
if !(_itemsIn isEqualTo []) then {
|
||||
if (_itemsIn isEqualTo _returnIn) then {
|
||||
_message = _message + "All Items sold";
|
||||
}
|
||||
else {
|
||||
_message = _message + "Not all Items sold";
|
||||
};
|
||||
};
|
||||
if !(_itemsOut isEqualTo []) then {
|
||||
if (_itemsOut isEqualTo _returnOut) then {
|
||||
if !(_message isequalto "") then {
|
||||
_message = _message + " | ";
|
||||
};
|
||||
_message = _message + "All Items purchased";
|
||||
}
|
||||
else {
|
||||
if !(_message isequalto "") then {
|
||||
_message = _message + " / ";
|
||||
};
|
||||
_message = _message + "Not all Items purchased";
|
||||
};
|
||||
};
|
||||
_tradeTotal = _tradeIn + _tradeOut;
|
||||
if !(_returnIn isequalto [] && _returnOut isEqualTo []) then {
|
||||
_trader setVariable["AI_ITEMS", [_itemClasses, _itemQtys], true];
|
||||
_objHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _slot];
|
||||
["AI_ITEMS", _objHiveKey, EPOCH_expiresAIdata, [_itemClasses, _itemQtys]] call EPOCH_fnc_server_hiveSETEX;
|
||||
if !(_tradeTotal isequalto 0) then {
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
_current_crypto = ((_current_cryptoRaw + _tradeTotal) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable["VARS", _vars];
|
||||
|
||||
// Update Player Stats
|
||||
_kIndex = EPOCH_communityStats find "NPCTrades";
|
||||
if (_kIndex > -1) then {
|
||||
[_player, "NPCTrades", 1, true] call EPOCH_server_updatePlayerStats;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Send completed trade back to player
|
||||
[_returnIn, _returnOut,_message] remoteexec ["EPOCH_NpcTrade_return",_player];
|
||||
};
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Epoch Mod P2P Trading
|
||||
|
||||
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_trading/EPOCH_server_makeTrade.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cIndex","_current_crypto1","_current_crypto2","_overFlowItems","_player1_vars","_player2_vars","_playerCryptoLimit","_trade1","_trade2"];
|
||||
//[[[end]]]
|
||||
params ["_player1", "_player2","_array","_tradeOffer",["_token","",[""]] ];
|
||||
|
||||
if (isNull _player2) exitWith{};
|
||||
if !([_player1, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (_player1 distance _player2 > 10) exitWith{};
|
||||
|
||||
if ((_player1 getVariable["currentTradeKey", -1]) isEqualto (_player2 getVariable["currentTradeKey", -2])) then{
|
||||
if ((_player1 getVariable["Accept", false]) && (_player2 getVariable["Accept", false])) then{
|
||||
|
||||
_trade1 = _player1 getVariable["Offer", [[], 0]];
|
||||
_trade2 = _player2 getVariable["Offer", [[], 0]];
|
||||
|
||||
_trade1 params ["_tradeOffer1","_tradeCryptoOffer1"];
|
||||
_trade2 params ["_tradeOffer2","_tradeCryptoOffer2"];
|
||||
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_player1_vars = _player1 getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_player2_vars = _player2 getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto1 = _player1_vars select _cIndex;
|
||||
_current_crypto2 = _player2_vars select _cIndex;
|
||||
|
||||
// test this may work since players crypto is
|
||||
if (_current_crypto1 >= _tradeCryptoOffer1 && _current_crypto2 >= _tradeCryptoOffer2) then{
|
||||
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
|
||||
if (_tradeCryptoOffer1 > 0) then{
|
||||
|
||||
_current_crypto1 = ((_current_crypto1 - _tradeCryptoOffer1) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
// send to player
|
||||
_current_crypto1 remoteExec ['EPOCH_effectCrypto',_player1];
|
||||
_player1_vars set[_cIndex, _current_crypto1];
|
||||
_player1 setVariable["VARS", _player1_vars];
|
||||
};
|
||||
|
||||
if !(_tradeOffer2 isEqualTo[]) then{
|
||||
_overFlowItems = createVehicle["groundWeaponHolder", getPosATL _player1, [], 0, "CAN_COLLIDE"];
|
||||
{
|
||||
if ([_x, "CfgWeapons"] call EPOCH_fnc_isAny) then{
|
||||
_overFlowItems addItemCargoGlobal[_x, 1];
|
||||
} else {
|
||||
_overFlowItems addMagazineCargoGlobal[_x, 1];
|
||||
};
|
||||
} forEach _tradeOffer2;
|
||||
};
|
||||
|
||||
if (_tradeCryptoOffer2 > 0) then{
|
||||
|
||||
_current_crypto1 = ((_current_crypto1 + _tradeCryptoOffer2) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
// send to player
|
||||
_current_crypto1 remoteExec ['EPOCH_effectCrypto',_player1];
|
||||
_player1_vars set[_cIndex, _current_crypto1];
|
||||
_player1 setVariable["VARS", _player1_vars];
|
||||
};
|
||||
|
||||
diag_log format["ADMIN: P1:%1 P2:%2 In:%3:%4 Out:%5:%6", _player1, _player2, _tradeOffer2, _tradeCryptoOffer2, _tradeOffer1, _tradeCryptoOffer1];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Epoch Mod - Server side take crypto
|
||||
|
||||
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_trading/EPOCH_server_makeTrade.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_getCrypto"];
|
||||
//[[[end]]]
|
||||
params ["_player",["_token","",[""]],["_CryptoItems",[]]];
|
||||
|
||||
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
||||
|
||||
_getCrypto = 0;
|
||||
{
|
||||
if (_player distance _x < 10) then {
|
||||
_getCrypto = _getCrypto + (_x getVariable ["Crypto", 0]);
|
||||
_x setVariable ["Crypto", nil, true];
|
||||
if (_x getvariable ["RemoveOnTake",false]) then {
|
||||
deletevehicle _x;
|
||||
};
|
||||
};
|
||||
} foreach _CryptoItems;
|
||||
if (_getCrypto > 0) then {
|
||||
[_player,_getCrypto] call EPOCH_server_effectCrypto;
|
||||
diag_log format["Epoch: ADMIN: %1 picked up %2 Crypto at %3", getPlayerUID _player, _getCrypto, getposATL _player];
|
||||
};
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Epoch Mod - Server side take crypto
|
||||
|
||||
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_trading/EPOCH_server_tradeRequest.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_tradeKey"];
|
||||
//[[[end]]]
|
||||
params ["_target","_source",["_token","",[""]] ];
|
||||
|
||||
if !([_source, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _target) exitWith{};
|
||||
if (_source distance _target > 10) exitWith{};
|
||||
|
||||
// Generate Unique Key good for only this trade request between these two players.
|
||||
_tradeKey = floor(diag_tickTime + random 9999);
|
||||
_source setVariable["currentTradeKey", _tradeKey];
|
||||
_target setVariable["currentTradeKey", _tradeKey];
|
||||
|
||||
// send to player
|
||||
_source remoteExec ['EPOCH_tradeRequest',_target];
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Fill vehicle inventory
|
||||
|
||||
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_vehicle/EPOCH_fill_inventory.sqf
|
||||
*/
|
||||
params ["_vehicle","_type","_class","_qty"];
|
||||
if (!isNull _vehicle) then {
|
||||
switch (_type) do {
|
||||
case 0: { _vehicle addWeaponCargoGlobal[_class, _qty] };
|
||||
case 1: { _vehicle addBackpackCargoGlobal[_class, _qty] };
|
||||
case 2: { _vehicle addMagazineCargoGlobal[_class, _qty] };
|
||||
case 3: { _vehicle addItemCargoGlobal[_class, _qty] };
|
||||
};
|
||||
};
|
@ -0,0 +1,160 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Fill vehicle inventory
|
||||
|
||||
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_vehicle/EPOCH_load_storage.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_ExceptedBaseObjects","_AutoLockStorages","_IndestructibleBaseObjects","_UseIndestructible","_arr","_attachments","_availableColorsConfig","_cfgBaseBuilding","_class","_class_raw","_color","_colors","_count","_damage","_diag","_dir","_inventory","_location","_magazineName","_magazineSize","_magazineSizeMax","_marker","_objQty","_objType","_objTypes","_qty","_response","_selections","_serverSettingsConfig","_storageSlotIndex","_textureSelectionIndex","_textures","_vehHiveKey","_vehicle","_wMags","_wMagsArray","_worldspace","_wsCount"];
|
||||
//[[[end]]]
|
||||
params [["_maxStorageLimit",0]];
|
||||
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_UseIndestructible = [_serverSettingsConfig, "UseIndestructible", false] call EPOCH_fnc_returnConfigEntry;
|
||||
_IndestructibleBaseObjects = [_serverSettingsConfig, "IndestructibleBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_AutoLockStorages = [_serverSettingsConfig, "AutoLockStorages", false] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
_diag = diag_tickTime;
|
||||
EPOCH_StorageSlots = [];
|
||||
EPOCH_activeGardens = [];
|
||||
EPOCH_activeSolars = [];
|
||||
for "_i" from 1 to _maxStorageLimit do {
|
||||
_storageSlotIndex = EPOCH_StorageSlots pushBack str(_i);
|
||||
_vehHiveKey = format ["%1:%2", (call EPOCH_fn_InstanceID), _i];
|
||||
_response = ["Storage", _vehHiveKey] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_arr = _response select 1;
|
||||
if !(_arr isEqualTo []) then {
|
||||
EPOCH_StorageSlots deleteAt _storageSlotIndex;
|
||||
_class_raw = _arr select 0;
|
||||
_damage = _arr select 2;
|
||||
_inventory = _arr select 3;
|
||||
|
||||
// legacy change class
|
||||
_class = switch (_class_raw) do {
|
||||
case "LockBoxProxy_EPOCH": { "LockBox_EPOCH" };
|
||||
case "SafeProxy_EPOCH": { "Safe_EPOCH" };
|
||||
default { _class_raw };
|
||||
};
|
||||
|
||||
if !(_inventory isEqualType []) then { _inventory = []; };
|
||||
|
||||
_worldspace = _arr select 1;
|
||||
_worldspace params ["_pos","_vectordir","_vectorup",["_useworld",false]];
|
||||
_vectordirup = [_vectordir,_vectorup];
|
||||
|
||||
// increased position precision
|
||||
if (count _pos == 2) then{
|
||||
_pos = (_pos select 0) vectorAdd(_pos select 1);
|
||||
};
|
||||
|
||||
_vehicle = createVehicle[_class, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
|
||||
// find gardens
|
||||
if (_class isEqualTo "Garden_EPOCH") then {
|
||||
EPOCH_activeGardens pushBack _vehicle;
|
||||
};
|
||||
|
||||
if (_class in ["SolarCharger_EPOCH","SolarChargerXL_EPOCH"]) then {
|
||||
EPOCH_activeSolars pushBack _vehicle;
|
||||
};
|
||||
|
||||
if (_UseIndestructible) then {
|
||||
if ({_vehicle iskindof _x} count _ExceptedBaseObjects == 0) then {
|
||||
{
|
||||
if (_vehicle iskindof _x) exitwith {
|
||||
_vehicle allowdamage false;
|
||||
};
|
||||
} foreach _IndestructibleBaseObjects;
|
||||
};
|
||||
};
|
||||
|
||||
if (_useworld) then {
|
||||
_vehicle setposworld _pos;
|
||||
}
|
||||
else {
|
||||
_vehicle setposATL _pos;
|
||||
};
|
||||
|
||||
_vehicle setVectorDirAndUp _vectordirup;
|
||||
|
||||
// temp set damage to mark for maint
|
||||
_vehicle setDamage 0.01;
|
||||
|
||||
_vehicle setVariable ["STORAGE_SLOT", str(_i), true];
|
||||
|
||||
if (isDamageAllowed _vehicle) then {
|
||||
_vehicle call EPOCH_server_storageInit;
|
||||
};
|
||||
if (count _arr >= 5) then {
|
||||
_color = _arr select 4;
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
_availableColorsConfig = _cfgBaseBuilding >> _class >> "availableColors";
|
||||
if (isArray _availableColorsConfig) then {
|
||||
_colors = getArray(_availableColorsConfig);
|
||||
_textureSelectionIndex = _cfgBaseBuilding >> _class >> "textureSelectionIndex";
|
||||
_selections = if (isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] };
|
||||
_count = (count _colors)-1;
|
||||
{
|
||||
_textures = _colors select 0;
|
||||
if (_count >= _forEachIndex) then {
|
||||
_textures = _colors select _forEachIndex;
|
||||
};
|
||||
_vehicle setObjectTextureGlobal [_x, (_textures select _color)];
|
||||
} forEach _selections;
|
||||
_vehicle setVariable ["STORAGE_TEXTURE", _color];
|
||||
};
|
||||
};
|
||||
|
||||
if (count _arr >= 6) then {
|
||||
if (_class isKindOf 'Constructions_lockedstatic_F') then{
|
||||
// set locked state of secure storage
|
||||
if (((_arr select 6) != -1) || _AutoLockStorages) then {
|
||||
_vehicle setVariable["EPOCH_Locked", true, true];
|
||||
}
|
||||
else {
|
||||
_vehicle setVariable["EPOCH_Locked", false, true];
|
||||
if (_vehicle iskindof "GunSafe_EPOCH") then {
|
||||
{
|
||||
_vehicle animate _x;
|
||||
} foreach [['handle1',1],['handle2',1],['door1',1],['door2',1]];
|
||||
};
|
||||
};
|
||||
_vehicle setVariable ["STORAGE_OWNERS", _arr select 5];
|
||||
};
|
||||
};
|
||||
|
||||
clearWeaponCargoGlobal _vehicle;
|
||||
clearMagazineCargoGlobal _vehicle;
|
||||
clearBackpackCargoGlobal _vehicle;
|
||||
clearItemCargoGlobal _vehicle;
|
||||
|
||||
if !(_inventory isEqualTo []) then {
|
||||
[_vehicle,_inventory] call EPOCH_server_CargoFill;
|
||||
};
|
||||
|
||||
if (EPOCH_DEBUG_VEH) then {
|
||||
_marker = createMarker [str(_pos) , _pos];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _class;
|
||||
_marker setMarkerColor "ColorBlue";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
missionNamespace setVariable ['EPOCH_StorageSlotsCount', count EPOCH_StorageSlots, true];
|
||||
|
||||
diag_log format ["Epoch: Storage SPAWN TIMER %1 slots left: %2", diag_tickTime - _diag, EPOCH_StorageSlotsCount];
|
||||
|
||||
true
|
@ -0,0 +1,257 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Load Vehicles
|
||||
|
||||
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_vehicle/EPOCH_load_vehicles.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_actualHitpoints","_allHitpoints","_allVehicles","_allowDamage","_arrNum","_availableColorsConfig","_cfgEpochVehicles","_check","_class","_colors","_count","_dataFormat","_dataFormatCount","_diag","_disableVehicleTIE","_dmg","_found","_immuneIfStartInBase","_jammerOwner","_jammers","_location","_lockedOwner","_marker","_nearestJammer","_removemagazinesturret","_removeweapons","_response","_selections","_serverSettingsConfig","_textureSelectionIndex","_textures","_vehHiveKey","_vehLockHiveKey","_vehicle","_vehicleDynamicSimulationSystem","_vehicleSlotIndex"];
|
||||
//[[[end]]]
|
||||
params [["_maxVehicleLimit",0]];
|
||||
|
||||
_diag = diag_tickTime;
|
||||
_dataFormat = ["", [], 0, [], 0, [], [], 0, "", "", []];
|
||||
_dataFormatCount = count _dataFormat;
|
||||
EPOCH_VehicleSlots = [];
|
||||
_allVehicles = [];
|
||||
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_immuneIfStartInBase = [_serverSettingsConfig, "immuneIfStartInBase", true] call EPOCH_fnc_returnConfigEntry;
|
||||
_vehicleDynamicSimulationSystem = [_serverSettingsConfig, "vehicleDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
_removeweapons = [_serverSettingsConfig, "removevehweapons", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_removemagazinesturret = [_serverSettingsConfig, "removevehmagazinesturret", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_disableVehicleTIE = [_serverSettingsConfig, "disableVehicleTIE", true] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
for "_i" from 1 to _maxVehicleLimit do {
|
||||
_vehicleSlotIndex = EPOCH_VehicleSlots pushBack str(_i);
|
||||
|
||||
_vehHiveKey = format ["%1:%2", call EPOCH_fn_InstanceID,_i];
|
||||
(["Vehicle", _vehHiveKey] call EPOCH_fnc_server_hiveGETRANGE) params [["_status",0],["_arr",[]]];
|
||||
if (_status isEqualTo 1 && _arr isEqualType []) then {
|
||||
if (_arr isEqualTo []) exitwith {};
|
||||
_arrNum = count _arr;
|
||||
|
||||
// New Upgrade System adds to DB array, check and correct older saved vehicles
|
||||
if (_arrNum < _dataFormatCount) then {
|
||||
{
|
||||
_check = _arr select _foreachindex;
|
||||
if (isnil '_check') then {
|
||||
_arr pushback (_dataFormat select _foreachindex);
|
||||
};
|
||||
} foreach _dataFormat;
|
||||
// recount array
|
||||
_arrNum = count _arr;
|
||||
};
|
||||
|
||||
if (_arrNum == _dataFormatCount) then {
|
||||
|
||||
// Validate and replace invaild data
|
||||
{
|
||||
if !((_arr select _forEachIndex) isEqualType _x) then {_arr set[_forEachIndex, _x]};
|
||||
} forEach _dataFormat;
|
||||
|
||||
_arr params ["_class","_worldspace","_damage","_hitpoints","_fuel","_inventory","_ammo","_color","_baseClass",["_plateNumber",""],["_Textures",[]]];
|
||||
|
||||
if (_class != "" && _damage < 1) then {
|
||||
// remove location from worldspace and set to new var
|
||||
_worldspace params [["_location",[]],["_VectorDir",[0,0,0]],["_VectorUp",[0,0,1]],["_useposworld",false]];
|
||||
if !(_location isEqualTo []) then {
|
||||
// increased position precision
|
||||
if (count _location == 2) then{
|
||||
_location = (_location select 0) vectorAdd (_location select 1);
|
||||
};
|
||||
|
||||
// temp for changes in class names
|
||||
_found = ["O_Heli_Transport_04_F","O_Heli_Transport_04_bench_F","O_Heli_Transport_04_box_F","O_Heli_Transport_04_covered_F","B_Heli_Transport_03_unarmed_F","O_Truck_03_covered_F"] find _class;
|
||||
if (_found != -1) then {
|
||||
_class = ["O_Heli_Transport_04_EPOCH","O_Heli_Transport_04_bench_EPOCH","O_Heli_Transport_04_box_EPOCH","O_Heli_Transport_04_covered_EPOCH","B_Heli_Transport_03_unarmed_EPOCH","O_Truck_03_covered_EPOCH"] select _found;
|
||||
};
|
||||
|
||||
// spawn vehicle at temp location.
|
||||
_vehicle = createVehicle [_class, [random 500, random 500,500], [], 0, "CAN_COLLIDE"];
|
||||
// turn off BIS randomization
|
||||
_vehicle setVariable ["BIS_enableRandomization", false];
|
||||
if !(isNull _vehicle) then {
|
||||
|
||||
// set damage and hitpoints
|
||||
_vehicle setDamage _damage;
|
||||
_allHitpoints = getAllHitPointsDamage _vehicle;
|
||||
if !(_allHitpoints isEqualTo []) then{
|
||||
_actualHitpoints = _allHitpoints select 0;
|
||||
if ((count _actualHitpoints) == (count _hitpoints)) then{
|
||||
{
|
||||
_dmg = _hitpoints param [_forEachIndex,0];
|
||||
if (_x in ["HitFuel", "HitEngine"]) then {
|
||||
_dmg = _dmg min 0.9;
|
||||
};
|
||||
_vehicle setHitIndex [_forEachIndex, _dmg];
|
||||
} forEach _actualHitpoints;
|
||||
};
|
||||
};
|
||||
|
||||
// make vehicle immune from further damage.
|
||||
_vehicle allowDamage false;
|
||||
|
||||
// store spawned vehicles in array to make one call to remains handler
|
||||
_allVehicles pushBack _vehicle;
|
||||
// remove selected slot from array and set on vehicle
|
||||
EPOCH_VehicleSlots deleteAt _vehicleSlotIndex;
|
||||
_vehicle setVariable ["VEHICLE_SLOT", str(_i), true];
|
||||
// set server side token and init vehicle event handlers.
|
||||
_vehicle call EPOCH_server_setVToken;
|
||||
_vehicle call EPOCH_server_vehicleInit;
|
||||
// set final direction and postion of vehicle
|
||||
_vehicle setVectorDirAndUp [_VectorDir,_VectorUp];
|
||||
if (_useposworld) then {
|
||||
_vehicle setposWorld _location;
|
||||
}
|
||||
else {
|
||||
_vehicle setposATL _location;
|
||||
};
|
||||
// set fuel level
|
||||
_vehicle setFuel _fuel;
|
||||
// apply persistent textures
|
||||
if (((missionnamespace getvariable ["UseCustomTextures",false]) || _color isEqualTo -1) && {!(_Textures isEqualTo [])}) then {
|
||||
{
|
||||
_vehicle setobjecttextureglobal [_foreachindex,_x];
|
||||
} foreach _Textures;
|
||||
_vehicle setVariable ["VEHICLE_TEXTURE", _color];
|
||||
}
|
||||
else {
|
||||
_cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig;
|
||||
_availableColorsConfig = (_cfgEpochVehicles >> _class >> "availableColors");
|
||||
if (isArray(_availableColorsConfig)) then {
|
||||
_colors = getArray(_availableColorsConfig);
|
||||
_textureSelectionIndex = (_cfgEpochVehicles >> _class >> "textureSelectionIndex");
|
||||
_selections = if (isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] };
|
||||
_count = (count _colors) - 1;
|
||||
{
|
||||
_textures = _colors select 0;
|
||||
if (_count >= _forEachIndex) then {
|
||||
_textures = _colors select _forEachIndex;
|
||||
};
|
||||
_vehicle setObjectTextureGlobal [_x, _textures select _color];
|
||||
} forEach _selections;
|
||||
_vehicle setVariable ["VEHICLE_TEXTURE", _color];
|
||||
};
|
||||
};
|
||||
if !(_baseClass isequalto "") then {
|
||||
_vehicle setvariable ["VEHICLE_BASECLASS",_baseClass];
|
||||
};
|
||||
// disable thermal imaging equipment
|
||||
if (_disableVehicleTIE) then {
|
||||
_vehicle disableTIEquipment true;
|
||||
};
|
||||
// lock all vehicles
|
||||
_vehicle lock true;
|
||||
// load vehicle inventory
|
||||
clearWeaponCargoGlobal _vehicle;
|
||||
clearMagazineCargoGlobal _vehicle;
|
||||
clearBackpackCargoGlobal _vehicle;
|
||||
clearItemCargoGlobal _vehicle;
|
||||
|
||||
if !(_removeweapons isequalto []) then {
|
||||
{
|
||||
_vehicle removeWeaponGlobal _x;
|
||||
} foreach _removeweapons;
|
||||
};
|
||||
if !(_removemagazinesturret isequalto []) then {
|
||||
{
|
||||
_vehicle removeMagazinesTurret _x;
|
||||
} foreach _removemagazinesturret;
|
||||
};
|
||||
|
||||
// utilize He-Man's new Cargo functions
|
||||
[_vehicle,_inventory] call EPOCH_server_CargoFill;
|
||||
|
||||
// remove and add back magazines
|
||||
if !(_ammo isequalto []) then {
|
||||
if ((_ammo select 0) isequaltype true) then {
|
||||
{
|
||||
_vehicle removeMagazinesTurret [_x select 0, _x select 1];
|
||||
} foreach magazinesAllTurrets _vehicle;
|
||||
{
|
||||
if ((_x select 2) > 0) then {
|
||||
_vehicle addMagazineTurret [_x select 0,_x select 1,_x select 2];
|
||||
};
|
||||
} foreach (_ammo select 1);
|
||||
}
|
||||
else {
|
||||
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
|
||||
{_vehicle addMagazine _x}count _ammo;
|
||||
};
|
||||
};
|
||||
|
||||
// allow damage
|
||||
_allowDamage = true;
|
||||
if (_immuneIfStartInBase) then {
|
||||
_jammers = nearestObjects[_vehicle, call EPOCH_JammerClasses,call EPOCH_MaxJammerRange];
|
||||
if!(_jammers isEqualTo [])then {
|
||||
// get jammer owner
|
||||
_nearestJammer = _jammers select 0;
|
||||
_jammerOwner = _nearestJammer getVariable["BUILD_OWNER", "-2"];
|
||||
// get vehicle lock owner
|
||||
_lockedOwner = "-1";
|
||||
_vehLockHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), str(_i)];
|
||||
(["VehicleLock", _vehLockHiveKey] call EPOCH_fnc_server_hiveGETRANGE) params [["_status", 0 ],["_payload", [] ]];
|
||||
if (_status isEqualTo 1) then {
|
||||
_lockedOwner = _payload param [0,"-1"];
|
||||
};
|
||||
// if match keep vehicle immune till first unlock
|
||||
if (_jammerOwner isEqualTo _lockedOwner) then {
|
||||
_vehicle setVariable ["EPOCH_disallowedDamage", true];
|
||||
_allowDamage = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// add previous license plate
|
||||
if !(_plateNumber isEqualTo "") then {
|
||||
_vehicle setPlateNumber _plateNumber;
|
||||
};
|
||||
|
||||
if (_allowDamage) then {
|
||||
_vehicle allowDamage true;
|
||||
};
|
||||
|
||||
// new Dynamicsimulation
|
||||
if(_vehicleDynamicSimulationSystem)then
|
||||
{
|
||||
_vehicle enableSimulationGlobal false; // turn it off until activated by dynamicSim
|
||||
_vehicle enableDynamicSimulation true;
|
||||
};
|
||||
|
||||
if (EPOCH_DEBUG_VEH) then {
|
||||
_marker = createMarker [str(_location) , _location];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _class;
|
||||
_marker setMarkerColor "ColorGreen";
|
||||
};
|
||||
} else {
|
||||
diag_log format["DEBUG: vehicle object Null: class: %1, loc: %2, slot: %3",_class, _location,str(_i)];
|
||||
};
|
||||
} else {
|
||||
diag_log format["DEBUG: invalid vehicle position array %1",_location];
|
||||
};
|
||||
} else {
|
||||
diag_log format["DEBUG: vehicle destroyed already (%2) or invalid vehicle class: %1",_class, _damage];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
diag_log format["DEBUG: invalid vehicle data: %1 - %2",_status,_arr];
|
||||
};
|
||||
};
|
||||
// add all spawned vehicles to remains collector.
|
||||
addToRemainsCollector _allVehicles;
|
||||
diag_log format ["Epoch: Loaded %1 Vehicles in %2 seconds - Free Slots: %3", count _allVehicles, diag_tickTime - _diag, _maxVehicleLimit - count _allVehicles];
|
||||
true
|
@ -0,0 +1,281 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Load Vehicles
|
||||
|
||||
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/master/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_actualHitpoints","_allHitpoints","_allVehicles","_arr","_arrNum","_attachments","_class","_color","_colors","_config","_count","_damage","_dataFormat","_dataFormatCount","_diag","_dmg","_found","_hitpoints","_immuneVehicleSpawn","_immuneVehicleSpawnTime","_location","_magazineName","_magazineSize","_magazineSizeMax","_marker","_objQty","_objType","_objTypes","_qty","_removemagazinesturret","_removeweapons","_response","_selections","_serverSettingsConfig","_simulationHandler","_textureSelectionIndex","_textures","_vehHiveKey","_vehicle","_vehicleSlotIndex","_wMags","_wMagsArray","_worldspace"];
|
||||
//[[[end]]]
|
||||
params [["_maxVehicleLimit",0]];
|
||||
|
||||
_diag = diag_tickTime;
|
||||
_dataFormat = ["", [], 0, [], 0, [], [], 0];
|
||||
_dataFormatCount = count _dataFormat;
|
||||
EPOCH_VehicleSlots = [];
|
||||
_allVehicles = [];
|
||||
|
||||
_serverSettingsConfig = configFile >> "CfgEpochServer";
|
||||
_immuneVehicleSpawn = [_serverSettingsConfig, "immuneVehicleSpawn", false] call EPOCH_fnc_returnConfigEntry;
|
||||
_removeweapons = [_serverSettingsConfig, "removevehweapons", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_removemagazinesturret = [_serverSettingsConfig, "removevehmagazinesturret", []] call EPOCH_fnc_returnConfigEntry;
|
||||
_disableVehicleTIE = [_serverSettingsConfig, "disableVehicleTIE", true] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
for "_i" from 1 to _maxVehicleLimit do {
|
||||
_vehicleSlotIndex = EPOCH_VehicleSlots pushBack str(_i);
|
||||
|
||||
_vehHiveKey = format ["%1:%2", call EPOCH_fn_InstanceID,_i];
|
||||
_response = ["Vehicle", _vehHiveKey] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
|
||||
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
|
||||
_arr = _response select 1;
|
||||
_arrNum = count _arr;
|
||||
|
||||
if (_arrNum == _dataFormatCount) then {
|
||||
|
||||
// Validate and replace invaild data
|
||||
{
|
||||
if !((_arr select _forEachIndex) isEqualType _x) then {_arr set[_forEachIndex, _x]};
|
||||
} forEach _dataFormat;
|
||||
|
||||
_class = _arr select 0;
|
||||
_worldspace = _arr select 1;
|
||||
_damage = _arr select 2;
|
||||
|
||||
if (_class != "" && _damage < 1) then {
|
||||
_worldspace params [["_location",[]],["_VectorDir",[0,0,0]],["_VectorUp",[0,0,1]],["_useposworld",false]];
|
||||
|
||||
if !(_location isEqualTo []) then {
|
||||
|
||||
// increased position precision
|
||||
if (count _location == 2) then{
|
||||
_location = (_location select 0) vectorAdd (_location select 1);
|
||||
};
|
||||
|
||||
EPOCH_VehicleSlots deleteAt _vehicleSlotIndex;
|
||||
|
||||
// temp for changes in class names
|
||||
_found = ["O_Heli_Transport_04_F","O_Heli_Transport_04_bench_F","O_Heli_Transport_04_box_F","O_Heli_Transport_04_covered_F","B_Heli_Transport_03_unarmed_F","O_Truck_03_covered_F"] find _class;
|
||||
if (_found != -1) then {
|
||||
_class = ["O_Heli_Transport_04_EPOCH","O_Heli_Transport_04_bench_EPOCH","O_Heli_Transport_04_box_EPOCH","O_Heli_Transport_04_covered_EPOCH","B_Heli_Transport_03_unarmed_EPOCH","O_Truck_03_covered_EPOCH"] select _found;
|
||||
};
|
||||
|
||||
_vehicle = createVehicle [_class, [random 500, random 500,500], [], 0, "CAN_COLLIDE"];
|
||||
_allVehicles pushBack _vehicle;
|
||||
_vehicle call EPOCH_server_setVToken;
|
||||
if (_useposworld) then {
|
||||
_vehicle setposWorld _location;
|
||||
}
|
||||
else {
|
||||
_vehicle setposATL _location;
|
||||
};
|
||||
_vehicle setVectorDirAndUp [_VectorDir,_VectorUp];
|
||||
_vehicle setDamage _damage;
|
||||
|
||||
_allHitpoints = getAllHitPointsDamage _vehicle;
|
||||
if !(_allHitpoints isEqualTo []) then{
|
||||
_actualHitpoints = _allHitpoints select 0;
|
||||
_hitpoints = _arr select 3;
|
||||
if ((count _actualHitpoints) == (count _hitpoints)) then{
|
||||
{
|
||||
_dmg = _hitpoints param [_forEachIndex,0];
|
||||
if (_x in ["HitFuel", "HitEngine"]) then {
|
||||
_dmg = _dmg min 0.9;
|
||||
};
|
||||
_vehicle setHitIndex [_forEachIndex, _dmg];
|
||||
} forEach _actualHitpoints;
|
||||
};
|
||||
};
|
||||
|
||||
if (_immuneVehicleSpawn) then{
|
||||
_vehicle allowDamage false;
|
||||
};
|
||||
|
||||
_vehicle setFuel (_arr select 4);
|
||||
|
||||
_vehicle call EPOCH_server_vehicleInit;
|
||||
|
||||
_config = configFile >> "CfgVehicles" >> _class >> "availableColors";
|
||||
if (isArray(_config)) then {
|
||||
_color = _arr select 7;
|
||||
_colors = getArray(_config);
|
||||
_textureSelectionIndex = configFile >> "CfgVehicles" >> _class >> "textureSelectionIndex";
|
||||
_selections = if (isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] };
|
||||
_count = (count _colors) - 1;
|
||||
{
|
||||
_textures = _colors select 0;
|
||||
if (_count >= _forEachIndex) then {
|
||||
_textures = _colors select _forEachIndex;
|
||||
};
|
||||
_vehicle setObjectTextureGlobal [_x, _textures select _color];
|
||||
} forEach _selections;
|
||||
_vehicle setVariable ["VEHICLE_TEXTURE", _color];
|
||||
};
|
||||
|
||||
clearWeaponCargoGlobal _vehicle;
|
||||
clearMagazineCargoGlobal _vehicle;
|
||||
clearBackpackCargoGlobal _vehicle;
|
||||
clearItemCargoGlobal _vehicle;
|
||||
|
||||
if !(_removeweapons isequalto []) then {
|
||||
{
|
||||
_vehicle removeWeaponGlobal _x;
|
||||
} foreach _removeweapons;
|
||||
};
|
||||
if !(_removemagazinesturret isequalto []) then {
|
||||
{
|
||||
_vehicle removeMagazinesTurret _x;
|
||||
} foreach _removemagazinesturret;
|
||||
};
|
||||
|
||||
if (_disableVehicleTIE) then {
|
||||
_vehicle disableTIEquipment true;
|
||||
};
|
||||
|
||||
_vehicle lock true;
|
||||
|
||||
_vehicle setVariable ["VEHICLE_SLOT", str(_i), true];
|
||||
|
||||
//diag_log format ["FILLING: _vehicle %1 pos: %2", _vehicle, (getPosATL _vehicle)];
|
||||
{
|
||||
_objType = _forEachIndex;
|
||||
|
||||
_objTypes = _x;
|
||||
_objQty = [];
|
||||
|
||||
if (_objType in [1, 2, 3]) then {
|
||||
_objTypes = _x select 0;
|
||||
_objQty = _x select 1;
|
||||
};
|
||||
|
||||
{
|
||||
switch _objType do {
|
||||
// Weapon cargo
|
||||
case 0: {
|
||||
if (_x isEqualType []) then {
|
||||
if ((count _x) >= 4) then {
|
||||
|
||||
_vehicle addWeaponCargoGlobal[_x deleteAt 0, 1];
|
||||
|
||||
_attachments = [];
|
||||
_wMags = false;
|
||||
_wMagsArray = [];
|
||||
// suppressor, laser, optics, magazines(array), bipods
|
||||
{
|
||||
// magazines
|
||||
if (_x isEqualType []) then{
|
||||
_wMags = true;
|
||||
_wMagsArray = _x;
|
||||
}
|
||||
else {
|
||||
// attachments
|
||||
if (_x != "") then{
|
||||
_attachments pushBack _x;
|
||||
};
|
||||
};
|
||||
} forEach _x;
|
||||
|
||||
// add all attachments to vehicle
|
||||
// TODO replace with adding attachments directly to gun (Arma feature dependant)
|
||||
{
|
||||
_vehicle addItemCargoGlobal[_x, 1];
|
||||
} forEach _attachments;
|
||||
|
||||
if (_wMags) then{
|
||||
if (_wMagsArray isEqualType [] && (count _wMagsArray) >= 2) then{
|
||||
_vehicle addMagazineAmmoCargo[_wMagsArray select 0, 1, _wMagsArray select 1];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
// Magazine cargo
|
||||
case 1: {
|
||||
_magazineName = _x;
|
||||
_magazineSize = _objQty select _forEachIndex;
|
||||
|
||||
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
|
||||
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
|
||||
if (_magazineSizeMax >= 1) then {
|
||||
// Add full magazines cargo
|
||||
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
|
||||
|
||||
// Add last non full magazine
|
||||
if ((_magazineSize % _magazineSizeMax) > 0) then {
|
||||
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
// Backpack cargo
|
||||
case 2: {
|
||||
if (_x isEqualType "STRING") then {
|
||||
_qty = _objQty select _forEachIndex;
|
||||
_vehicle addBackpackCargoGlobal [_x, _qty];
|
||||
};
|
||||
};
|
||||
// Item cargo
|
||||
case 3: {
|
||||
if (_x isEqualType "STRING") then {
|
||||
_qty = _objQty select _forEachIndex;
|
||||
_vehicle addItemCargoGlobal [_x, _qty];
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _objTypes;
|
||||
} forEach (_arr select 5);
|
||||
|
||||
// remove and add back magazines
|
||||
if !((_arr select 6) isequalto []) then {
|
||||
if ((_arr select 6 select 0) isequaltype true) then {
|
||||
{
|
||||
_vehicle removeMagazinesTurret [_x select 0, _x select 1];
|
||||
} foreach magazinesAllTurrets _vehicle;
|
||||
{
|
||||
if ((_x select 2) > 0) then {
|
||||
_vehicle addMagazineTurret [_x select 0,_x select 1,_x select 2];
|
||||
};
|
||||
} foreach (_arr select 6 select 1);
|
||||
}
|
||||
else {
|
||||
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
|
||||
{_vehicle addMagazine _x}count (_arr select 6);
|
||||
};
|
||||
};
|
||||
|
||||
if (EPOCH_DEBUG_VEH) then {
|
||||
_marker = createMarker [str(_location) , _location];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _class;
|
||||
_marker setMarkerColor "ColorGreen";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// re-enable damage to vehicles after we wait
|
||||
if (_immuneVehicleSpawn) then{
|
||||
_immuneVehicleSpawnTime = [_serverSettingsConfig, "immuneVehicleSpawnTime", 120] call EPOCH_fnc_returnConfigEntry;
|
||||
[_allVehicles,_immuneVehicleSpawnTime] spawn{
|
||||
sleep (_this select 1);
|
||||
{_x allowDamage true} count (_this select 0);
|
||||
};
|
||||
};
|
||||
|
||||
addToRemainsCollector _allVehicles;
|
||||
|
||||
diag_log format ["Epoch: Vehicle SPAWN TIMER %1, LOADED %2 VEHICLES", diag_tickTime - _diag, count _allVehicles];
|
||||
|
||||
true
|
@ -0,0 +1,103 @@
|
||||
/*
|
||||
Author: He-Man - Ignatz-Gaming
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Fill a Cargo Inventory (that is readed out with EPOCH_server_CargoSave before)
|
||||
|
||||
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_vehicle/EPOCH_server_CargoFill.sqf
|
||||
|
||||
Example:
|
||||
[_vehicle, _Inventory] call EPOCH_server_CargoFill;
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJ - Storage or Vehicle
|
||||
_this select 1: ARRAY - Cargo Items
|
||||
|
||||
Returns:
|
||||
NOTHING
|
||||
*/
|
||||
|
||||
|
||||
params [["_vehicle",objnull],["_items",[]]];
|
||||
{
|
||||
_objType = _forEachIndex;
|
||||
_objTypes = _x;
|
||||
_objQty = [];
|
||||
if (_objType in [1, 2, 3]) then {
|
||||
_objTypes = _x select 0;
|
||||
_objQty = _x select 1;
|
||||
};
|
||||
{
|
||||
switch _objType do {
|
||||
// Weapon cargo
|
||||
case 0: {
|
||||
if (_x isEqualType []) then {
|
||||
if ((count _x) == 2) then {
|
||||
_vehicle addWeaponWithAttachmentsCargoGlobal _x;
|
||||
}
|
||||
else {
|
||||
_vehicle addWeaponWithAttachmentsCargoGlobal [_x,1];
|
||||
};
|
||||
};
|
||||
};
|
||||
// Magazine cargo
|
||||
case 1: {
|
||||
_magazineName = _x;
|
||||
_magazineSize = _objQty select _forEachIndex;
|
||||
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
|
||||
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
|
||||
if (_magazineSizeMax >= 1) then {
|
||||
// Add full magazines cargo
|
||||
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
|
||||
// Add last non full magazine
|
||||
if ((_magazineSize % _magazineSizeMax) > 0) then {
|
||||
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
// Backpack cargo
|
||||
case 2: {
|
||||
if (_x isEqualType "STRING") then {
|
||||
_qty = _objQty select _forEachIndex;
|
||||
_vehicle addBackpackCargoGlobal [_x, _qty];
|
||||
};
|
||||
};
|
||||
// Item cargo
|
||||
case 3: {
|
||||
if (_x isEqualType "STRING") then {
|
||||
_qty = _objQty select _forEachIndex;
|
||||
_vehicle addItemCargoGlobal [_x, _qty];
|
||||
};
|
||||
};
|
||||
// Sub-Containers
|
||||
case 4: {
|
||||
_type = _x select 0;
|
||||
_subContainers = (everycontainer _vehicle) select {(_x select 0) isequalto _type && magazinesAmmoCargo (_x select 1) isequalto [] && weaponsItemsCargo (_x select 1) isequalto []};
|
||||
if !(_subContainers isequalto []) then {
|
||||
_subContainer = _subContainers select 0 select 1;
|
||||
[_subContainer,_x select 1] call EPOCH_server_CargoFill;
|
||||
}
|
||||
else {
|
||||
if (_type isKindOf "Bag_Base") then {
|
||||
_vehicle addBackpackCargoGlobal [_type, 1];
|
||||
}
|
||||
else {
|
||||
_vehicle addItemCargoGlobal [_type, 1];
|
||||
};
|
||||
_subContainers = (everycontainer _vehicle) select {(_x select 0) isequalto _type && magazinesAmmoCargo (_x select 1) isequalto [] && weaponsItemsCargo (_x select 1) isequalto []};
|
||||
if !(_subContainers isequalto []) then {
|
||||
_subContainer = _subContainers select 0 select 1;
|
||||
[_subContainer,_x select 1] call EPOCH_server_CargoFill;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _objTypes;
|
||||
} forEach _items;
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
Author: He-Man - Ignatz-Gaming
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Reads Cargo Inventory and push it back in a Variable
|
||||
|
||||
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_vehicle/EPOCH_server_CargoSave.sqf
|
||||
|
||||
Example:
|
||||
_Inventory = [_vehicle, _dominimize] call EPOCH_server_CargoSave;
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJ - Storage or Vehicle
|
||||
_this select 1: BOOL - Minimize the Magazine Array
|
||||
|
||||
Returns:
|
||||
ARRAY
|
||||
*/
|
||||
|
||||
|
||||
private [
|
||||
"_wepsItemsCargo","_magsAmmoCargo","_containers","_allContainers","_cargo","_magsAmmoCargox","_wepsItemsCargox","_magsAmmoCargoMinimized","_cargoIndex",
|
||||
"_inventory","_ItemCargo","_ItemCargox"];
|
||||
params [["_vehicle",objnull],["_unpack",false]];
|
||||
// may not be needed but should prevent <null> in DB.
|
||||
_wepsItemsCargo = weaponsItemsCargo _vehicle;
|
||||
if (isNil "_wepsItemsCargo") then {
|
||||
_wepsItemsCargo = [];
|
||||
};
|
||||
_magsAmmoCargo = magazinesAmmoCargo _vehicle;
|
||||
if (isNil "_magsAmmoCargo") then {
|
||||
_magsAmmoCargo = [];
|
||||
};
|
||||
_ItemCargo = getItemCargo _vehicle;
|
||||
if (isNil "_ItemCargo") then {
|
||||
_ItemCargo = [[],[]];
|
||||
};
|
||||
|
||||
_containers = [];
|
||||
_allContainers = (everycontainer _vehicle);
|
||||
{
|
||||
_x params ["_type","_cargo"];
|
||||
if (_unpack) then {
|
||||
_magsAmmoCargox = magazinesAmmoCargo _cargo;
|
||||
{
|
||||
_magsAmmoCargo pushback _x;
|
||||
} foreach _magsAmmoCargox;
|
||||
_wepsItemsCargox = weaponsItemsCargo _cargo;
|
||||
{
|
||||
_wepsItemsCargo pushback _x;
|
||||
} foreach _wepsItemsCargox;
|
||||
_ItemCargox = getItemCargo _cargo;
|
||||
_ItemCargox params ["_items","_itemcounts"];
|
||||
{
|
||||
_cargoIndex = (_ItemCargo select 0) find _x;
|
||||
if (_cargoIndex >= 0) then {
|
||||
(_ItemCargo select 1) set [_cargoIndex,(_ItemCargo select 1 select _cargoIndex) + (_itemcounts select _foreachindex)];
|
||||
}
|
||||
else {
|
||||
(_ItemCargo select 0) pushback (_items select _foreachindex);
|
||||
(_ItemCargo select 1) pushback (_itemcounts select _foreachindex);
|
||||
};
|
||||
} foreach _items;
|
||||
}
|
||||
else {
|
||||
_containerInventory = _cargo call EPOCH_server_CargoSave;
|
||||
_containers pushback [_type , _containerInventory];
|
||||
};
|
||||
} foreach _allContainers;
|
||||
|
||||
// minimize magazine ammo cargo
|
||||
_magsAmmoCargoMinimized = [[],[]];
|
||||
{
|
||||
(_magsAmmoCargoMinimized select 0) pushBack (_x select 0);
|
||||
(_magsAmmoCargoMinimized select 1) pushBack (_x select 1);
|
||||
} forEach _magsAmmoCargo;
|
||||
|
||||
_inventory = [
|
||||
_wepsItemsCargo,
|
||||
_magsAmmoCargoMinimized,
|
||||
getBackpackCargo _vehicle,
|
||||
_ItemCargo,
|
||||
_containers
|
||||
];
|
||||
_inventory
|
@ -0,0 +1,27 @@
|
||||
private ["_ok"];
|
||||
_ok = true;
|
||||
params [["_vehicle",objnull],["_PaintingCosts",0],["_textures",[]],["_player",objnull],["_token","",[""]]];
|
||||
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
||||
if (isnull _vehicle) exitwith {};
|
||||
if (_Textures isEqualTo []) exitwith {};
|
||||
if(_PaintingCosts > 0)then{
|
||||
_cIndex = EPOCH_customVars find "Crypto";
|
||||
_vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar];
|
||||
_current_crypto = _vars select _cIndex;
|
||||
if (_current_crypto < _PaintingCosts) exitwith {
|
||||
_ok = false;
|
||||
};
|
||||
_playerCryptoLimit = EPOCH_customVarLimits select _cIndex;
|
||||
_playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"];
|
||||
_current_crypto = ((_current_crypto - _PaintingCosts) min _playerCryptoLimitMax) max _playerCryptoLimitMin;
|
||||
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
|
||||
_vars set[_cIndex, _current_crypto];
|
||||
_player setVariable["VARS", _vars];
|
||||
};
|
||||
if (_ok) then {
|
||||
{
|
||||
_vehicle SetObjectTextureGlobal [_foreachindex,_x];
|
||||
} foreach _Textures;
|
||||
_vehicle setVariable ["VEHICLE_TEXTURE", -1];
|
||||
EPOCH_saveVehQueue pushBackUnique _vehicle;
|
||||
};
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
Author: He-Man - Ignatz-Gaming
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Removes Items or Magazines from any Cargo
|
||||
|
||||
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_vehicle/Epoch_Server_RemoveMagOrItemCargo.sqf
|
||||
|
||||
Example:
|
||||
_done = [_vehicle,[_itemtype,_itemcount,_rounds]] call Epoch_Server_RemoveMagOrItemCargo;
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: OBJ - Storage or Vehicle
|
||||
_this select 1: STRING - ItemType to remove
|
||||
_this select 2: SCALAR - ItemQuantity to remove (optional)
|
||||
_this select 2: SCALAR - Magazine Rounds to find and remove (optional)
|
||||
Returns:
|
||||
BOOL - If the Magazine(s) / Item(s) are successfully removed then "true", else "false"
|
||||
*/
|
||||
private ["_return","_removed","_items","_objType","_arr","_size"];
|
||||
params ["_cargo","_class",["_count",1],["_bulletfind",0]];
|
||||
_return = false;
|
||||
_removed = 0;
|
||||
_items = [_cargo,false] call Epoch_Server_CargoSave;
|
||||
_objType = -1;
|
||||
if ([_class,"cfgMagazines"] call Epoch_fnc_isAny) then {
|
||||
_objType = 1;
|
||||
}
|
||||
else {
|
||||
if ([_class, "CfgWeapons"] call EPOCH_fnc_isAny) then {
|
||||
_objType = 3;
|
||||
};
|
||||
};
|
||||
if (_objType > -1) then {
|
||||
_arr = _items select _objType;
|
||||
_arr params ["_objTypes","_objQty"];
|
||||
{
|
||||
_size = _objQty select _forEachIndex;
|
||||
switch _objType do {
|
||||
case 1: {
|
||||
if ((_x isEqualTo _class) && ((_size isEqualTo _bulletfind) || _bulletfind == 0)) then {
|
||||
_objQty set [_foreachindex,0];
|
||||
_removed = _removed + 1;
|
||||
};
|
||||
};
|
||||
case 3: {
|
||||
if (_x isEqualTo _class && _size >= _count) then {
|
||||
_objQty set [_foreachindex,_size - _count];
|
||||
_removed = _removed + _count;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_removed >= _count) exitwith {_return = true;};
|
||||
} forEach _objTypes;
|
||||
};
|
||||
if (_return) then {
|
||||
clearWeaponCargoGlobal _cargo;
|
||||
clearMagazineCargoGlobal _cargo;
|
||||
clearBackpackCargoGlobal _cargo;
|
||||
clearItemCargoGlobal _cargo;
|
||||
[_cargo,_items] call Epoch_Server_CargoFill;
|
||||
};
|
||||
|
||||
_return
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Refuel Vehicles
|
||||
|
||||
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_vehicle/EPOCH_server_fillVehicle.sqf
|
||||
*/
|
||||
params ["_vehicle","_value","_player",["_token","",[""]]];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (_player distance _vehicle > 20) exitWith{};
|
||||
if (!isNull _vehicle) then {
|
||||
if (local _vehicle) then {
|
||||
_vehicle setFuel _value;
|
||||
} else {
|
||||
[_vehicle, _value] remoteExec ['EPOCH_client_fillVehicle',_vehicle];
|
||||
};
|
||||
};
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
|
||||
Description:
|
||||
Refuel Vehicles
|
||||
|
||||
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_vehicle/EPOCH_server_lockStorage.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfgBaseBuilding","_owners","_playerGroup","_playerUID","_response","_type","_locked","_LockStateChanged","_msg"];
|
||||
//[[[end]]]
|
||||
params ["_unit","_lockStatus","_player",["_token","",[""]] ];
|
||||
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _unit) exitWith{};
|
||||
if (_player distance _unit > 20) exitWith{};
|
||||
_VehLockMessages = ['CfgEpochClient' call EPOCH_returnConfig, "VehLockMessages", true] call EPOCH_fnc_returnConfigEntry;
|
||||
_type = typeOf _unit;
|
||||
_playerUID = getPlayerUID _player;
|
||||
_playerGroup = _player getVariable["GROUP", ""];
|
||||
|
||||
_fnc_Lock_Unlock = {
|
||||
_locked = !_locked;
|
||||
_unit setVariable ["EPOCH_Locked", _locked, true];
|
||||
if (_unit iskindof "GunSafe_EPOCH") then {
|
||||
_animations = if (_locked) then {[['door1',0],['door2',0],['handle1',0],['handle2',0]]} else {[['handle1',1],['handle2',1],['door1',1],['door2',1]]};
|
||||
[_unit,_animations,[0,1,0]] remoteexec ['EPOCH_fnc_AnimateScheduled',_player];
|
||||
};
|
||||
_LockStateChanged = true;
|
||||
};
|
||||
|
||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||
if (getNumber(_cfgBaseBuilding >> _type >> "isSecureStorage") == 1) then {
|
||||
_owners = _unit getVariable["STORAGE_OWNERS", []];
|
||||
_locked = _unit getVariable ["EPOCH_Locked", true];
|
||||
_LockStateChanged = false;
|
||||
if (_playerUID in _owners) then {
|
||||
call _fnc_Lock_Unlock;
|
||||
}
|
||||
else {
|
||||
if (_playerGroup != "") then {
|
||||
if (_playerGroup in _owners) then {
|
||||
call _fnc_Lock_Unlock;
|
||||
}
|
||||
else {
|
||||
_response = ["Group", _playerGroup] call EPOCH_fnc_server_hiveGETRANGE;
|
||||
(_response param [1,[]]) params ["","","",["_modArray",[]],["_memberArray",[]]];
|
||||
if (
|
||||
{(_x select 0) in _owners} count _modArray > 0 ||
|
||||
{(_x select 0) in _owners} count _memberArray > 0
|
||||
) then {
|
||||
call _fnc_Lock_Unlock;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
_msg = ["You are not the owner",5];
|
||||
if (_LockStateChanged) then {
|
||||
if (_locked) then {
|
||||
EPOCH_saveStorQueue pushBackUnique _unit;
|
||||
_msg = ["Storage Locked",5,[[1,0,0,0.2],[1,1,1,1]]];
|
||||
}
|
||||
else {
|
||||
_msg = ["Storage Unlocked",5,[[0,1,0,0.2],[1,1,1,1]]];
|
||||
};
|
||||
};
|
||||
if (_VehLockMessages) then {
|
||||
_msg remoteExec ["Epoch_Message",_player];
|
||||
};
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user