summaryrefslogtreecommitdiffstats
path: root/Server/Functions/Server_BuildingDamaged.sqf
blob: 034a8efe9501f1567ec3ce6e006b7a130045b9b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Private["_currentDammages","_damage","_damagedBy","_side","_structure","_timeAttacked"];

_structure = _this Select 0;
_damagedBy = _this Select 1;
_damage = _this Select 2;
_currentDammages = getDammage _structure;

_side = east;
if ((typeOf _structure) in ('WFBE_WESTSTRUCTURENAMES' Call GetNamespace)) then {_side = west};

_timeAttacked = Format["WFBE_%1_TimeUnderAttack",str _side] Call GetNamespace;

if (_side != Side _damagedBy) then {
	if (time - _timeAttacked > 30 && _damage > 0.05 && ((_currentDammages + _damage) < 1)) then {
		[Format["WFBE_%1_TimeUnderAttack",str _side],time,true] Call SetNamespace;
		["IsUnderAttack",TypeOf _structure ,_side] Spawn SideMessage;
	};
};