diff --git a/addons/civilian/XEH_preInit.sqf b/addons/civilian/XEH_preInit.sqf index 7c6d1422..f2a8692a 100644 --- a/addons/civilian/XEH_preInit.sqf +++ b/addons/civilian/XEH_preInit.sqf @@ -43,6 +43,10 @@ if (isServer) then { GVAR(vests) = []; GVAR(headgear) = []; call FUNC(initCiviliansConfig); + publicVariable QGVAR(backpacks); + publicVariable QGVAR(uniforms); + publicVariable QGVAR(vests); + publicVariable QGVAR(headgear); // Initialize civilians call FUNC(initCivilians); publicVariable QGVAR(civilians); diff --git a/addons/civilian/functions/fnc_civilianKilledMarker.sqf b/addons/civilian/functions/fnc_civilianKilledMarker.sqf index 7cfa4d97..26e042c9 100644 --- a/addons/civilian/functions/fnc_civilianKilledMarker.sqf +++ b/addons/civilian/functions/fnc_civilianKilledMarker.sqf @@ -26,6 +26,6 @@ _marker setMarkerColor "ColorEAST"; _marker setMarkerSize [0.4, 0.4]; _marker setMarkerText _markerText; -[_marker] call EFUNC(common,markerDecay); +[_marker] call EFUNC(markers,markerDecay); _marker diff --git a/addons/civilian/functions/fnc_createCivilian.sqf b/addons/civilian/functions/fnc_createCivilian.sqf index 7ebaf36b..0b279d02 100644 --- a/addons/civilian/functions/fnc_createCivilian.sqf +++ b/addons/civilian/functions/fnc_createCivilian.sqf @@ -18,6 +18,11 @@ params ["_position"]; private _newGroup = createGroup CIVILIAN; -private _civilian = _newGroup createUnit [selectRandom GVAR(units), _position, [], 0, "NONE"]; +private _unit = selectRandom GVAR(units); +private _civilian = _newGroup createUnit [_unit, _position, [], 0, "NONE"]; + +if (_civilian isEqualTo objNull) exitWith { + WARNING_2("Failed creating civilian %1 at %2", _unit, _position); +}; [_civilian] call FUNC(initCivilian); diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 8b117fd8..f7b9a125 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -23,6 +23,9 @@ if (isServer) then { }] call CBA_fnc_addEventHandler; if (hasInterface) then { + /* Initial player loadout */ + GVAR(playerLoadout) = getUnitLoadout player; + /* Spectator events */ [QGVAR(initializeSideSpectator), { ["Initialize", [player, [playerSide], false, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator; diff --git a/addons/jail/XEH_PREP.hpp b/addons/jail/XEH_PREP.hpp index b6490d06..cdbc1e33 100644 --- a/addons/jail/XEH_PREP.hpp +++ b/addons/jail/XEH_PREP.hpp @@ -2,6 +2,7 @@ PREP(addReleaseAction); PREP(canRelease); PREP(createKillersRespawn); PREP(free); +PREP(freeAll); PREP(getRandomJailPos); PREP(imprison); PREP(jailMarker); diff --git a/addons/jail/XEH_postInit.sqf b/addons/jail/XEH_postInit.sqf index b8e5cce6..a643d267 100644 --- a/addons/jail/XEH_postInit.sqf +++ b/addons/jail/XEH_postInit.sqf @@ -8,6 +8,10 @@ if (isServer) then { _this call FUNC(free); }] call CBA_fnc_addEventHandler; + [QGVAR(freeAll), { + _this call FUNC(freeAll); + }] call CBA_fnc_addEventHandler; + [QGVAR(imprison), { _this call FUNC(imprison); }] call CBA_fnc_addEventHandler; @@ -15,6 +19,8 @@ if (isServer) then { if (!(GVAR(jail) isEqualTo objNull)) then { GVAR(jailMarker) = call FUNC(jailMarker); call FUNC(createKillersRespawn); + } else { + ERROR("Jail not detected!"); }; }; @@ -33,7 +39,10 @@ if (hasInterface) then { // Add ACE EH for handcuffing [QACEGVAR(captives,setHandcuffed), { params ["_unit", "_isHandcuffed"]; - if (!(_unit isEqualTo player) || {_isHandcuffed}) exitWith {}; + if !(_unit isEqualTo player) exitWith {}; + if (_isHandcuffed) exitWith { + [QEGVAR(killers,killerHandcuffed), [_unit]] call CBA_fnc_serverEvent; + }; if (_unit getVariable [QGVAR(isImprisoned), false]) then { [QGVAR(free), [player]] call CBA_fnc_serverEvent; }; diff --git a/addons/jail/functions/fnc_freeAll.sqf b/addons/jail/functions/fnc_freeAll.sqf new file mode 100644 index 00000000..4560fc14 --- /dev/null +++ b/addons/jail/functions/fnc_freeAll.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function frees all prisoners. + * If an object was provided, all prisoners will be teleported to the object's position. + * + * Arguments: + * 0: Object that had triggered the action + * + * Return Value: + * None + * + * Example: + * [bob] call afsk_jail_fnc_freeAll + * + * Public: No + */ + +params [["_object", objNull]]; + +private _prisoners = +GVAR(prisoners); +GVAR(prisoners) = []; + +{ + [_x] call FUNC(free); + if (_object isNotEqualTo objNull) then { + _x setPos (getPos _object); + }; +} forEach _prisoners; + +private _msg = format ["Prisoners have been released from the prison!"]; +[QEGVAR(common,showSideChatMsg), [WEST, _msg]] call CBA_fnc_globalEvent; diff --git a/addons/killers/XEH_PREP.hpp b/addons/killers/XEH_PREP.hpp index 24fb5292..e27b75be 100644 --- a/addons/killers/XEH_PREP.hpp +++ b/addons/killers/XEH_PREP.hpp @@ -1,11 +1,15 @@ PREP(addItemToStash); +PREP(anyKillerFree); PREP(createMarkersForNearbyVehicles); PREP(createStartPositionMarker); +PREP(createStashesMarkers); PREP(createTeleport); PREP(deleteStartPositionsMarkers); +PREP(disableTeleport); PREP(fillKillersStash); PREP(initKillersBase); PREP(initKillersStashes); PREP(initStartPositions); +PREP(killerHandcuffed); PREP(killerKilled); PREP(killerRespawned); diff --git a/addons/killers/XEH_postInit.sqf b/addons/killers/XEH_postInit.sqf index 0d3d78ef..1d274a29 100644 --- a/addons/killers/XEH_postInit.sqf +++ b/addons/killers/XEH_postInit.sqf @@ -1,5 +1,9 @@ #include "script_component.hpp" +[QGVAR(killerHandcuffed), { + _this call FUNC(killerHandcuffed); +}] call CBA_fnc_addEventHandler; + [QGVAR(killerKilled), { params ["_unit"]; // Check if unit was already killed (thanks to new ACE medical) @@ -26,7 +30,21 @@ if (isServer) then { call FUNC(initKillersStashes); }; +// Event for killers starting arsenal initialization +[QGVAR(initStartingEquipment), { + private _arsenal = EGVAR(modules,killersBase) getVariable "Arsenal";; + [_arsenal, EGVAR(equipment,killersStartEquipment)] call EFUNC(common,addItemsToArsenal); + [_arsenal, EGVAR(equipment,killersCivilianEquipment)] call EFUNC(common,addItemsToArsenal); +}] call CBA_fnc_addEventHandler; + if (hasInterface) then { + // Create stashes markers + if (playerSide isEqualTo EAST) then { + [QGVAR(createStashesMarkers), { + _this call FUNC(createStashesMarkers); + }] call CBA_fnc_addEventHandler; + }; + [QGVAR(createTeleport), { if !(playerSide isEqualTo EAST) exitWith {}; _this call FUNC(createTeleport); @@ -40,6 +58,28 @@ if (hasInterface) then { [QGVAR(killerRespawned), [player]] call CBA_fnc_serverEvent; }] call CBA_fnc_waitUntilAndExecute; }] call CBA_fnc_addClassEventHandler; + + [QGVAR(teleportedToStart), { + params ["_flag"]; + private _actionID = player addAction ["Teleport back", { + player setPos getPos (_this select 3) + }, _flag, 10, true]; + // Wait until player teleports back or times out + [{player distance (_this select 0) < 10}, { + // Player teleported back + player removeAction (_this select 1); + }, [_flag, _actionID], 10, { + // Player did not teleport back + player removeAction (_this select 1); + [QGVAR(teleportFinished)] call CBA_fnc_localEvent; + }] call CBA_fnc_waitUntilAndExecute; + }] call CBA_fnc_addEventHandler; + + // Deletes all teleport actions and markers + [QGVAR(teleportFinished), { + call FUNC(deleteStartPositionsMarkers); + call FUNC(disableTeleport); + }] call CBA_fnc_addEventHandler; }; [QGVAR(teleport), { diff --git a/addons/killers/XEH_preInit.sqf b/addons/killers/XEH_preInit.sqf index ab65327c..a3606f78 100644 --- a/addons/killers/XEH_preInit.sqf +++ b/addons/killers/XEH_preInit.sqf @@ -8,5 +8,6 @@ ADDON = false; if (!EGVAR(common,enabled)) exitWith {}; GVAR(killersRespawnMarker) = ""; +GVAR(stashes) = []; ADDON = true; diff --git a/addons/killers/functions/fnc_anyKillerFree.sqf b/addons/killers/functions/fnc_anyKillerFree.sqf new file mode 100644 index 00000000..26645c0f --- /dev/null +++ b/addons/killers/functions/fnc_anyKillerFree.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function checks if any killer is free. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call afsk_killers_fnc_anyKillerFree + * + * Public: No + */ + +if (EGVAR(common,ACE_Loaded)) then { + allPlayers findIf { + side _x isEqualTo EAST + && {alive _x + && {!(_x getVariable [QACEGVAR(captives,isHandcuffed), false]) + }}}!= -1 +} else { + allPlayers findIf { + side _x isEqualTo EAST + && {alive _x + && {!(_x getVariable [QEGVAR(jail,isImprisoned), false]) + }}}!= -1 +}; + diff --git a/addons/killers/functions/fnc_createStashesMarkers.sqf b/addons/killers/functions/fnc_createStashesMarkers.sqf new file mode 100644 index 00000000..fd09808f --- /dev/null +++ b/addons/killers/functions/fnc_createStashesMarkers.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function creates markers for all killers stashes. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ + +{ + private _marker = createMarkerlocal [str _x, getPos _x]; + _marker setMarkerColorlocal "ColorEAST"; + _marker setMarkerSizelocal [0.5,0.5]; + _marker setMarkerTypelocal "mil_pickup"; + _x setVariable [QGVAR(marker), _marker]; +} forEach GVAR(stashes); diff --git a/addons/killers/functions/fnc_createTeleport.sqf b/addons/killers/functions/fnc_createTeleport.sqf index 0ccffe66..3a597f14 100644 --- a/addons/killers/functions/fnc_createTeleport.sqf +++ b/addons/killers/functions/fnc_createTeleport.sqf @@ -25,12 +25,7 @@ private _positionID = 0; private _destinationPos = GVAR(startPositions) getVariable _x; private _teleportActionID = _flag addAction [_destinationName, { [QEGVAR(killers,teleport), [_this select 1, _this select 3 select 0]] call CBA_fnc_localEvent; - // Delete all teleport actions and markers - call FUNC(deleteStartPositionsMarkers); - private _teleportActionsIDs = (_this select 0) getVariable [QGVAR(teleportActionsIDs), []]; - { - (_this select 0 ) removeAction (_x); - } forEach _teleportActionsIDs; + [QGVAR(teleportedToStart), [_this select 0]] call CBA_fnc_localEvent; }, [_destinationPos]]; [_destinationPos, _destinationName] call FUNC(createStartPositionMarker); // Add for deletion after teleportation diff --git a/addons/killers/functions/fnc_disableTeleport.sqf b/addons/killers/functions/fnc_disableTeleport.sqf new file mode 100644 index 00000000..b14d5182 --- /dev/null +++ b/addons/killers/functions/fnc_disableTeleport.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function removes all teleport actions from killers base flag. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ + +private _flag = EGVAR(modules,killersBase) getVariable "Teleporter"; +private _teleportActionsIDs = _flag getVariable [QGVAR(teleportActionsIDs), []]; +{ + (_this select 0 ) removeAction (_x); +} forEach _teleportActionsIDs; diff --git a/addons/killers/functions/fnc_initKillersBase.sqf b/addons/killers/functions/fnc_initKillersBase.sqf index 6128993f..802d8664 100644 --- a/addons/killers/functions/fnc_initKillersBase.sqf +++ b/addons/killers/functions/fnc_initKillersBase.sqf @@ -30,5 +30,4 @@ clearWeaponCargoGlobal _box; clearMagazineCargoGlobal _box; _killersBase setVariable ["Arsenal", _box, true]; _box setVariable ["killersBase", _killersBase, true]; -[_box, EGVAR(equipment,killersStartEquipment)] call EFUNC(common,addItemsToArsenal); -[_box, EGVAR(equipment,killersCivilianEquipment)] call EFUNC(common,addItemsToArsenal); +[QGVAR(initStartingEquipment)] call CBA_fnc_globalEventJIP; diff --git a/addons/killers/functions/fnc_initKillersStashes.sqf b/addons/killers/functions/fnc_initKillersStashes.sqf index 980570ab..a47137a1 100644 --- a/addons/killers/functions/fnc_initKillersStashes.sqf +++ b/addons/killers/functions/fnc_initKillersStashes.sqf @@ -28,7 +28,13 @@ for "_y" from 0 to _createStatshesCount step 1 do { private _stash = _stashes deleteAt (floor (random (count (_stashes)))); private _stashPos = getPos _stash; private _box = createVehicle ["O_CargoNet_01_ammo_F", _stashPos, [], 0, "NONE"]; + clearItemCargoGlobal _box; _box setVariable [QGVAR(killersStash), _stash]; _stash setVariable [QGVAR(box), _box]; _box call FUNC(fillKillersStash); + GVAR(stashes) pushback _box; }; + +publicVariable QGVAR(stashes); + +[QGVAR(createStashesMarkers)] call CBA_fnc_globalEventJIP; diff --git a/addons/killers/functions/fnc_killerHandcuffed.sqf b/addons/killers/functions/fnc_killerHandcuffed.sqf new file mode 100644 index 00000000..26511dfb --- /dev/null +++ b/addons/killers/functions/fnc_killerHandcuffed.sqf @@ -0,0 +1,27 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function handles killer being handcuffed event. + * + * Arguments: + * 0: Handcuffed killer + * + * Return Value: + * None + * + * Example: + * [bob] call afsk_killers_fnc_killerHandcuffed + * + * Public: No + */ + +params ["_killer"]; + +if !(isServer) exitWith {}; + +_killer setVariable [QEGVAR(jail,isImprisoned), true, true]; + +private _anyKillerFree = call FUNC(anyKillerFree); +if (!_anyKillerFree) then { + [QEGVAR(score,killersKilled)] call CBA_fnc_serverEvent; +}; diff --git a/addons/killers/functions/fnc_killerKilled.sqf b/addons/killers/functions/fnc_killerKilled.sqf index beacc686..3b236a94 100644 --- a/addons/killers/functions/fnc_killerKilled.sqf +++ b/addons/killers/functions/fnc_killerKilled.sqf @@ -20,10 +20,5 @@ params ["_unit", "_killer"]; if !(isServer) exitWith {}; -private _aliveKillers = allPlayers select {side _x isEqualTo EAST && {alive _x && {!(_x getVariable [QGVAR(isImprisoned), false])}}}; -if (_aliveKillers isEqualTo []) then { - [QEGVAR(score,killersKilled)] call CBA_fnc_serverEvent; -}; - // Create spectator for killer so he won't get bored when he's dead or imprisoned. [QEGVAR(common,initializeSpectator), [], _unit] call CBA_fnc_targetEvent; diff --git a/addons/markers/functions/fnc_createCivilianMarker.sqf b/addons/markers/functions/fnc_createCivilianMarker.sqf index f97cb7de..8b062bfa 100644 --- a/addons/markers/functions/fnc_createCivilianMarker.sqf +++ b/addons/markers/functions/fnc_createCivilianMarker.sqf @@ -17,6 +17,10 @@ params ["_civilian"]; +if (_civilian isEqualTo objNull) exitWith { + WARNING("Can't create marker for null civilian"); +}; + private _marker = format["civilian_%1", _civilian]; createMarkerLocal [_marker, getPos _civilian]; _marker setMarkerTypeLocal "mil_dot"; diff --git a/addons/markers/functions/fnc_createCopMarker.sqf b/addons/markers/functions/fnc_createCopMarker.sqf index 65ecc590..7063e046 100644 --- a/addons/markers/functions/fnc_createCopMarker.sqf +++ b/addons/markers/functions/fnc_createCopMarker.sqf @@ -20,7 +20,7 @@ params ["_cop"]; private _marker = format["cop_%1", name _cop]; createMarkerLocal [_marker, getPos _cop]; _marker setMarkerTypeLocal "mil_dot"; -_marker setMarkerSizeLocal [0.5, 0.5]; +_marker setMarkerSizeLocal [0.75, 0.75]; _marker setMarkerColorLocal "ColorWEST"; _marker setMarkerTextLocal (name _cop); _cop setVariable [QGVAR(marker), _marker]; diff --git a/addons/markers/functions/fnc_createKillerMarker.sqf b/addons/markers/functions/fnc_createKillerMarker.sqf index b7670e21..880f2b64 100644 --- a/addons/markers/functions/fnc_createKillerMarker.sqf +++ b/addons/markers/functions/fnc_createKillerMarker.sqf @@ -21,11 +21,15 @@ params ["_killer", ["_hidden", false]]; private _marker = format["killer_%1", name _killer]; createMarkerLocal [_marker, getPos _killer]; _marker setMarkerTypeLocal "mil_dot"; -_marker setMarkerSizeLocal [0.5, 0.5]; if (_hidden) then { _marker setMarkerColorLocal "ColorGreen"; } else { _marker setMarkerColorLocal "ColorEAST"; +}; +if (playerSide isEqualTo EAST) then { + _marker setMarkerSizeLocal [0.75, 0.75]; _marker setMarkerTextLocal (name _killer); +} else { + _marker setMarkerSizeLocal [0.5, 0.5]; }; _killer setVariable [QGVAR(marker), _marker]; diff --git a/addons/markers/functions/fnc_loop.sqf b/addons/markers/functions/fnc_loop.sqf index 710f7c76..7bdf5b1c 100644 --- a/addons/markers/functions/fnc_loop.sqf +++ b/addons/markers/functions/fnc_loop.sqf @@ -46,6 +46,7 @@ if (playerSide isEqualTo WEST) then { private _marker = _killer getVariable [QGVAR(marker), ""]; // Check if player should be able to see killer's marker if (playerSide isEqualTo EAST || {_hidden}) then { + // Check if killer already has marker if (_marker isEqualTo "") then { _marker = [_killer, _hidden] call FUNC(createKillerMarker); } else { diff --git a/addons/modules/CfgVehicles.hpp b/addons/modules/CfgVehicles.hpp index 178e54d8..cc5c103f 100644 --- a/addons/modules/CfgVehicles.hpp +++ b/addons/modules/CfgVehicles.hpp @@ -15,7 +15,7 @@ class CfgVehicles { scope = 2; displayName = CSTRING(Jail); category = QUOTE(PREFIX); - function = QFUNC(moduleJail); + // function = QFUNC(moduleJail); functionPriority = 1; isGlobal = 0; isTriggerActivated = 0; @@ -41,7 +41,7 @@ class CfgVehicles { scope = 2; displayName = CSTRING(PoliceStation_Name); category = QUOTE(PREFIX); - function = QFUNC(modulePoliceStation); + // function = QFUNC(modulePoliceStation); functionPriority = 1; isGlobal = 0; isTriggerActivated = 0; @@ -78,7 +78,7 @@ class CfgVehicles { scope = 2; displayName = CSTRING(Killers_Base); category = QUOTE(PREFIX); - function = QFUNC(moduleKillersBase); + // function = QFUNC(moduleKillersBase); functionPriority = 1; isGlobal = 0; isTriggerActivated = 0; @@ -95,7 +95,7 @@ class CfgVehicles { scope = 2; displayName = CSTRING(Killers_Start); category = QUOTE(PREFIX); - function = QFUNC(moduleKillersStart); + // function = QFUNC(moduleKillersStart); functionPriority = 1; isGlobal = 0; isTriggerActivated = 0; @@ -118,7 +118,7 @@ class CfgVehicles { scope = 2; displayName = CSTRING(Killers_Stash); category = QUOTE(PREFIX); - function = QFUNC(moduleKillersStash); + // function = QFUNC(moduleKillersStash); functionPriority = 1; isGlobal = 0; isTriggerActivated = 0; diff --git a/addons/modules/XEH_PREP.hpp b/addons/modules/XEH_PREP.hpp index addab411..0311114a 100644 --- a/addons/modules/XEH_PREP.hpp +++ b/addons/modules/XEH_PREP.hpp @@ -1,5 +1,8 @@ -PREP(moduleJail); -PREP(moduleKillersBase); +PREP(initJail); +PREP(initPoliceStations); +PREP(initKillersBase); +PREP(initKillersStarts); +PREP(initKillersStashes); PREP(moduleKillersStart); PREP(moduleKillersStash); PREP(modulePoliceStation); diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index 0e20923b..0fc63132 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -1,5 +1,14 @@ #include "script_component.hpp" if (isServer) then { + GVAR(jail) = call FUNC(initJail); + GVAR(policeStations) = call FUNC(initPoliceStations); + GVAR(killersBase) = call FUNC(initKillersBase); + GVAR(killersStartPositions) = call FUNC(initKillersStarts); + GVAR(killersStashes) = call FUNC(initKillersStashes); + + publicVariable QGVAR(jail); + publicVariable QGVAR(killersBase); + publicVariable QGVAR(killersStashes); publicVariable QGVAR(policeStations); }; diff --git a/addons/modules/XEH_preInit.sqf b/addons/modules/XEH_preInit.sqf index f6ce2f4d..025633c3 100644 --- a/addons/modules/XEH_preInit.sqf +++ b/addons/modules/XEH_preInit.sqf @@ -7,8 +7,11 @@ if (!EGVAR(common,enabled)) exitWith {}; GVAR(jail) = objNull; GVAR(killersBase) = objNull; -GVAR(killersStartPositions) = []; GVAR(killersStashes) = []; GVAR(policeStations) = []; +if (isServer) then { + GVAR(killersStartPositions) = []; +}; + ADDON = true; diff --git a/addons/modules/functions/fnc_initJail.sqf b/addons/modules/functions/fnc_initJail.sqf new file mode 100644 index 00000000..4c69ed92 --- /dev/null +++ b/addons/modules/functions/fnc_initJail.sqf @@ -0,0 +1,29 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function initializes jail module. + * + * Arguments: + * None + * + * Return Value: + * Jail module + * + * Example: + * None + * + * Public: No + */ + +private _jailModules = entities QGVAR(moduleJail); + +if (_jailModules isEqualTo []) exitWith { + ERROR("Jail module not placed, cannot create jail!"); + nil +}; + +if (count _jailModules > 1) then { + WARNING("Detected more than 1 jail module. Using first one, which can be random!"); +}; + +_jailModules select 0 diff --git a/addons/modules/functions/fnc_initKillersBase.sqf b/addons/modules/functions/fnc_initKillersBase.sqf new file mode 100644 index 00000000..839e3bf1 --- /dev/null +++ b/addons/modules/functions/fnc_initKillersBase.sqf @@ -0,0 +1,29 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function initializes killers base module. + * + * Arguments: + * None + * + * Return Value: + * Killers base module + * + * Example: + * None + * + * Public: No + */ + +private _killersBaseModules = entities QGVAR(moduleKillersBase); + +if (_killersBaseModules isEqualTo []) exitWith { + ERROR("Killers base module not placed, cannot create killers base!"); + nil +}; + +if (count _killersBaseModules > 1) then { + WARNING("Detected more than 1 killers base module. Using first one, which can be random!"); +}; + +_killersBaseModules select 0 diff --git a/addons/modules/functions/fnc_initKillersStarts.sqf b/addons/modules/functions/fnc_initKillersStarts.sqf new file mode 100644 index 00000000..29990f1d --- /dev/null +++ b/addons/modules/functions/fnc_initKillersStarts.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function initializes killers start modules. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ + +private _killersStartModules = entities QGVAR(moduleKillersStart); + +{ + [_x] call FUNC(moduleKillersStart); +} forEach _killersStartModules; + +_killersStartModules diff --git a/addons/modules/functions/fnc_initKillersStashes.sqf b/addons/modules/functions/fnc_initKillersStashes.sqf new file mode 100644 index 00000000..8aec1857 --- /dev/null +++ b/addons/modules/functions/fnc_initKillersStashes.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function initializes killers stash modules. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ + +private _killersStashModules = entities QGVAR(moduleKillersStash); + +{ + [_x] call FUNC(moduleKillersStash); +} forEach _killersStashModules; + +_killersStashModules diff --git a/addons/modules/functions/fnc_initPoliceStations.sqf b/addons/modules/functions/fnc_initPoliceStations.sqf new file mode 100644 index 00000000..3c56e4ea --- /dev/null +++ b/addons/modules/functions/fnc_initPoliceStations.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Function initializes police station modules. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ + +private _policeStationModules = entities QGVAR(modulePoliceStation); + +{ + [_x] call FUNC(modulePoliceStation); +} forEach _policeStationModules; + +_policeStationModules diff --git a/addons/modules/functions/fnc_moduleJail.sqf b/addons/modules/functions/fnc_moduleJail.sqf deleted file mode 100644 index 684f46b9..00000000 --- a/addons/modules/functions/fnc_moduleJail.sqf +++ /dev/null @@ -1,24 +0,0 @@ -#include "script_component.hpp" -/* - * Author: 3Mydlo3 - * Function assigns jail module to variable for further initialization. - * - * Arguments: - * 0: Jail module - * - * Return Value: - * None - * - * Example: - * None - * - * Public: No - */ - -params ["_module"]; - -if !(GVAR(jail) isEqualTo objNull) exitWith { - LOG("Multiple jail modules placed."); -}; - -GVAR(jail) = _module; diff --git a/addons/modules/functions/fnc_moduleKillersBase.sqf b/addons/modules/functions/fnc_moduleKillersBase.sqf deleted file mode 100644 index a44a241e..00000000 --- a/addons/modules/functions/fnc_moduleKillersBase.sqf +++ /dev/null @@ -1,24 +0,0 @@ -#include "script_component.hpp" -/* - * Author: 3Mydlo3 - * Function cośtam. - * - * Arguments: - * 0: Killers base module - * - * Return Value: - * None - * - * Example: - * None - * - * Public: No - */ - -params ["_module"]; - -if !(GVAR(killersBase) isEqualTo objNull) exitWith { - LOG("Multiple killers base modules placed."); -}; - -GVAR(killersBase) = _module; diff --git a/addons/modules/functions/fnc_moduleKillersStart.sqf b/addons/modules/functions/fnc_moduleKillersStart.sqf index 1856eca4..16e64324 100644 --- a/addons/modules/functions/fnc_moduleKillersStart.sqf +++ b/addons/modules/functions/fnc_moduleKillersStart.sqf @@ -17,8 +17,6 @@ params ["_module"]; -GVAR(killersStartPositions) pushBack _module; - private _locationName = _module getVariable ["LocationName", ""]; if (_locationName isEqualTo "") then { _module setVariable ["LocationName", [_module] call EFUNC(common,getNearestLocationName)]; diff --git a/addons/modules/functions/fnc_moduleKillersStash.sqf b/addons/modules/functions/fnc_moduleKillersStash.sqf index 61ddccb1..c0c0a59c 100644 --- a/addons/modules/functions/fnc_moduleKillersStash.sqf +++ b/addons/modules/functions/fnc_moduleKillersStash.sqf @@ -17,4 +17,4 @@ params ["_module"]; -GVAR(killersStashes) pushBack _module; +nil diff --git a/addons/modules/functions/fnc_modulePoliceStation.sqf b/addons/modules/functions/fnc_modulePoliceStation.sqf index c458295b..9de1d235 100644 --- a/addons/modules/functions/fnc_modulePoliceStation.sqf +++ b/addons/modules/functions/fnc_modulePoliceStation.sqf @@ -17,8 +17,6 @@ params ["_module"]; -GVAR(policeStations) pushBack _module; - private _locationName = _module getVariable ["LocationName", ""]; if (_locationName isEqualTo "") then { _module setVariable ["LocationName", [_module] call EFUNC(common,getNearestLocationName), true]; diff --git a/addons/modules/stringtable.xml b/addons/modules/stringtable.xml index 437d57f8..2e9cca24 100644 --- a/addons/modules/stringtable.xml +++ b/addons/modules/stringtable.xml @@ -17,6 +17,10 @@ Has helipad Posiada lądowisko dla helikoptera + + Killers Base + Baza Zabójców + Killers Start Start Zabójców diff --git a/addons/police/XEH_postInit.sqf b/addons/police/XEH_postInit.sqf index ae873a13..cb9faa84 100644 --- a/addons/police/XEH_postInit.sqf +++ b/addons/police/XEH_postInit.sqf @@ -2,11 +2,15 @@ if (isServer) then { // Initialize police stations - { - [_x] call FUNC(initPoliceStation); - // Initialize respawn for given police station - [WEST, _x] call BIS_fnc_addRespawnPosition; - } forEach EGVAR(modules,policeStations); + [{EGVAR(modules,policeStations) isNotEqualTo []},{ + [{ + { + [_x] call FUNC(initPoliceStation); + // Initialize respawn for given police station + [WEST, _x] call BIS_fnc_addRespawnPosition; + } forEach EGVAR(modules,policeStations); + }] call CBA_fnc_execNextFrame; + }] call CBA_fnc_waitUntilAndExecute; [QGVAR(copKilled), { params ["_unit"]; @@ -51,12 +55,13 @@ call FUNC(equipmentScoreCheck); call FUNC(equipmentScoreCheck); }] call CBA_fnc_addEventHandler; -if (!isServer) then { +if (hasInterface) then { if !(playerSide isEqualTo WEST) exitWith {}; player addEventHandler ["Killed", { [QGVAR(copKilled), _this] call CBA_fnc_serverEvent; }]; player addEventHandler ["Respawn", { + player setUnitLoadout EGVAR(common,playerLoadout); [QGVAR(copRespawned), _this] call CBA_fnc_serverEvent; }]; }; diff --git a/addons/police/functions/fnc_copKilledMarker.sqf b/addons/police/functions/fnc_copKilledMarker.sqf index 1f9b2b9a..e3489c29 100644 --- a/addons/police/functions/fnc_copKilledMarker.sqf +++ b/addons/police/functions/fnc_copKilledMarker.sqf @@ -26,6 +26,6 @@ _marker setMarkerColor "ColorWEST"; _marker setMarkerSize [0.4, 0.4]; _marker setMarkerText _markerText; -[_marker] call EFUNC(common,markerDecay); +[_marker] call EFUNC(markers,markerDecay); _marker diff --git a/addons/police/functions/fnc_equipmentScoreCheck.sqf b/addons/police/functions/fnc_equipmentScoreCheck.sqf index 6b0a3440..0d6c7064 100644 --- a/addons/police/functions/fnc_equipmentScoreCheck.sqf +++ b/addons/police/functions/fnc_equipmentScoreCheck.sqf @@ -30,6 +30,7 @@ while {GVAR(lastEquipmentUpdateScore) != EGVAR(score,policeScore)} do { [_x, _scoreItems] call EFUNC(common,addItemsToArsenal); [_x, _scoreVehicles] call FUNC(addVehiclesToSpawner); } else { + if (EGVAR(score,policeScore) < 0) exitWith {}; [_x, _scoreItems] call EFUNC(common,removeItemsFromArsenal); [_x, _scoreVehicles] call FUNC(removeVehiclesFromSpawner); }; diff --git a/addons/score/XEH_postInit.sqf b/addons/score/XEH_postInit.sqf index fa625ada..c960e226 100644 --- a/addons/score/XEH_postInit.sqf +++ b/addons/score/XEH_postInit.sqf @@ -34,18 +34,20 @@ if (isServer) then { // Idle timeout init if (GVAR(idleTimeMax) isEqualTo -1) exitWith {}; [{ - private _msg = composeText [ - text format [LLSTRING(IdleTime_Inital_Message), (GVAR(IdleTimeMax) / 60) toFixed 1], - lineBreak, - lineBreak, - text format ["%1: %2", LELSTRING(killers,Killers), GVAR(idleTimeKillersScoreChange)], - lineBreak, - text format ["%1: %2", LELSTRING(police,Police), GVAR(idleTimePoliceScoreChange)] - ]; - _msg setAttributes ["valign", "middle"]; - [QEGVAR(common,showMessage), [_msg, [3]]] call CBA_fnc_globalEvent; - call FUNC(monitorTimeouts); - }, [], GVAR(idleTimeMax)] call CBA_fnc_waitAndExecute; + [{ + private _msg = composeText [ + text format [LLSTRING(IdleTime_Inital_Message), (GVAR(IdleTimeMax) / 60) toFixed 1], + lineBreak, + lineBreak, + text format ["%1: %2", LELSTRING(killers,Killers), GVAR(idleTimeKillersScoreChange)], + lineBreak, + text format ["%1: %2", LELSTRING(police,Police), GVAR(idleTimePoliceScoreChange)] + ]; + _msg setAttributes ["valign", "middle"]; + [QEGVAR(common,showMessage), [_msg, [3]]] call CBA_fnc_globalEvent; + call FUNC(monitorTimeouts); + }, [], GVAR(idleTimeMax)] call CBA_fnc_waitAndExecute; + }] call CBA_fnc_execNextFrame; // Initialize score display UI [WEST, 0] call BIS_fnc_respawnTickets; @@ -67,4 +69,7 @@ if (hasInterface) then { [QGVAR(showScore), { _this call FUNC(showScore); }] call CBA_fnc_addEventHandler; + + // Disable vanilla ratings + player addEventHandler ["HandleRating", { 0 }]; }; diff --git a/addons/score/functions/fnc_addKillersScore.sqf b/addons/score/functions/fnc_addKillersScore.sqf index dcd13096..331b8f09 100644 --- a/addons/score/functions/fnc_addKillersScore.sqf +++ b/addons/score/functions/fnc_addKillersScore.sqf @@ -29,6 +29,10 @@ publicVariable QGVAR(killersScore); GVAR(killersScoreChange) = GVAR(killersScoreChange) + _scoreChange; publicVariable QGVAR(killersScoreChange); + +// Save change time +GVAR(killersScoreLastChangeTime) = CBA_missionTime; + [{ if (GVAR(killersScoreChange) isEqualTo (_this select 0)) then { GVAR(killersScoreChange) = 0; diff --git a/addons/score/functions/fnc_addPoliceScore.sqf b/addons/score/functions/fnc_addPoliceScore.sqf index 57d96529..4f5ad516 100644 --- a/addons/score/functions/fnc_addPoliceScore.sqf +++ b/addons/score/functions/fnc_addPoliceScore.sqf @@ -29,6 +29,10 @@ publicVariable QGVAR(policeScore); GVAR(policeScoreChange) = GVAR(policeScoreChange) + _scoreChange; publicVariable QGVAR(policeScoreChange); + +// Save change time +GVAR(policeScoreLastChangeTime) = CBA_missionTime; + [{ if (GVAR(policeScoreChange) isEqualTo (_this select 0)) then { GVAR(policeScoreChange) = 0; diff --git a/addons/score/functions/fnc_monitorTimeouts.sqf b/addons/score/functions/fnc_monitorTimeouts.sqf index 4e1aac0c..4711d2ae 100644 --- a/addons/score/functions/fnc_monitorTimeouts.sqf +++ b/addons/score/functions/fnc_monitorTimeouts.sqf @@ -28,15 +28,13 @@ if (GVAR(killersScoreChange) isEqualTo 0) then { call FUNC(monitorTimeouts); }, [], GVAR(idleTimeMax), { // Killers failed to increase their score within time limit - GVAR(killersScoreLastChangeTime) = CBA_missionTime; - GVAR(policeScoreLastChangeTime) = CBA_missionTime; private _msg = format [LLSTRING(IdleTime_TimeoutReached), GVAR(idleTimeouts), GVAR(idleTimeoutsMax)]; - [QGVAR(scoreChanged), [WEST, 5, _msg]] call CBA_fnc_serverEvent; + [QGVAR(changeScore), [EAST, 0, _msg]] call CBA_fnc_serverEvent; + [QGVAR(changeScore), [WEST, 5, _msg]] call CBA_fnc_serverEvent; }] call CBA_fnc_waitUntilAndExecute; } else { [{GVAR(killersScoreChange) isEqualTo 0}, { - // Killers no longer increase their score so let's save current time - GVAR(killersScoreLastChangeTime) = CBA_missionTime; + // Killers no longer increase their score call FUNC(monitorTimeouts); }] call CBA_fnc_waitUntilAndExecute; }; diff --git a/addons/score/initSettings.sqf b/addons/score/initSettings.sqf index 200655c6..4a6073ae 100644 --- a/addons/score/initSettings.sqf +++ b/addons/score/initSettings.sqf @@ -16,7 +16,7 @@ "SLIDER", [LSTRING(KilledCivilianKillersScore), LSTRING(KilledCivilianKillersScore_Description)], [LSTRING(DisplayName), LSTRING(Score)], - [-10, 10, 2, 0], + [-10, 10, 1, 0], true ] call CBA_fnc_addSetting; @@ -25,7 +25,7 @@ "SLIDER", [LSTRING(KilledCivilianPoliceScore), LSTRING(KilledCivilianPoliceScore_Description)], [LSTRING(DisplayName), LSTRING(Score)], - [-10, 10, 2, 0], + [-10, 10, 1, 0], true ] call CBA_fnc_addSetting; @@ -34,7 +34,7 @@ "SLIDER", [LSTRING(PoliceKilledCivilianKillersScore), LSTRING(PoliceKilledCivilianKillersScore_Description)], [LSTRING(DisplayName), LSTRING(Score)], - [-10, 10, 2, 0], + [-10, 10, 1, 0], true ] call CBA_fnc_addSetting;