Use effectiveCommander for humanity hit

This commit is contained in:
ebaydayz
2017-02-05 16:30:32 -05:00
parent 5884ef6445
commit 18191b0e3a
2 changed files with 10 additions and 9 deletions

View File

@@ -95,7 +95,7 @@ if (_unit == player) then {
//if player is not free to shoot at inform server that _source shot at player
if (!_isBandit && !(player getVariable ["OpenTarget",false])) then
{
PVDZ_send = [_source,"OpenTarget",[]];
PVDZ_send = [(effectiveCommander vehicle _source),"OpenTarget",[]];
publicVariableServer "PVDZ_send";
};
@@ -121,7 +121,7 @@ if (_unit == player) then {
};
// In the case of outrageous damage (crashes, explosions, desync repeated headshots); cap the limit on humanity lost.
[_source,_humanityHit] spawn {
[(effectiveCommander vehicle _source),_humanityHit] spawn {
private ["_source","_humanityHit"];
_source = _this select 0;
_humanityHit = _this select 1;

View File

@@ -1,4 +1,4 @@
private ["_ammo","_body","_distance","_infected","_playerID","_sourceName","_sourceWeapon","_sourceVehicleType","_isBandit","_punishment","_humanityHit","_myKills","_kills","_killsV","_display","_myGroup","_camera","_deathPos","_animState","_animStateArray","_animCheck","_source","_method"];
private ["_ammo","_body","_distance","_infected","_playerID","_sourceName","_sourceWeapon","_sourceVehicleType","_isBandit","_punishment","_humanityHit","_myKills","_kills","_killsV","_display","_myGroup","_camera","_deathPos","_animState","_animStateArray","_animCheck","_source","_method","_realSource"];
if (deathHandled) exitWith {};
deathHandled = true;
@@ -81,6 +81,7 @@ if (!local _source && isPlayer _source && !(_body isKindOf "PZombie_VB")) then {
//if you are a bandit or start first - player will not recieve humanity drop
_punishment = (_isBandit or {_body getVariable ["OpenTarget",false]});
_humanityHit = 0;
_realSource = effectiveCommander vehicle _source;
if (!_punishment) then {
//I'm "not guilty" - kill me and be punished
@@ -89,18 +90,18 @@ if (!local _source && isPlayer _source && !(_body isKindOf "PZombie_VB")) then {
// punish my killer 2000 for shooting a surivor
// but subtract 500 for each survivor I've murdered
_humanityHit = -(2000 - _myKills);
_kills = _source getVariable ["humanKills",0];
_source setVariable ["humanKills",(_kills + 1),true];
PVDZ_send = [_source,"Humanity",[_humanityHit,300]];
_kills = _realSource getVariable ["humanKills",0];
_realSource setVariable ["humanKills",(_kills + 1),true];
PVDZ_send = [_realSource,"Humanity",[_humanityHit,300]];
publicVariableServer "PVDZ_send";
} else {
//i'm "guilty" - kill me as bandit
_killsV = _source getVariable ["banditKills",0];
_source setVariable ["banditKills",(_killsV + 1),true];
_killsV = _realSource getVariable ["banditKills",0];
_realSource setVariable ["banditKills",(_killsV + 1),true];
};
//Setup for study bodys.
_body setVariable ["KillingBlow",[_source,_punishment],true];
_body setVariable ["KillingBlow",[_realSource,_punishment],true];
};
disableSerialization;