mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added function headers, removed debug stuff
This commit is contained in:
parent
22dfeef850
commit
22a4e213ac
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Checks if there is a wall within 2m in front of the player.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Is wall taggable <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_tagging_fnc_checkTaggable
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
|
||||
#include "script_component.hpp"
|
||||
private ["_posCheck", "_objectsLeft", "_intersectsLeft", "_objectsRight", "_intersectsRight"];
|
||||
|
||||
@ -8,7 +25,7 @@ _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};
|
||||
if (_x isKindOf "Static") exitWith {_intersectsLeft = true};
|
||||
} foreach _objectsLeft;
|
||||
|
||||
if (!_intersectsLeft) exitWith {false};
|
||||
@ -20,7 +37,7 @@ _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};
|
||||
if (_x isKindOf "Static") exitWith {_intersectsRight = true};
|
||||
} foreach _objectsRight;
|
||||
|
||||
|
||||
|
@ -1,11 +1,25 @@
|
||||
/*
|
||||
* 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_tagWall
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
|
||||
#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.
|
||||
@ -24,10 +38,6 @@ _touchingPoints = [];
|
||||
_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);
|
||||
@ -37,7 +47,7 @@ _touchingPoints = [];
|
||||
};
|
||||
};
|
||||
|
||||
//We do this 7 times each a bit to the left and right of the player - that's by definitely precise enough.
|
||||
//We do this 7 times each a bit to the left and right of the player - that's definitely precise enough.
|
||||
_touchingPoint = ACE_player modelToWorldVisual [_x, _pointCloser, 0];
|
||||
_touchingPoint set [2, (eyePos ACE_player) select 2];
|
||||
_touchingPoints pushBack (_touchingPoint);
|
||||
@ -46,7 +56,4 @@ _touchingPoints = [];
|
||||
|
||||
_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;
|
||||
_tag setDir ((_touchingPoints call BIS_fnc_dirTo) - 90);
|
Loading…
Reference in New Issue
Block a user