mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
SetPosition Event - Fix digging down (#1991)
This commit is contained in:
parent
fc6cd34d33
commit
b9638f749b
@ -38,7 +38,7 @@ onSetup parameters:
|
|||||||
isAttachable = 0;
|
isAttachable = 0;
|
||||||
displayName = CSTRING(PressurePlate);
|
displayName = CSTRING(PressurePlate);
|
||||||
picture = PATHTOF(Data\UI\PressurePlate.paa);
|
picture = PATHTOF(Data\UI\PressurePlate.paa);
|
||||||
onPlace = "_dist=GetNumber(ConfigFile >> 'CfgMagazines' >> (_this select 2) >> 'ACE_Triggers' >> 'PressurePlate' >> 'digDistance');_ex=_this select 1;_ex setPosATL ((getPosATL _ex) vectorDiff ((VectorUp _ex) vectorCrossProduct [0,0,_dist]));false";
|
onPlace = QUOTE(false);
|
||||||
};
|
};
|
||||||
class IRSensor {
|
class IRSensor {
|
||||||
isAttachable = 0;
|
isAttachable = 0;
|
||||||
|
@ -8,7 +8,7 @@ class CfgMagazines {
|
|||||||
class ACE_Triggers {
|
class ACE_Triggers {
|
||||||
SupportedTriggers[] = {"PressurePlate"};
|
SupportedTriggers[] = {"PressurePlate"};
|
||||||
class PressurePlate {
|
class PressurePlate {
|
||||||
digDistance = 0.1;
|
digDistance = 0.06;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -17,7 +17,7 @@ class CfgMagazines {
|
|||||||
class ACE_Triggers {
|
class ACE_Triggers {
|
||||||
SupportedTriggers[] = {"PressurePlate"};
|
SupportedTriggers[] = {"PressurePlate"};
|
||||||
class PressurePlate {
|
class PressurePlate {
|
||||||
digDistance = 0.075;
|
digDistance = 0.08;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -26,7 +26,7 @@ class CfgMagazines {
|
|||||||
class ACE_Triggers {
|
class ACE_Triggers {
|
||||||
SupportedTriggers[] = {"PressurePlate"};
|
SupportedTriggers[] = {"PressurePlate"};
|
||||||
class PressurePlate {
|
class PressurePlate {
|
||||||
digDistance = 0.05;
|
digDistance = 0.025;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
//Event for setting explosive placement angle/pitch:
|
||||||
|
[QGVAR(place), {_this call FUNC(setPosition)}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
//When getting knocked out in medical, trigger deadman explosives:
|
//When getting knocked out in medical, trigger deadman explosives:
|
||||||
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
|
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]];
|
params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]];
|
||||||
TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject);
|
TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject);
|
||||||
|
|
||||||
private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger"];
|
private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger", "_pitch", "_digDistance", "_canDigDown", "_soundEnviron", "_surfaceType"];
|
||||||
|
|
||||||
_unit playActionNow "PutDown";
|
_unit playActionNow "PutDown";
|
||||||
|
|
||||||
@ -54,6 +54,27 @@ if (isText(_magazineTrigger >> "ammo")) then {
|
|||||||
};
|
};
|
||||||
_triggerSpecificVars pushBack _triggerConfig;
|
_triggerSpecificVars pushBack _triggerConfig;
|
||||||
|
|
||||||
|
//Dig the explosive down into the ground (usually on "pressurePlate")
|
||||||
|
if (isNumber (_magazineTrigger >> "digDistance")) then {
|
||||||
|
_digDistance = getNumber (_magazineTrigger >> "digDistance");
|
||||||
|
|
||||||
|
//Get Surface Type:
|
||||||
|
_canDigDown = true;
|
||||||
|
_surfaceType = surfaceType _pos;
|
||||||
|
if ((_surfaceType select [0,1]) == "#") then {_surfaceType = _surfaceType select [1, 99];};
|
||||||
|
if ((_surfaceType != "") || {isClass (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then {
|
||||||
|
_soundEnviron = (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron");
|
||||||
|
_canDigDown = !(_soundEnviron in ["road", "tarmac", "concrete", "concrete_int", "int_concrete", "concrete_ext"]);
|
||||||
|
};
|
||||||
|
//Don't dig down if pos ATL is high (in a building or A2 road)
|
||||||
|
if (_canDigDown && {(_pos select 2) > 0.1}) then {
|
||||||
|
TRACE_2("Can Dig Down",_digDistance,_pos);
|
||||||
|
_pos = _pos vectorAdd [0,0, (-1 * _digDistance)];
|
||||||
|
} else {
|
||||||
|
TRACE_2("Can NOT Dig Down",_digDistance,_pos);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_explosive = createVehicle [_ammo, _pos, [], 0, "NONE"];
|
_explosive = createVehicle [_ammo, _pos, [], 0, "NONE"];
|
||||||
_explosive setPosATL _pos;
|
_explosive setPosATL _pos;
|
||||||
|
|
||||||
@ -62,10 +83,17 @@ if (!isNull _attachedTo) then {
|
|||||||
_explosive attachTo [_attachedTo];
|
_explosive attachTo [_attachedTo];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars]
|
//If trigger has "onPlace" and it returns true, just exitWith the explosive
|
||||||
call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive};
|
if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {
|
||||||
|
TRACE_1("onPlace returns true",_explosive);
|
||||||
|
_explosive
|
||||||
|
};
|
||||||
|
|
||||||
|
//TODO: placing explosives on hills looks funny
|
||||||
|
|
||||||
[[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc);
|
_pitch = getNumber (_magazineTrigger >> "pitch");
|
||||||
|
|
||||||
|
//Globaly set the position angle:
|
||||||
|
[QGVAR(place), [_explosive, _dir, _pitch]] call EFUNC(common,globalEvent);
|
||||||
|
|
||||||
_explosive
|
_explosive
|
||||||
|
@ -25,6 +25,8 @@ private ["_config"];
|
|||||||
_config = ConfigFile >> "ACE_Triggers" >> _trigger;
|
_config = ConfigFile >> "ACE_Triggers" >> _trigger;
|
||||||
|
|
||||||
// If the onSetup function returns true, it is handled elsewhere
|
// If the onSetup function returns true, it is handled elsewhere
|
||||||
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {};
|
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {
|
||||||
|
TRACE_2("onSetup returned true",_explosive,_trigger);
|
||||||
|
};
|
||||||
|
|
||||||
[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call FUNC(placeExplosive);
|
[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call FUNC(placeExplosive);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* Example:
|
* Example:
|
||||||
* [_explosive, 150, 90] call ACE_Explosives_fnc_setPosition;
|
* [_explosive, 150, 90] call ACE_Explosives_fnc_setPosition;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
@ -26,7 +26,6 @@ if (isNull (attachedTo _explosive)) then {
|
|||||||
[_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank);
|
[_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
//Attaching to a vehicle (dirAndUp based on vehicle)
|
||||||
_explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]];
|
_explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#define ENABLE_PERFORMANCE_COUNTERS
|
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define PLACE_RANGE_MAX 1
|
#define PLACE_RANGE_MAX 1
|
||||||
|
@ -15,4 +15,4 @@
|
|||||||
|
|
||||||
#define PLACE_WAITING -1
|
#define PLACE_WAITING -1
|
||||||
#define PLACE_CANCEL 0
|
#define PLACE_CANCEL 0
|
||||||
#define PLACE_APPROVE 1
|
#define PLACE_APPROVE 1
|
||||||
|
Loading…
Reference in New Issue
Block a user