Pārlūkot izejas kodu

Update legacy logging, make shields invincible

m3ales 3 gadi atpakaļ
vecāks
revīzija
8c2b36cf95

+ 6 - 0
addons/RD501_Main/functions/fired_deployable/README.md

@@ -33,6 +33,12 @@ Where to define: `CfgAmmo -> Grenade Ammo`.
 
 Default: `-1`
 
+### Ignore Damage (Invincible)
+
+Runs `allowDamage false` on the deployable when it is thrown (part of instantiation).
+
+`rd501_fired_deployable_ignoreDamage=1`
+
 ### Sounds
 
 #### Loop Sound

+ 14 - 4
addons/RD501_Main/functions/fired_deployable/fnc_fired_deployable_deployServer.sqf

@@ -1,10 +1,10 @@
 params[["_ammo", ""], ["_position", [0,0,0]], ["_direction", 0]];
 
-diag_log format["Deploying Squad Shield for %1 at %2", _ammo, _position];
+diag_log format["[RD501][Fired Deployable][Deploy Server] Deploying Squad Shield for %1 at %2", _ammo, _position];
 
 private _config = configFile >> "CfgAmmo" >> _ammo; 
 if!(isClass _config) exitWith { 
-	diag_log format["Unable to find class '%1' in CfgAmmo", _ammo]; 
+	diag_log format["[RD501][Fired Deployable][Deploy Server] Unable to find class '%1' in CfgAmmo", _ammo]; 
 }; 
 
 private _isValid = getNumber (_config >> "rd501_fired_deployable") == 1;
@@ -12,14 +12,20 @@ private _deployable = getText (_config >> "rd501_fired_deployable_object");
 private _timeToLive = getNumber (_config >> "rd501_fired_deployable_timeToLive");
 
 if(!_isValid) exitWith {
-	diag_log format["Requested throw type '%1' is does not contain rd501_fired_deployable=1", _ammo];
+	diag_log format["[RD501][Fired Deployable][Deploy Server] Requested throw type '%1' is does not contain rd501_fired_deployable=1", _ammo];
 };
 
 if(isNil "_deployable" || _deployable isEqualTo "") exitWith { 
-	diag_log format["Failed to find rd501_fired_deployable_object defined in ammo type %1", _ammo];
+	diag_log format["[RD501][Fired Deployable][Deploy Server] Failed to find rd501_fired_deployable_object defined in ammo type %1", _ammo];
 };
 
 _config = configFile >> "CfgVehicles" >> _deployable;
+
+private _setInvincible = 0;
+if(isNumber(_config >> "rd501_fired_deployable_ignoreDamage")) then {
+	_setInvincible = getNumber (_config >> "rd501_fired_deployable_ignoreDamage");
+};
+
 private _hasLoopSound = isText (_config >> "rd501_fired_deployable_loopSound");
 private _loopSound = getText (_config >> "rd501_fired_deployable_loopSound");
 private _loopDuration = getNumber (_config >> "rd501_fired_deployable_loopDuration");
@@ -32,6 +38,10 @@ private _deployed = createVehicle [_deployable, _position, [], 0, "CAN_COLLIDE"]
 _deployed setPosATL _position;
 _deployed setDir _direction;
 
