Skip to content

Commit

Permalink
support Antistasi/client-side civ registration
Browse files Browse the repository at this point in the history
  • Loading branch information
musurca committed May 13, 2019
1 parent 990d978 commit 2aa6d67
Showing 8 changed files with 58 additions and 39 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -76,6 +76,9 @@ For questions, comments, or bug reports, please contact me directly at nick.musu
CHANGELOG:
---------------------

v1.22 (May 13, 2019):
* bugfix: now supports Antistasi (as well as other mods/game types where civilians are created on the client-side)

v1.21 (May 11, 2019):
* bugfix: death of Zeus-placed civilians now registered on dedicated servers

Binary file modified addons/GR/config.bin
Binary file not shown.
11 changes: 10 additions & 1 deletion addons/GR/config.cpp
Original file line number Diff line number Diff line change
@@ -21,7 +21,8 @@ class CfgFunctions
class initClient { postInit = 1; };
class initServer { postInit = 1; };
class onUnitKilled {};
class onZeusCivPlaced {};
class onLocalCivKilled {};
class onClientCivKilled {};
class makeMissionDeliverBody {};
class burybody {};
class exhumebody {};
@@ -35,4 +36,12 @@ class CfgFunctions
class MPhint {};
};
};
};

class Extended_Killed_EventHandlers {
class CAManBase {
class GR_CAManBase_Init {
killed = "if(!isServer) then { [_this select 0, _this select 1] call GR_fnc_onLocalCivKilled; }";
};
};
};
18 changes: 0 additions & 18 deletions addons/GR/functions/fn_initClient.sqf
Original file line number Diff line number Diff line change
@@ -14,24 +14,6 @@ if (isNil "GR_DEATHNOTIFY_STYLE") then {
GR_DEATHNOTIFY_STYLE=GR_NOTIFY_HINT;
};

// If made Zeus after connecting to a dedicated server,
// transfer ownership of civilian units to the server
if (!isServer) then {
[] spawn {
waitUntil {!isNull (getAssignedCuratorLogic player)};
(getAssignedCuratorLogic player) addEventHandler ["CuratorObjectPlaced", {
params["_curator", "_entity"];
if ((side group _entity) == civilian) then {
{
if(_x isKindOf "CAManBase") then {
[_x, name _x] remoteExecCall ["GR_fnc_onZeusCivPlaced",2];
};
} forEach units (group _entity);
};
}];
};
};

// new ACE actions for body bags and graves
GR_ace_burialAction = ["actionBury","Bury","",{
player playMove "acts_miller_knockout"; //alt: 'Acts_CivilTalking_2'
21 changes: 21 additions & 0 deletions addons/GR/functions/fn_onClientCivKilled.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
fn_onClientCivKilled.sqf
by @musurca
Remote call from client about dead civilian.
*/

if (!isServer) exitWith {};

params["_killed", "_killer", "_name"];

// Transfer ownership to server immediately
(group _killed) setGroupOwner 2;

// Fix strange name transfer bug
_nameTokens = _name splitString " ";
_killed setName [_name, _nameTokens select 0, _nameTokens select 1];

[_killed, _killer] call GR_fnc_onUnitKilled;
23 changes: 23 additions & 0 deletions addons/GR/functions/fn_onLocalCivKilled.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
fn_onLocalCivKilled.sqf
by @musurca
Client-side-only event about dead civilian.
*/

params ["_killed", ["_killer", objNull]];

if ((isNull _killer) || {_killer == _killed}) then {
_killer = _killed getVariable ["ace_medical_lastDamageSource", objNull];
};

// See if it's a vehicle
if ((!isNull _killer) && {!(_killer isKindof "CAManBase")}) then {
_killer = effectiveCommander _killer;
};

if(side (group _killed) == civilian) then {
[_killed, _killer, name _killed] remoteExecCall ["GR_fnc_onClientCivKilled",2];
};
19 changes: 0 additions & 19 deletions addons/GR/functions/fn_onZeusCivPlaced.sqf

This file was deleted.

2 changes: 1 addition & 1 deletion mod.cpp
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ overview = "Civilian deaths, reparations, and war crimes. Deliver the bodies of
author = "@musurca";
overviewText = "GR";
overviewPicture = "img\logomain.paa";
overviewFootnote = "v121";
overviewFootnote = "v122";

0 comments on commit 2aa6d67

Please sign in to comment.