mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Allow tagging wrongly configured static objects.
This commit is contained in:
parent
b020d88963
commit
e31636539a
@ -1,6 +1,47 @@
|
||||
// by esteldunedain
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
||||
// Cache for static objects
|
||||
GVAR(cacheStaticModels) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0];
|
||||
GVAR(cacheStaticModels) setText QGVAR(cacheStaticModels);
|
||||
|
||||
// Consider static everything vehicle that inherit from Static
|
||||
// This include houses (which we don't need), but also walls, that we do
|
||||
private _cfgBase = configFile >> "CfgVehicles";
|
||||
private _countOptions = count _cfgBase;
|
||||
for "_index" from 0 to (_countOptions - 1) do {
|
||||
private _cfgClass = _cfgBase select _index;
|
||||
if (isClass _cfgClass) then {
|
||||
if ((configName _cfgClass) isKindOf "Static") then {
|
||||
private _model = getText (_cfgClass >> "model");
|
||||
if (_model != "") then {
|
||||
private _array = _model splitString "\";
|
||||
GVAR(cacheStaticModels) setVariable [toLower (_array select ((count _array) - 2)), _cfgClass];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Also consider static all object inheriting from bridges
|
||||
_cfgBase = configFile >> "CfgNonAIVehicles";
|
||||
_countOptions = count _cfgBase;
|
||||
for "_index" from 0 to (_countOptions - 1) do {
|
||||
private _cfgClass = _cfgBase select _index;
|
||||
if (isClass _cfgClass) then {
|
||||
if ((configName _cfgClass) isKindOf ["Bridge_base_F", _cfgBase]) then {
|
||||
private _model = getText (_cfgClass >> "model");
|
||||
if (_model != "") then {
|
||||
private _array = _model splitString "\";
|
||||
GVAR(cacheStaticModels) setVariable [toLower (_array select ((count _array) - 2)), _cfgClass];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
GVAR(testingThread) = false;
|
||||
GVAR(tagsToTest) = [];
|
||||
|
||||
["createTag", DFUNC(createTag)] call EFUNC(common,addEventHandler);
|
||||
|
@ -5,7 +5,7 @@ ADDON = false;
|
||||
PREP(checkTaggable);
|
||||
PREP(createTag);
|
||||
PREP(tagDirection);
|
||||
PREP(tagWall);
|
||||
PREP(tagGround);
|
||||
PREP(tagWall);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -31,7 +31,26 @@
|
||||
|
||||
// Exit if trying to tag a non static object
|
||||
TRACE_1("Obj:",_intersections);
|
||||
if (!isNull _object && {!(_object isKindOf "Static")}) exitWith {false};
|
||||
|
||||
// Exit if trying to tag a non static object
|
||||
if ((!isNull _object) && {
|
||||
// If the class is alright, do not exit
|
||||
if (_object isKindOf "Static") exitWith {false};
|
||||
|
||||
// If the class is not categorized correctly search the cache
|
||||
private _array = str(_object) splitString " ";
|
||||
private _str = toLower (_array select 1);
|
||||
TRACE_1("Object:",_str);
|
||||
private _objClass = GVAR(cacheStaticModels) getVariable _str;
|
||||
// If the class in not on the cache, exit
|
||||
if (isNil "_objClass") exitWith {
|
||||
false
|
||||
};
|
||||
true
|
||||
}) exitWith {
|
||||
TRACE_1("Pointed object is non static",_object);
|
||||
false
|
||||
};
|
||||
|
||||
true
|
||||
}, missionNamespace, QGVAR(checkTaggableCache), 0.5] call EFUNC(common,cachedCall);
|
||||
|
@ -34,11 +34,26 @@ if (_intersections isEqualTo []) exitWith {
|
||||
TRACE_3("",_touchingPoint, _surfaceNormal, _object);
|
||||
|
||||
// Exit if trying to tag a non static object
|
||||
if (!isNull _object && {!(_object isKindOf "Static")}) exitWith {
|
||||
if ((!isNull _object) && {
|
||||
// If the class is alright, do not exit
|
||||
if (_object isKindOf "Static") exitWith {false};
|
||||
|
||||
// If the class is not categorized correctly search the cache
|
||||
private _array = str(_object) splitString " ";
|
||||
private _str = toLower (_array select 1);
|
||||
TRACE_1("Object:",_str);
|
||||
private _objClass = GVAR(cacheStaticModels) getVariable _str;
|
||||
// If the class in not on the cache, exit
|
||||
if (isNil "_objClass") exitWith {
|
||||
false
|
||||
};
|
||||
true
|
||||
}) exitWith {
|
||||
TRACE_1("Pointed object is non static",_object);
|
||||
false
|
||||
};
|
||||
|
||||
|
||||
// If the surface normal points away, flip it. This happens in weird places like the Stratis Pier
|
||||
if (_surfaceNormal vectorDotProduct (_endPosASL vectorDiff _startPosASL) > 0) then {
|
||||
_surfaceNormal = _surfaceNormal vectorMultiply -1;
|
||||
@ -81,7 +96,7 @@ _unit playActionNow "PutDown";
|
||||
|
||||
[{
|
||||
params ["", "", "", "", "_unit"];
|
||||
TRACE_1("Unit:", _unit);
|
||||
TRACE_2("Unit:",_unit,_this);
|
||||
|
||||
playSound3D [QUOTE(PATHTO_R(sounds\spray.ogg)), _unit, false, (eyePos _unit), 10, 1, 15];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user