+if(_setInvincible == 1) then {
+	_deployed allowDamage false;
+};
+
 if(_timeToLive > 0) then {
 	[
 		{

+ 3 - 3
addons/RD501_Main/functions/fired_deployable/fnc_fired_deployable_endSoundLocal.sqf

@@ -2,16 +2,16 @@
 params["_object", "_endSound", "_endDuration", "_distance"];
 
 if(!hasInterface) exitWith {
-	diag_log "No Interface to play sounds from";
+	diag_log "[RD501][Fired Deployable][End Sound Local] No Interface to play sounds from";
 };
 
 if(isNil "_object" || !alive _object) exitWith {
-	diag_log "No target object to play remote sound";
+	diag_log "[RD501][Fired Deployable][End Sound Local] No target object to play remote sound";
 };
 
 private _currentLoopSource = _object getVariable ["rd501_fired_deployable_loopSoundSource", objNull];
 if(!(isNil "_currentLoopSource") && !(_currentLoopSource isEqualTo objNull)) then {
-	diag_log "Current Loop Source Exists, Deleting";
+	diag_log "[RD501][Fired Deployable][End Sound Local] Current Loop Source Exists, Deleting";
 	deleteVehicle _currentLoopSource;
 	_object setVariable ["rd501_fired_deployable_loopSoundSource", objNull, false];
 };

+ 1 - 1
addons/RD501_Main/functions/fired_deployable/fnc_fired_deployable_firedHandler.sqf

@@ -1,6 +1,6 @@
 params["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
 
-if(!local _unit) exitWith { diag_log "Fired Deployable not local" };
+if(!local _unit) exitWith { diag_log "[RD501][Fired Deployable][Fired Handler] Fired Deployable not local" };
 
 if (isNull _projectile) then {
 	_projectile = nearestObject [_unit, _ammo];

+ 5 - 5
addons/RD501_Main/functions/fired_deployable/fnc_fired_deployable_loopSoundLocal.sqf

@@ -2,17 +2,17 @@
 params["_object", "_loopSound", "_loopDuration", "_totalDuration", "_distance"];
 
 if(!hasInterface) exitWith {
-	diag_log "No Interface to play sounds from";
+	diag_log "[RD501][Fired Deployable][Loop Sound Local] No Interface to play sounds from";
 };
 
 if(isNil "_object" || !alive _object) exitWith {
-	diag_log "No target object to play remote sound";
+	diag_log "[RD501][Fired Deployable][Loop Sound Local] No target object to play remote sound";
 };
 
 private _currentSource = _object getVariable ["rd501_fired_deployable_loopSoundSource", objNull];
 
 if(!(isNil "_currentSource") && !(_currentSource isEqualTo objNull)) exitWith {
-	diag_log "Source already exists, removing";
+	diag_log "[RD501][Fired Deployable][Loop Sound Local] Source already exists, removing";
 	detach _currentSource;
 	deleteVehicle _currentSource;
 	_object setVariable ["rd501_fired_deployable_loopSoundSource", objNull, false];
@@ -27,14 +27,14 @@ private _repeats = ceil (_totalDuration / _loopDuration);
 for "_i" from 0 to _repeats step 1 do {
 	private _delay = ((_loopDuration * _i) - 0.1) max 0.1; //offset by a bit to ensure loop doesn't have a hitch
 	private _last = _repeats == _i;
-	diag_log format["Queuing Up Repeat %1 for delay %2", _i, _delay];
+	diag_log format["[RD501][Fired Deployable][Loop Sound Local] Queuing Up Repeat %1 for delay %2", _i, _delay];
 	[
 		{
 			params["_currentSource", "_loopSound", "_distance", "_last"];
 			if(isNil "_currentSource" || !alive _currentSource) exitWith { diag_log "No Source, Exiting." };
 			[_currentSource, player] say3D [_loopSound, _distance, 1, false];
 			if(_last) then {
-				diag_log "Last Loop, Deleting";
+				diag_log "[RD501][Fired Deployable][Loop Sound Local] Last Loop, Deleting";
 				detach _currentSource;
 				deleteVehicle _currentSource;
 			};

+ 1 - 1
addons/RD501_Main/functions/fired_deployable/fnc_fired_deployable_personalShieldDeployServer.sqf

@@ -4,7 +4,7 @@ params["_unit", "_ammo"];
 
 private _config = configFile >> "CfgAmmo" >> _ammo; 
 if!(isClass _config) exitWith {
-	diag_log format["Unable to find class '%1' in CfgAmmo", _ammo]; 
+	diag_log format["[RD501][Fired Deployable][Personal Shield] Unable to find class '%1' in CfgAmmo", _ammo]; 
 };
 
 private _isValid = getNumber (_config >> "rd501_fired_deployable") == 1;

+ 5 - 0
addons/RD501_Vehicles/static/shields/config.cpp

@@ -66,6 +66,7 @@ class CfgVehicles
         rd501_fired_deployable_endSound = "rd501_squad_shield_end";
         rd501_fired_deployable_endDuration = 1;
         rd501_fired_deployable_soundDistance = 300;
+        rd501_fired_deployable_ignoreDamage = 1;
 		rd501_shield_isShield=1;
         hiddenSelections[] = { "camo1" };
         hiddenSelectionsTextures[] = { "\RD501_Vehicles\static\shields\bubble\shield.paa" };
@@ -100,6 +101,7 @@ class CfgVehicles
         rd501_fired_deployable_endSound = "rd501_squad_shield_end";
         rd501_fired_deployable_endDuration = 1;
         rd501_fired_deployable_soundDistance = 300;
+        rd501_fired_deployable_ignoreDamage = 1;
         rd501_shield_isShield=1;
         rd501_shield_type="CIS";
         rd501_shield_health=100000;
@@ -136,6 +138,7 @@ class CfgVehicles
         rd501_fired_deployable_endSound = "rd501_squad_shield_end";
         rd501_fired_deployable_endDuration = 1;
         rd501_fired_deployable_soundDistance = 300;
+        rd501_fired_deployable_ignoreDamage = 1;
         rd501_shield_isShield=1;
         rd501_shield_type="CIS";
         rd501_shield_health=20000;
@@ -172,6 +175,7 @@ class CfgVehicles
         rd501_fired_deployable_endSound = "rd501_squad_shield_end";
         rd501_fired_deployable_endDuration = 1;
         rd501_fired_deployable_soundDistance = 300;
+        rd501_fired_deployable_ignoreDamage = 1;
         rd501_shield_isShield=1;
         rd501_shield_type="CIS";
         rd501_shield_health=10000;
@@ -208,6 +212,7 @@ class CfgVehicles
         rd501_fired_deployable_endSound = "rd501_squad_shield_end";
         rd501_fired_deployable_endDuration = 1;
         rd501_fired_deployable_soundDistance = 300;
+        rd501_fired_deployable_ignoreDamage = 1;
         rd501_shield_isShield=1;
         rd501_shield_type="CIS";
         rd501_shield_health=1000;