diff --git a/addons/tagging/XEH_preInit.sqf b/addons/tagging/XEH_preInit.sqf index 8fbd171147..5307ba892d 100644 --- a/addons/tagging/XEH_preInit.sqf +++ b/addons/tagging/XEH_preInit.sqf @@ -4,5 +4,6 @@ ADDON = false; PREP(checkTaggable); PREP(tagWall); +PREP(tagGround); ADDON = true; diff --git a/addons/tagging/functions/fnc_tagGround.sqf b/addons/tagging/functions/fnc_tagGround.sqf new file mode 100644 index 0000000000..28a3225c3b --- /dev/null +++ b/addons/tagging/functions/fnc_tagGround.sqf @@ -0,0 +1,44 @@ +/* + * Author: BaerMitUmlaut + * Creates a tag on a wall that is within 2m on front of the player. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_tagging_fnc_tagGround + * + * Public: No + */ + + +#include "script_component.hpp" +private ["_tagPos", "_groundPos", "_vectorDirAndUp"]; + +_tagPos = player modelToWorld [0, 1.2, 0]; +_vectorDirAndUp = []; + +_groundPos = getPosATL ACE_player; +_groundPos set [2, 0]; + +//Check if we're in or on top of some object +if (lineIntersects [getPosASL ACE_player, ATLToASL _groundPos, ACE_player, objNull]) then { + _tagPos set [2, (getPosATL ACE_player) select 2]; + _vectorDirAndUp = [[0,0,-1], vectorDir ACE_player]; +} else { + _tagPos set [2, 0]; + _vectorDirAndUp = [(surfaceNormal _tagPos) vectorMultiply -1, vectorDir ACE_player]; +}; + +ACE_player playActionNow "PutDown"; + +[{ + private ["_tag"]; + playSound3D [QUOTE(PATHTO_R(sounds\spray.ogg)), ACE_player, false, (getPosASL ACE_player), 10, 1, 15]; + _tag = ("ACE_tagWall" + str (floor (random 5))) createVehicle [0,0,0]; + _tag setPosATL (_this select 0); + _tag setVectorDirAndUp (_this select 1); +}, [_tagPos, _vectorDirAndUp], 0.6] call EFUNC(common,waitAndExecute); \ No newline at end of file diff --git a/addons/tagging/functions/fnc_tagWall.sqf b/addons/tagging/functions/fnc_tagWall.sqf index 9bdeeb8628..0d19330c88 100644 --- a/addons/tagging/functions/fnc_tagWall.sqf +++ b/addons/tagging/functions/fnc_tagWall.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" -private ["_eyepos", "_touchingPoints", "_pointCloser", "_pointFurther", "_posCheckCloser", "_posCheckFurther", "_touchingPoint", "_tag"]; +private ["_eyepos", "_touchingPoints", "_pointCloser", "_pointFurther", "_posCheckCloser", "_posCheckFurther", "_touchingPoint"]; //Cache eyepos in case player moves _eyepos = eyePos ACE_player; @@ -57,8 +57,11 @@ _touchingPoints = []; } foreach [-0.5, 0.5]; ACE_player playActionNow "PutDown"; -playSound3D [QUOTE(PATHTO_R(sounds\spray.ogg)), ACE_player, false, (getPosASL ACE_player), 10, 1, 15]; -_tag = ("ACE_tagWall" + str (floor (random 5))) createVehicle [0,0,0]; -_tag setPosASL (((_touchingPoints select 0) vectorAdd (_touchingPoints select 1)) vectorMultiply 0.5); -_tag setDir ((_touchingPoints call BIS_fnc_dirTo) - 90); \ No newline at end of file +[{ + private ["_tag"]; + playSound3D [QUOTE(PATHTO_R(sounds\spray.ogg)), ACE_player, false, (getPosASL ACE_player), 10, 1, 15]; + _tag = ("ACE_tagWall" + str (floor (random 5))) createVehicle [0,0,0]; + _tag setPosASL (((_this select 0) vectorAdd (_this select 1)) vectorMultiply 0.5); + _tag setDir ((_this call BIS_fnc_dirTo) - 90); +}, _touchingPoints, 0.6] call EFUNC(common,waitAndExecute); \ No newline at end of file diff --git a/addons/tagging/sounds/spray.ogg b/addons/tagging/sounds/spray.ogg index d73fb4417d..127dc9db75 100644 Binary files a/addons/tagging/sounds/spray.ogg and b/addons/tagging/sounds/spray.ogg differ