Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fixes and enhancements #49

Merged
merged 28 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b79e800
Fix score timeout monitoring
3Mydlo3 Feb 9, 2020
626c472
Add ability to revert teleportation for killers
3Mydlo3 Feb 9, 2020
ba2bae9
Initialize killers starting equipment globally (and JIP)
3Mydlo3 Feb 9, 2020
1363b3e
Always show killer's name on marker for other killers
3Mydlo3 Feb 9, 2020
907441e
Fix civilian equipment not available for killers
3Mydlo3 Feb 9, 2020
cb5526c
Publish all modules variables
3Mydlo3 Feb 9, 2020
0c8b6d8
Create stashes markers by JIP event
3Mydlo3 Feb 9, 2020
b1c37be
Reset cop loadout on respawn
3Mydlo3 Feb 9, 2020
34349b2
Make players markers bigger than civilian markers
3Mydlo3 Feb 9, 2020
07b9d0a
Fix markers decay not working
3Mydlo3 Feb 10, 2020
918da68
Make score rewards on par with old version
3Mydlo3 Jan 9, 2024
42b64ec
Fix teleportation revert for killers not working
3Mydlo3 Jan 10, 2024
02ca824
Clear all items from killer stash box before filling it
3Mydlo3 Jan 10, 2024
86c9833
Broadcast all killers stashes at once
3Mydlo3 Jan 10, 2024
d1eb53d
Prevent cops from losing all equipment when their score goes negative
3Mydlo3 Jan 18, 2024
0974d5c
Fix police loadout not being reset after respawn
3Mydlo3 Jan 18, 2024
f8b5638
Fix police respawn not working properly in localhost
3Mydlo3 Jan 18, 2024
3d61ab6
Fix idle timer starting immediately
3Mydlo3 Jan 25, 2024
bd54e69
Detect failure when creating civilian unit to prevent markers at [0,0]
3Mydlo3 Jan 25, 2024
ea6f4ad
Fix jail and killers base initialization when there are more objects …
3Mydlo3 Jan 25, 2024
f1957d6
Drop vanikał module initialization in favor of postInit + entities se…
3Mydlo3 Jan 25, 2024
54d4201
Improve handcuffing detection to avoid game end when killers are free
3Mydlo3 Jan 25, 2024
a058ae2
Revert "Fix jail and killers base initialization when there are more …
3Mydlo3 Jan 25, 2024
b16cd1a
Add error when jail is not detected
3Mydlo3 Jan 25, 2024
db800d0
Add function to free all prisoners at once and optionally teleport them
3Mydlo3 Jan 26, 2024
470c853
Fix fnc_anyKillerFree
3Mydlo3 Jan 26, 2024
0ee955b
Disable vanilla ratings
3Mydlo3 Jan 27, 2024
ebffee1
Merge remote-tracking branch 'origin/master' into more-fixes
3Mydlo3 Jan 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions addons/civilian/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion addons/civilian/functions/fnc_civilianKilledMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion addons/civilian/functions/fnc_createCivilian.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 3 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions addons/jail/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PREP(addReleaseAction);
PREP(canRelease);
PREP(createKillersRespawn);
PREP(free);
PREP(freeAll);
PREP(getRandomJailPos);
PREP(imprison);
PREP(jailMarker);
Expand Down
11 changes: 10 additions & 1 deletion addons/jail/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ 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;

if (!(GVAR(jail) isEqualTo objNull)) then {
GVAR(jailMarker) = call FUNC(jailMarker);
call FUNC(createKillersRespawn);
} else {
ERROR("Jail not detected!");
};
};

Expand All @@ -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;
};
Expand Down
32 changes: 32 additions & 0 deletions addons/jail/functions/fnc_freeAll.sqf
Original file line number Diff line number Diff line change
@@ -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 <OBJECT>
*
* 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;
4 changes: 4 additions & 0 deletions addons/killers/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -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);
40 changes: 40 additions & 0 deletions addons/killers/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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);
Expand All @@ -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), {
Expand Down
1 change: 1 addition & 0 deletions addons/killers/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ ADDON = false;
if (!EGVAR(common,enabled)) exitWith {};

GVAR(killersRespawnMarker) = "";
GVAR(stashes) = [];

ADDON = true;
31 changes: 31 additions & 0 deletions addons/killers/functions/fnc_anyKillerFree.sqf
Original file line number Diff line number Diff line change
@@ -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
};

24 changes: 24 additions & 0 deletions addons/killers/functions/fnc_createStashesMarkers.sqf
Original file line number Diff line number Diff line change
@@ -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);
7 changes: 1 addition & 6 deletions addons/killers/functions/fnc_createTeleport.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions addons/killers/functions/fnc_disableTeleport.sqf
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 1 addition & 2 deletions addons/killers/functions/fnc_initKillersBase.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 6 additions & 0 deletions addons/killers/functions/fnc_initKillersStashes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
27 changes: 27 additions & 0 deletions addons/killers/functions/fnc_killerHandcuffed.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3
* Function handles killer being handcuffed event.
*
* Arguments:
* 0: Handcuffed killer <OBJECT>
*
* 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;
};
5 changes: 0 additions & 5 deletions addons/killers/functions/fnc_killerKilled.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 4 additions & 0 deletions addons/markers/functions/fnc_createCivilianMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion addons/markers/functions/fnc_createCopMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];
6 changes: 5 additions & 1 deletion addons/markers/functions/fnc_createKillerMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];
1 change: 1 addition & 0 deletions addons/markers/functions/fnc_loop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading