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

Radio rebroadcasting and automated griefing reports. #27

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions KC_Liberation_Master_Framework/functions/fn_crGlobalMsg.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ switch (_msgType) do {
case 3: {systemChat (format [localize "STR_CR_RESISTANCE_KILLMSG", (_data select 0)]);};
case 4: {systemChat (format [localize "STR_CR_HEALMSG", (_data select 0)]);};
case 5: {["lib_asymm_guerilla_incoming", _data] call BIS_fnc_showNotification;};
case 6: {systemChat (format ["%1 teammates killed by %2 (CHECK GRIEFING)", (_data select 0), (_data select 1)])};
case 7: {systemChat (format ["%1 friendly resistance members killed by %2 (CHECK GRIEFING)", (_data select 0), (_data select 1)])};
case 8: {systemChat (format ["%1 civilians by %2 (CHECK GRIEFING)", (_data select 0), (_data select 1)])};
default {[format ["globalMsg without valid msgType - %1", _msgType], "CIVREP"] remoteExecCall ["KPLIB_fnc_log", 2];};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ KPLIB_sectorsUnderAttack = [];
resources_intel = 0;
// State if the save is fully loaded
save_is_loaded = false;
//session based stats
TeamKillers = createHashMap;
ResistanceKillers = createHashMap;
CivilianKillers = createHashMap;


// Add all buildings for saving and kill manager ignore
_noKillHandler append KPLIB_b_buildings_classes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ private _tower = objNull;
_tower setPos (markerpos _x);
_tower setVectorUp [0, 0, 1];
_tower addEventHandler ["HandleDamage", {0}];
if (_x in blufor_sectors) then {
_liberated_sector setVariable ["adv_var_isRelay",true,true];
[_liberated_sector, 7000] call TFAR_antennas_fnc_initRadioTower;
systemChat "Radio repeater activated.";
};

} forEach sectors_tower;
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ if (_liberated_sector in sectors_factory) then {
];
};

if (_liberated_sector in sectors_tower) then {
_liberated_sector setVariable ["adv_var_isRelay",true,true];
[_liberated_sector, 7000] call TFAR_antennas_fnc_initRadioTower;
systemChat "Radio repeater activated.";
};

[_liberated_sector] spawn F_cr_liberatedSector;

if ((random 100) <= KP_liberation_cr_wounded_chance || (count blufor_sectors) == 1) then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ if ( GRLIB_endgame == 0 ) then {
reset_battlegroups_ai = true;
[] spawn KPLIB_fnc_doSave;
stats_sectors_lost = stats_sectors_lost + 1;
if (_sector in sectors_tower) then {
_sector setVariable ["adv_var_isRelay",false,true];
[_sector] call TFAR_antennas_fnc_deleteRadioTower;
systemChat "Radio repeater deactivated.";
};
{
if (_sector in _x) exitWith {
if ((count (_x select 3)) == 3) then {
Expand Down
77 changes: 77 additions & 0 deletions KC_Liberation_Master_Framework/scripts/shared/kill_manager.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
params ["_unit", "_killer"];
if (isNil {profileNamespace getVariable "civilian_kills_per_player"}) then { // if profilenamespace doesn't find variable it creates as 0
profileNamespace setVariable ["civilian_kills_per_player", createHashMap];
};
if (isNil {profileNamespace getVariable "resistance_kills_per_player"}) then {
profileNamespace setVariable ["resistance_kills_per_player", createHashMap];
};
if (isNil {profileNamespace getVariable "teamkills_per_player"}) then {
profileNamespace setVariable ["teamkills_per_player", createHashMap];
};

if (isServer) then {

Expand Down Expand Up @@ -92,6 +101,25 @@ if (isServer) then {
// Killed by BLUFOR
if (side _killer == GRLIB_side_friendly) then {
stats_blufor_teamkills = stats_blufor_teamkills + 1;

// check TK griefing
if (name _killer in TeamKillers) then {
TeamKillers set [name _killer, (TeamKillers get (name _killer)) + 1];
} else {
TeamKillers set [name _killer, 1];
};
if (TeamKillers get name _killer >= 5) then {
[6, [(TeamKillers get (name _killer)), (name _killer)]] remoteExec ["KPLIB_fnc_crGlobalMsg"];
};
// save teamkill data
private _hashMap = ProfileNamespace getVariable "teamkills_per_player";
if (name _killer in _hashMap) then {
_hashMap set [name _killer, (_hashMap get (name _killer)) + 1];
} else {
_hashMap set [name _killer, 1];
};
ProfileNamespace setVariable ["teamkills_per_player", _hashmap];

};
};

Expand All @@ -109,6 +137,24 @@ if (isServer) then {
[3, [(name _unit)]] remoteExec ["KPLIB_fnc_crGlobalMsg"];
stats_resistance_teamkills = stats_resistance_teamkills + 1;
[KP_liberation_cr_resistance_penalty, true] spawn F_cr_changeCR;

// check resistance griefing
if (name _killer in ResistanceKillers) then {
ResistanceKillers set [name _killer, (ResistanceKillers get (name _killer)) + 1];
} else {
ResistanceKillers set [name _killer, 1];
};
if (ResistanceKillers get name _killer >= 5) then {
[7, [(ResistanceKillers get (name _killer)), (name _killer)]] remoteExec ["KPLIB_fnc_crGlobalMsg"];
};
// save resistance kill data
private _hashMap = ProfileNamespace getVariable "resistance_kills_per_player";
if (name _killer in _hashMap) then {
_hashMap set [name _killer, (_hashMap get (name _killer)) + 1];
} else {
_hashMap set [name _killer, 1];
};
ProfileNamespace setVariable ["resistance_kills_per_player", _hashmap];
};

// Killed by a player
Expand All @@ -127,6 +173,25 @@ if (isServer) then {
if (KP_liberation_civrep_debug > 0) then {[format ["Civilian killed by: %1", name _killer], "CIVREP"] call KPLIB_fnc_log;};
[2, [(name _unit)]] remoteExec ["KPLIB_fnc_crGlobalMsg"];
[KP_liberation_cr_kill_penalty, true] spawn F_cr_changeCR;

// check civilian griefing
if ((name _killer) in CivilianKillers) then {
CivilianKillers set [name _killer, (CivilianKillers get (name _killer)) + 1];
} else {
CivilianKillers set [name _killer, 1];
};
if (CivilianKillers get name _killer >= 5) then {
[8, [(CivilianKillers get (name _killer)), (name _killer)]] remoteExec ["KPLIB_fnc_crGlobalMsg"];
};

// save civilian kill data
private _hashMap = ProfileNamespace getVariable "civilian_kills_per_player";
if (name _killer in _hashMap) then {
_hashMap set [name _killer, (_hashMap get (name _killer)) + 1];
} else {
_hashMap set [name _killer, 1];
};
ProfileNamespace setVariable ["civilian_kills_per_player", _hashmap];
};

// Killed by a player
Expand Down Expand Up @@ -174,3 +239,15 @@ if (isServer && !isplayer _unit) then {
sleep 10;
deleteVehicle _unit;
};
addMissionEventHandler ["HandleDisconnect", {
params ["_unit", "_id", "_uid", "_name"];
if (_name in CivilianKillers) then {
CivilianKillers deleteAt _name;
};
if (_name in ResistanceKillers) then {
ResistanceKillers deleteAt _name;
};
if (_name in TeamKillers) then {
TeamKillers deleteAt _name;
};
}];