Skip to content

Commit

Permalink
ADD: a reputation change whenever a building is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
mtusnio committed May 13, 2017
1 parent eb89398 commit f4fa8cb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
19 changes: 19 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf
Expand Up @@ -159,6 +159,23 @@ if (isServer) then {
//Vehs
btc_vehicles = [btc_veh_1,btc_veh_2,btc_veh_3,btc_veh_4,btc_veh_5,btc_veh_6,btc_veh_7,btc_veh_8,btc_veh_9,btc_veh_10,btc_veh_11,btc_veh_12,btc_veh_13,btc_veh_14,btc_veh_15];
btc_helo = [btc_helo_1];

// Prefixes of buildings and their multiplier. This will multiply the values of btc_rep_malus_building_destroyed
// and btc_rep_malus_building_damaged, if a building is not present here it will be multiplied by 1.0.
// Use 0.0 to disable reputation hit on a specific's building destruction.
// This will also be applied left-to-right, so if you differentiate between i.e. "Land_Chapel" and "Land_Chapel_Small"
// then place the more specific prefix first.
// You can modify this for any other terrain, clearing the table will also make all buildings just have a 1.0 multiplier.
btc_buildings_multipliers = [ ["Land_BellTower", 0.2 ], ["Land_Chapel_Small", 2.5], ["Land_Chapel", 3.0],
["Land_Lighthouse_small", 2.5], [ "Land_LightHouse", 4.0 ], ["Land_WIP", 1.5], ["Land_u_Addon_01", 0.2],
["Land_Metal_Shed", 0.5], ["Land_i_House_Big", 1.5], ["Land_u_House_Big", 1.5], ["Land_d_House_Big", 1.5],
["Land_i_Shop", 1.5], ["Land_u_Shop", 1.5], ["Land_d_Shop", 1.5], ["Land_Slum", 0.8],
["Land_i_Stone_HouseBig", 1.5], ["Land_d_Stone_HouseBig", 1.5], ["Land_Airport_Tower", 10.0],
["Land_Hangar", 7.0], ["Land_cmp_Hopper", 4.0], ["Land_cmp_Tower", 4.0], ["Land_dp_smallTank", 3.0],
["Land_Factory_Conv", 2.0], ["Land_Factory_Hopper", 4.0], ["Land_Factory_Main", 6.0], ["Land_FuelStation_Shed", 2.0],
["Land_ReservoirTank", 3.0], ["Land_Shed", 0.2], ["Land_i_Shed_Ind", 1.5], ["Land_u_Shed_Ind", 1.5],
["Land_spp_Tower", 7.0], ["Land_spp_Transformer", 3.0], ["Land_TTowerBig", 6.0], ["Land_TTowerSmall", 4.5],
["Land_i_Barracks", 1.75], ["Land_u_Barracks", 1.75] ];
};

//City
Expand Down Expand Up @@ -521,6 +538,8 @@ btc_rep_malus_civ_killed = - 10;
btc_rep_malus_civ_firenear = - 5;
btc_rep_malus_player_respawn = - 10;
btc_rep_malus_veh_killed = - 25;
btc_rep_malus_building_damaged = - 5;
btc_rep_malus_building_destroyed = - 10;

//Side
if (isNil "btc_side_assigned") then {btc_side_assigned = false;};
Expand Down
1 change: 1 addition & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf
Expand Up @@ -64,6 +64,7 @@ if (isServer) then {
btc_fnc_eh_veh_respawn = compile preprocessFile "core\fnc\eh\veh_respawn.sqf";
btc_fnc_eh_explosives_defuse = compile preprocessFile "core\fnc\eh\explosives_defuse.sqf";
btc_fnc_eh_handledisconnect = compile preprocessFile "core\fnc\eh\handledisconnect.sqf";
btc_fnc_eh_buildingchanged = compile preprocessFile "core\fnc\eh\buildingchanged.sqf";

//IED
btc_fnc_ied_boom = compile preprocessFile "core\fnc\ied\boom.sqf";
Expand Down
14 changes: 14 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/buildingchanged.sqf
@@ -0,0 +1,14 @@
params ["_from", "_to", "_isRuin"];
private _classname = typeOf _from;
private _malus = [btc_rep_malus_building_damaged, btc_rep_malus_building_destroyed] select _isRuin;

{
if([_x select 0, _classname] call BIS_fnc_inString) exitWith {
_malus = _malus * (_x select 1);
};
} forEach btc_buildings_multipliers;

if(btc_debug_log) then {
systemChat format [ "BuildingChanged: %1 to %2. Malus: %3",
typeOf _from, typeOf _to, _malus ];
};
2 changes: 2 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/init_server.sqf
Expand Up @@ -24,6 +24,8 @@ call btc_fnc_db_autosave;

addMissionEventHandler ["HandleDisconnect",btc_fnc_eh_handledisconnect];

addMissionEventHandler ["BuildingChanged",btc_fnc_eh_buildingchanged];

["ace_explosives_defuse", btc_fnc_eh_explosives_defuse] call CBA_fnc_addEventHandler;

["Initialize"] call BIS_fnc_dynamicGroups;
Expand Down

0 comments on commit f4fa8cb

Please sign in to comment.