mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Tagging initial commit
This commit is contained in:
parent
1041d68b06
commit
22dfeef850
1
addons/tagging/$PBOPREFIX$
Normal file
1
addons/tagging/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\tagging
|
6
addons/tagging/CfgEventHandlers.hpp
Normal file
6
addons/tagging/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
18
addons/tagging/CfgVehicles.hpp
Normal file
18
addons/tagging/CfgVehicles.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
class CfgVehicles {
|
||||
class UserTexture1m_F;
|
||||
class ACE_tagWall0 : UserTexture1m_F {
|
||||
hiddenSelectionsTextures[] = {"\z\ace\addons\tagging\UI\tag0.paa"};
|
||||
};
|
||||
class ACE_tagWall1 : UserTexture1m_F {
|
||||
hiddenSelectionsTextures[] = {"\z\ace\addons\tagging\UI\tag1.paa"};
|
||||
};
|
||||
class ACE_tagWall2 : UserTexture1m_F {
|
||||
hiddenSelectionsTextures[] = {"\z\ace\addons\tagging\UI\tag2.paa"};
|
||||
};
|
||||
class ACE_tagWall3 : UserTexture1m_F {
|
||||
hiddenSelectionsTextures[] = {"\z\ace\addons\tagging\UI\tag3.paa"};
|
||||
};
|
||||
class ACE_tagWall4 : UserTexture1m_F {
|
||||
hiddenSelectionsTextures[] = {"\z\ace\addons\tagging\UI\tag4.paa"};
|
||||
};
|
||||
};
|
BIN
addons/tagging/UI/tag0.paa
Normal file
BIN
addons/tagging/UI/tag0.paa
Normal file
Binary file not shown.
BIN
addons/tagging/UI/tag1.paa
Normal file
BIN
addons/tagging/UI/tag1.paa
Normal file
Binary file not shown.
BIN
addons/tagging/UI/tag2.paa
Normal file
BIN
addons/tagging/UI/tag2.paa
Normal file
Binary file not shown.
BIN
addons/tagging/UI/tag3.paa
Normal file
BIN
addons/tagging/UI/tag3.paa
Normal file
Binary file not shown.
BIN
addons/tagging/UI/tag4.paa
Normal file
BIN
addons/tagging/UI/tag4.paa
Normal file
Binary file not shown.
8
addons/tagging/XEH_preInit.sqf
Normal file
8
addons/tagging/XEH_preInit.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(checkTaggable);
|
||||
PREP(tagWall);
|
||||
|
||||
ADDON = true;
|
16
addons/tagging/config.cpp
Normal file
16
addons/tagging/config.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_interaction"};
|
||||
author[] = {"BlauBär"};
|
||||
authorUrl = "https://github.com/BaerMitUmlaut";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
28
addons/tagging/functions/fnc_checkTaggable.sqf
Normal file
28
addons/tagging/functions/fnc_checkTaggable.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
#include "script_component.hpp"
|
||||
private ["_posCheck", "_objectsLeft", "_intersectsLeft", "_objectsRight", "_intersectsRight"];
|
||||
|
||||
|
||||
_posCheck = ACE_player modelToWorldVisual [-0.5, 2, 0];
|
||||
_posCheck set [2, (eyePos ACE_player) select 2];
|
||||
|
||||
_objectsLeft = lineIntersectsWith [eyePos ACE_player, _posCheck, ACE_player, objNull, false];
|
||||
_intersectsLeft = false;
|
||||
{
|
||||
if (_x isKindOf "HouseBase") exitWith {_intersectsLeft = true};
|
||||
} foreach _objectsLeft;
|
||||
|
||||
if (!_intersectsLeft) exitWith {false};
|
||||
|
||||
|
||||
_posCheck = ACE_player modelToWorldVisual [0.5, 2, 0];
|
||||
_posCheck set [2, (eyePos ACE_player) select 2];
|
||||
|
||||
_objectsRight = lineIntersectsWith [eyePos ACE_player, _posCheck, ACE_player, objNull, false];
|
||||
_intersectsRight = false;
|
||||
{
|
||||
if (_x isKindOf "HouseBase") exitWith {_intersectsRight = true};
|
||||
} foreach _objectsRight;
|
||||
|
||||
|
||||
//for readability...
|
||||
(_intersectsLeft && _intersectsRight)
|
52
addons/tagging/functions/fnc_tagWall.sqf
Normal file
52
addons/tagging/functions/fnc_tagWall.sqf
Normal file
@ -0,0 +1,52 @@
|
||||
#include "script_component.hpp"
|
||||
private ["_touchingPoints", "_pointCloser", "_pointFurther", "_posCheckCloser", "_posCheckFurther", "_touchingPoint", "_tag"];
|
||||
|
||||
_touchingPoints = [];
|
||||
|
||||
// _sphere1 = "Sign_Sphere10cm_F" createVehicle [0,0,0];
|
||||
// _sphere2 = "Sign_Sphere10cm_F" createVehicle [0,0,0];
|
||||
|
||||
{
|
||||
//When tagWall is called, we already know there is an object within 2m in front of us.
|
||||
//We define two points (or rather distances from the player) where the wall is always in between.
|
||||
|
||||
_pointCloser = 0;
|
||||
_pointFurther = 2;
|
||||
|
||||
for "_i" from 0 to 6 do {
|
||||
|
||||
//We need to reduce the distance between those points until we get a very precise position.
|
||||
//This is done by checking if it is between the closer point and the point in between the two.
|
||||
|
||||
_posCheckCloser = ACE_player modelToWorldVisual [_x, _pointCloser, 0];
|
||||
_posCheckCloser set [2, (eyePos ACE_player) select 2];
|
||||
|
||||
_posCheckFurther = ACE_player modelToWorldVisual [_x, (_pointCloser + ((_pointFurther - _pointCloser) / 2)), 0];
|
||||
_posCheckFurther set [2, (eyePos ACE_player) select 2];
|
||||
|
||||
// _sphere1 setPosASL (_posCheckCloser);
|
||||
// _sphere2 setPosASL (_posCheckFurther);
|
||||
// sleep 0.5;
|
||||
|
||||
if (lineIntersects [_posCheckCloser, _posCheckFurther, ACE_player, objNull]) then {
|
||||
//If it is, we move the further point to be closer to the closer point.
|
||||
_pointFurther = _pointCloser + ((_pointFurther - _pointCloser) / 2);
|
||||
} else {
|
||||
//If it isn't, we move the closer point towards the further point.
|
||||
_pointCloser = _pointCloser + ((_pointFurther - _pointCloser) / 2);
|
||||
};
|
||||
};
|
||||
|
||||
//We do this 7 times each a bit to the left and right of the player - that's by definitely precise enough.
|
||||
_touchingPoint = ACE_player modelToWorldVisual [_x, _pointCloser, 0];
|
||||
_touchingPoint set [2, (eyePos ACE_player) select 2];
|
||||
_touchingPoints pushBack (_touchingPoint);
|
||||
|
||||
} foreach [-0.5, 0.5];
|
||||
|
||||
_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);
|
||||
|
||||
// deleteVehicle _sphere1;
|
||||
// deleteVehicle _sphere2;
|
1
addons/tagging/functions/script_component.hpp
Normal file
1
addons/tagging/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\tagging\script_component.hpp"
|
12
addons/tagging/script_component.hpp
Normal file
12
addons/tagging/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT tagging
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_BLANK
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_BLANK
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
Loading…
Reference in New Issue
Block a user