Skip to content

Commit

Permalink
Merge pull request #1311 from Vdauphin/Add-respawn_losth_death
Browse files Browse the repository at this point in the history
Add: Parameter to change tickets lost per death
  • Loading branch information
Vdauphin authored Apr 4, 2022
2 parents 1919c0d + 1c51819 commit ad6b64c
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 20 deletions.
1 change: 1 addition & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ btc_p_respawn_fromFOBToBase = ("btc_p_respawn_fromFOBToBase" call BIS_fnc_getPar
btc_p_rallypointTimer = "btc_p_rallypointTimer" call BIS_fnc_getParamValue;
btc_p_respawn_arsenal = ("btc_p_respawn_arsenal" call BIS_fnc_getParamValue) isEqualTo 1;
btc_p_respawn_ticketsAtStart = "btc_p_respawn_ticketsAtStart" call BIS_fnc_getParamValue;
btc_p_respawn_ticketsLost = 1 - ("btc_p_respawn_ticketsLost" call BIS_fnc_getParamValue);
btc_p_respawn_ticketsShare = ("btc_p_respawn_ticketsShare" call BIS_fnc_getParamValue) isEqualTo 0;
btc_p_body_timeBeforeShowMarker = ("btc_p_body_timeBeforeShowMarker" call BIS_fnc_getParamValue) * 60;

Expand Down
6 changes: 6 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ class Params {
texts[]={$STR_DISABLED,"0","1","2","3","4","5","10","15","20","25","30","50","70","100","150","200"};
default = 20;
};
class btc_p_respawn_ticketsLost { // Number of tickets lost per death:
title = __EVAL(format [" %1", localize "STR_BTC_HAM_RESP_TICKETSLOST"]);
values[]={1,2,3,4,5,6,7,8,9,10};
texts[]={"1","2","3","4","5","6","7","8","9","10"};
default = 1;
};
class btc_p_respawn_ticketsShare { // Tickets are share between:
title = __EVAL(format [" %1", localize "STR_BTC_HAM_RESP_TICKETSHARE"]);
values[]={0,1};
Expand Down
3 changes: 0 additions & 3 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ private _id = ["ace_tagCreated", {
//Player respawn tickets
if (btc_p_respawn_ticketsAtStart >= 0) then {
btc_respawn_tickets = +(profileNamespace getVariable [format ["btc_hm_%1_respawnTickets", _name], btc_respawn_tickets]);
if (btc_p_respawn_ticketsShare) then {
btc_p_respawn_ticketsAtStart = btc_respawn_tickets getOrDefault [str btc_player_side, btc_p_respawn_ticketsAtStart];
};

private _deadBodyPlayers = +(profileNamespace getVariable [format ["btc_hm_%1_deadBodyPlayers", _name], []]);
private _group = createGroup btc_player_side;
Expand Down
3 changes: 0 additions & 3 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/save.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ profileNamespace setVariable [format ["btc_hm_%1_tags", _name], +_tags_propertie

//Player respawn tickets
if (btc_p_respawn_ticketsAtStart >= 0) then {
if (btc_p_respawn_ticketsShare) then {
btc_respawn_tickets set [str btc_player_side, [btc_player_side] call BIS_fnc_respawnTickets];
};
profileNamespace setVariable [format ["btc_hm_%1_respawnTickets", _name], +btc_respawn_tickets];

private _deadBodyPlayers = (btc_body_deadPlayers - [objNull]) apply {[
Expand Down
13 changes: 13 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/player.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ params [
if (_unit isNotEqualTo player) exitWith {};
if (ace_map_mapIllumination) then {ace_map_mapIllumination = false;};
if (isObjectHidden player) exitWith {};
if !(isServer) then { // Don't add twice the event in player host
["btc_respawn_player", [_unit, player]] call CBA_fnc_localEvent;
};
["btc_respawn_player", [_unit, player]] call CBA_fnc_serverEvent;
}] call CBA_fnc_addEventHandler;
{
Expand Down Expand Up @@ -117,6 +120,16 @@ inGameUISetEventHandler ["Action", '["btc_inGameUISetEventHandler", _this] call
(findDisplay 46) displayAddEventHandler ["MouseButtonDown", btc_int_fnc_horn];
}] call CBA_fnc_waitUntilAndExecute;

if (btc_p_respawn_ticketsAtStart >= 0) then {
["btc_respawn_player", {
[
[player, btc_player_side] select btc_p_respawn_ticketsShare,
btc_p_respawn_ticketsLost
] call BIS_fnc_respawnTickets; // Need to be handle locally
_this remoteExecCall ["btc_respawn_fnc_player", 2];
}] call CBA_fnc_addEventHandler;
};

["ace_marker_flags_placed", {
params ["_unit", "_flag"];
_flag remoteExecCall ["btc_log_fnc_init", 2];
Expand Down
5 changes: 1 addition & 4 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/server.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ addMissionEventHandler ["BuildingChanged", btc_rep_fnc_buildingchanged];
}, false] call CBA_fnc_addClassEventHandler;
} forEach btc_civ_type_veh;
["ace_killed", btc_mil_fnc_unit_killed] call CBA_fnc_addEventHandler;
["ace_repair_setWheelHitPointDamage", {
_this remoteExecCall ["btc_rep_fnc_wheelChange", 2];
}] call CBA_fnc_addEventHandler;
["ace_repair_setWheelHitPointDamage", btc_rep_fnc_wheelChange] call CBA_fnc_addEventHandler;
["ace_disarming_dropItems", btc_rep_fnc_foodRemoved] call CBA_fnc_addEventHandler;
["btc_respawn_player", {
params ["", "_player"];
Expand Down Expand Up @@ -107,7 +105,6 @@ if (btc_p_set_skill) then {
["ace_tagCreated", btc_tag_fnc_eh] call CBA_fnc_addEventHandler;

if (btc_p_respawn_ticketsAtStart >= 0) then {
["btc_respawn_player", btc_respawn_fnc_player] call CBA_fnc_addEventHandler;
["ace_placedInBodyBag", btc_body_fnc_setBodyBag] call CBA_fnc_addEventHandler;

if !(btc_p_respawn_ticketsShare) then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ params [
["_uid", "", [""]]
];

if !(_player isEqualTo objNull) then {
if (_player isNotEqualTo objNull) then {
private _ticketValue = [_player, _ticket] call BIS_fnc_respawnTickets;
[24, _ticketValue] remoteExecCall ["btc_fnc_show_hint", _player];
};
Expand Down
7 changes: 5 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/respawn/player.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ params ["_unit", "_player"];
_unit setVariable ["btc_dont_delete", true];
btc_body_deadPlayers pushBack _unit;
_unit setVariable ["btc_UID", getPlayerUID _player];
if !(btc_p_respawn_ticketsShare) then {
btc_respawn_tickets set [getPlayerUID _player, ([_player] call BIS_fnc_respawnTickets) - 1];

if (btc_p_respawn_ticketsShare) then {
btc_respawn_tickets set [str btc_player_side, [btc_player_side] call BIS_fnc_respawnTickets];
} else {
btc_respawn_tickets set [getPlayerUID _player, [_player] call BIS_fnc_respawnTickets];
};

if (btc_p_body_timeBeforeShowMarker isEqualTo -1) exitwith {};
Expand Down
15 changes: 8 additions & 7 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/init_server.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ if (btc_p_side_mission_cycle > 0) then {
["btc_tag_remover" + _x, "STR_BTC_HAM_ACTION_REMOVETAG", _x, ["#(rgb,8,8,3)color(0,0,0,0)"], "\a3\Modules_F_Curator\Data\portraitSmoke_ca.paa"] call ace_tagging_fnc_addCustomTag;
} forEach ["ACE_SpraypaintRed"];

if (btc_p_respawn_ticketsAtStart >= 0) then {
if (btc_p_respawn_ticketsShare) then {
private _tickets = btc_p_respawn_ticketsAtStart;
if (btc_p_respawn_ticketsAtStart isEqualTo 0) then {
_tickets = -1;
};
[btc_player_side, _tickets] call BIS_fnc_respawnTickets;
if (
btc_p_respawn_ticketsShare &&
{btc_p_respawn_ticketsAtStart >= 0}
) then {
private _tickets = btc_respawn_tickets getOrDefault [str btc_player_side, btc_p_respawn_ticketsAtStart];;
if (_tickets isEqualTo 0) then {
_tickets = -1;
};
[btc_player_side, _tickets] call BIS_fnc_respawnTickets;
};
3 changes: 3 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@
<Chinesesimp>任务开始时的重生票数:</Chinesesimp>
<Czech>Počet životu na začátku mise:</Czech>
</Key>
<Key ID="STR_BTC_HAM_RESP_TICKETSLOST">
<Original>Number of tickets lost per death:</Original>
</Key>
<Key ID="STR_BTC_HAM_RESP_TICKETSHARE">
<Original>Tickets are share between:</Original>
<German>Tickets werden aufgeteilt zwischen?</German>
Expand Down

0 comments on commit ad6b64c

Please sign in to comment.