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 15, 2017
1 parent eb89398 commit 77336f1
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
29 changes: 29 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf
Expand Up @@ -159,6 +159,33 @@ 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];

// The two arrays below are prefixes of buildings and their multiplier.
// They 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.
// You can modify this for any other terrain, clearing the table will also make all buildings just have a 1.0 multiplier.
// If there's a hit in btc_buildings_multiplier, btc_buildings_categories_multipliers will NOT be run
btc_buildings_multipliers = [
// Specific buildings that need to have a custom modifier.
["Land_BellTower", 0.2 ], ["Land_WIP", 1.5], ["Land_u_Addon_01", 0.2], ["Land_Airport_Tower", 10.0],
["Land_TentHangar", 7.0], ["Land_i_Shed_Ind", 1.5], ["Land_u_Shed_Ind", 1.5],
["Land_TTowerBig", 6.0], ["Land_TTowerSmall", 4.5], ["Land_cmp_Tower", 4.0]
];

// The multipliers are applied on top of each other, so "Chapel" and "Small" will both multiply the malus value
btc_buildings_categories_multipliers = [
["Shed", 0.75], ["Shop", 1.5], ["Slum", 0.8], ["Small", 0.8], ["Big", 1.5], ["Villa", 2.0], ["Main", 3.0], ["Tower", 2.0],
["HouseBlock", 2.0], ["School", 3.0], ["Office", 2.0],
["Chapel", 3.0], ["Minaret", 3.0], ["Mosque", 4.0], ["Church", 4.0], ["Kostel", 4.0],
["Lighthouse", 4.0],
["Airport", 4.0], ["Hangar", 1.75], ["ControlTower", 2.25], ["Terminal", 3.0],
["Hopper", 2.0], ["Tank", 4.0], ["Factory", 2.0], ["Transformer", 1.1],
["FuelStation", 5.0],
["Barracks", 1.75],
["spp", 3.0], ["Powerstation", 3.0],
["Pump", 2.5]
];
};

//City
Expand Down Expand Up @@ -521,6 +548,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
24 changes: 24 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/buildingchanged.sqf
@@ -0,0 +1,24 @@
params ["_from", "_to", "_isRuin"];
private _classname = typeOf _from;
private _malus = [btc_rep_malus_building_damaged, btc_rep_malus_building_destroyed] select _isRuin;
private _skipCategories = false;

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

if(!_skipCategories) then {
{
if([_x select 0, _classname] call BIS_fnc_inString) then {
_malus = _malus * (_x select 1);
};
} forEach btc_buildings_categories_multipliers;
};

if (btc_debug) 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 77336f1

Please sign in to comment.