mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Winter Trader
This commit is contained in:
parent
6045ed704b
commit
ac337459ff
@ -29,7 +29,7 @@ class CfgActionMenu
|
||||
|
||||
dyna_buildMode = "([10] call EPOCH_fnc_cursorTarget) call EPOCH_checkBuild;";
|
||||
dyna_isVehicle = "if (!(isNull dyna_cursorTarget) && alive dyna_cursorTarget) then {((dyna_cursorTarget isKindOf 'LandVehicle') || (dyna_cursorTarget isKindOf 'Air') || (dyna_cursorTarget isKindOf 'Ship') || (dyna_cursorTarget isKindOf 'Tank'))} else {false}";
|
||||
dyna_isTrader = "if (!(isNull dyna_cursorTarget) && alive dyna_cursorTarget) then {((dyna_cursorTarget isKindOf 'Man') && (dyna_cursorTarget != player) && (!isPlayer dyna_cursorTarget) && ((dyna_cursorTarget getVariable['AI_SLOT', -1]) != -1))} else {false}";
|
||||
dyna_isTrader = "if (!(isNull dyna_cursorTarget) && alive dyna_cursorTarget) then {((dyna_cursorTarget != player) && (!isPlayer dyna_cursorTarget) && ((dyna_cursorTarget getVariable['AI_SLOT', -1]) != -1))} else {false}";
|
||||
dyna_isPlayer = "if (!(isNull dyna_cursorTarget) && alive dyna_cursorTarget) then {((dyna_cursorTarget isKindOf 'Man') && (dyna_cursorTarget != player) && (isPlayer dyna_cursorTarget))} else {false}";
|
||||
dyna_isDeadPlayer = "if (!(isNull dyna_cursorTarget) && !(alive dyna_cursorTarget)) then {(dyna_cursorTargetType in ['Epoch_Male_F','Epoch_Female_F'])} else {false}";
|
||||
dyna_canAcceptTrade = "if (!(isNull EPOCH_pendingP2ptradeTarget) && alive EPOCH_pendingP2ptradeTarget) then {((EPOCH_pendingP2ptradeTarget isKindOf 'Man') && (dyna_cursorTarget isEqualTo EPOCH_pendingP2ptradeTarget))} else {false}";
|
||||
|
@ -35,17 +35,19 @@ _TraderItemCountPerItem = [_serverSettingsConfig, "TraderItemCountPerItem", [100
|
||||
_TraderItemsDeleteRestart = [_serverSettingsConfig, "TraderItemsDeleteRestart", []] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
_TraderInit = {
|
||||
addToRemainsCollector[_this];
|
||||
_this allowdamage !_TraderGodMode;
|
||||
_this addUniform _randomAIUniform;
|
||||
_this setDir _dir;
|
||||
_this setVariable ["AI_SLOT", _i, true];
|
||||
_this setVariable ["AI_ITEMS", _arr, true];
|
||||
_this disableAI "FSM";
|
||||
_this setBehaviour "CARELESS";
|
||||
_this setCombatMode "RED";
|
||||
_this setSkill 0;
|
||||
_this addEventHandler ["Killed", { _this call EPOCH_server_traderKilled; }];
|
||||
if (_this iskindof "MAN") then {
|
||||
addToRemainsCollector[_this];
|
||||
_this addUniform _randomAIUniform;
|
||||
_this disableAI "FSM";
|
||||
_this setBehaviour "CARELESS";
|
||||
_this setCombatMode "RED";
|
||||
_this setSkill 0;
|
||||
};
|
||||
};
|
||||
_TraderItemsClean = {
|
||||
private ["_idx","_delete","_k"];
|
||||
@ -153,7 +155,13 @@ for "_i" from 0 to (_maxTraderLimit-1) do {
|
||||
};
|
||||
};
|
||||
EPOCH_TraderSlots deleteAt _traderSlotIndex;
|
||||
_agent = createAgent [_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_agent = objnull;
|
||||
if ((Epoch_ServerRealtime select 1) isequalto 12) then {
|
||||
_agent = createvehicle ["snowmanDeco_EPOCH", _pos, [], 0, "NONE"];
|
||||
}
|
||||
else {
|
||||
_agent = createAgent [_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
};
|
||||
_agent call _TraderInit;
|
||||
_agent setPosATL _pos;
|
||||
if (_arrchanged) then {
|
||||
@ -185,16 +193,22 @@ for "_i" from 0 to (_maxTraderLimit-1) do {
|
||||
};
|
||||
if !(count (_arr select 0) >= _DynamicTraderRespawnCount) then {
|
||||
EPOCH_TraderSlots deleteAt _traderSlotIndex;
|
||||
_agent = createAgent [_class, _pos, [], 0, "NONE"];
|
||||
_agent = objnull;
|
||||
if ((Epoch_ServerRealtime select 1) isequalto 12) then {
|
||||
_agent = createvehicle ["snowmanDeco_EPOCH", _pos, [], 0, "NONE"];
|
||||
}
|
||||
else {
|
||||
_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 (_arrchanged) then {
|
||||
// diag_log format ["EPOCH_DEBUG: TraderSlot: %1 | Saved",_i];
|
||||
["AI_ITEMS", _objHiveKey, EPOCH_expiresAIdata, _arr] call EPOCH_fnc_server_hiveSETEX;
|
||||
};
|
||||
if !(EPOCH_forceStaticTraders) then {
|
||||
[_agent, _home, _work] execFSM "\epoch_server\system\Trader_brain.fsm";
|
||||
};
|
||||
if (EPOCH_SHOW_TRADERS) then {
|
||||
_markers = ["DynamicTrader",_pos] call EPOCH_server_createGlobalMarkerSet;
|
||||
_agent setVariable["MARKER_REF", _markers];
|
||||
|
@ -55,19 +55,25 @@ for "_i" from 1 to _spawnCount do {
|
||||
if (daytime > _startTime && daytime < _endTime) then {
|
||||
_pos = _work;
|
||||
};
|
||||
_agent = createAgent[_aiClass, _pos, [], 0, "CAN_COLLIDE"];
|
||||
addToRemainsCollector[_agent];
|
||||
_agent = objnull;
|
||||
if ((Epoch_ServerRealtime select 1) isequalto 12) then {
|
||||
_agent = createvehicle ["snowmanDeco_EPOCH", _pos, [], 0, "NONE"];
|
||||
}
|
||||
else {
|
||||
_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";
|
||||
};
|
||||
};
|
||||
_agent allowdamage !_TraderGodMode;
|
||||
_agent addUniform _randomAIUniform;
|
||||
_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; }];
|
||||
if !(EPOCH_forceStaticTraders) then {
|
||||
[_agent, _home, [_work, _schedule]] execFSM "\epoch_server\system\Trader_brain.fsm";
|
||||
};
|
||||
["AI", _objHiveKey, [_aiClass, _home, [_work, _schedule]] ] call EPOCH_fnc_server_hiveSET;
|
||||
if (EPOCH_SHOW_TRADERS) then {
|
||||
_markers = ["NewDynamicTrader",_pos] call EPOCH_server_createGlobalMarkerSet;
|
||||
|
@ -91,6 +91,16 @@ diag_log "Epoch: Init Variables";
|
||||
call compile preprocessFileLineNumbers "\epoch_server\init\server_variables.sqf";
|
||||
call compile preprocessFileLineNumbers "\epoch_server\init\server_securityfunctions.sqf";
|
||||
|
||||
// Set Server RealTime
|
||||
Epoch_ServerRealtime = date;
|
||||
_response = "epochserver" callExtension "510";
|
||||
if (_response != "") then {
|
||||
diag_log format ["Epoch: Set Real Time: %1", _response];
|
||||
_date = parseSimpleArray _response;
|
||||
_date resize 5;
|
||||
Epoch_ServerRealtime = _date;
|
||||
};
|
||||
|
||||
// Enable Dynamic simulation
|
||||
_dynSimToggle = [_serverSettingsConfig, "enableDynamicSimulationSystem", true] call EPOCH_fnc_returnConfigEntry;
|
||||
enableDynamicSimulationSystem _dynSimToggle;
|
||||
@ -226,15 +236,10 @@ _staticDateTime = [_serverSettingsConfig, "StaticDateTime", []] call EPOCH_fnc_r
|
||||
_timeDifference = [_serverSettingsConfig, "timeDifference", 0] call EPOCH_fnc_returnConfigEntry;
|
||||
|
||||
if (_staticDateTime isEqualto []) then {
|
||||
_response = "epochserver" callExtension "510";
|
||||
if (_response != "") then {
|
||||
diag_log format ["Epoch: Set Real Time: %1", _response];
|
||||
_date = parseSimpleArray _response;
|
||||
_date resize 5;
|
||||
_date set[0, (_date select 0) + 21];
|
||||
_date set[3, (_date select 3) + _timeDifference];
|
||||
_dateChanged = true;
|
||||
};
|
||||
_date = Epoch_ServerRealtime;
|
||||
_date set[0, (_date select 0) + 21];
|
||||
_date set[3, (_date select 3) + _timeDifference];
|
||||
_dateChanged = true;
|
||||
} else {
|
||||
{
|
||||
if (_x != 0) then {
|
||||
|
Loading…
Reference in New Issue
Block a user