Update compiles - 2 more files to do

fn_selfActions.sqf
player_updateGui.sqf
This commit is contained in:
icomrade
2016-02-29 00:26:12 -05:00
parent a83909b918
commit b96cd2d971
67 changed files with 3886 additions and 1212 deletions

View File

@@ -1,36 +1,79 @@
private ["_unit1","_building","_relPos","_boundingBox","_min","_max","_myX","_myY","_myZ","_inside"];
_unit1 = _this select 0;
//_building = _this select 1;
_building = nearestObject [player, "HouseBase"];
//_type = typeOf _building;
_relPos = _building worldToModel (getPosATL _unit1);
_boundingBox = boundingBox _building;
//diag_log ("DEBUG: Building: " + str(_building) );
//diag_log ("DEBUG: Building Type: " + str(_type) );
//diag_log ("DEBUG: BoundingBox: " + str(_boundingBox) );
/*
Created exclusively for ArmA2:OA - DayZMod.
Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com)
*/
_min = _boundingBox select 0;
_max = _boundingBox select 1;
// check if arg#0 is inside or on the roof of a building
// second argument is optional:
// - arg#1 is an object: check whether arg#0 is inside (bounding box of) arg#1
// - missing arg#1: check whether arg#0 is inside (bounding box of) the nearest enterable building
// - arg#1 is a boolean: check also whether arg#0 is inside (bounding box of) some non-enterable buildings around. Can be used to check if a player or an installed item is on a building roof.
// - arg#0 is posATL, arg#1 should be a building
//diag_log ("Min: " + str(_min) );
//diag_log ("Max: " + str(_max) );
_myX = _relPos select 0;
_myY = _relPos select 1;
_myZ = _relPos select 2;
private ["_unit","_inside","_building","_size"];
//diag_log ("X: " + str(_myX) );
//diag_log ("Y: " + str(_myY) );
//diag_log ("Z: " + str(_myZ) );
_check = {
private ["_inside"];
if ((_myX > (_min select 0)) && (_myX < (_max select 0))) then {
if ((_myY > (_min select 1)) && (_myY < (_max select 1))) then {
if ((_myZ > (_min select 2)) && (_myZ < (_max select 2))) then {
_inside = true;
} else { _inside = false; };
} else { _inside = false; };
} else { _inside = false; };
_building = _this select 0;
_point = _this select 1;
_inside = false;
_offset = 1; // shrink building boundingbox by this length.
_relPos = _building worldToModel _point;
_boundingBox = boundingBox _building;
_min = _boundingBox select 0;
_max = _boundingBox select 1;
_myX = _relPos select 0;
_myY = _relPos select 1;
_myZ = _relPos select 2;
if ((_myX > (_min select 0)+_offset) and {(_myX < (_max select 0)-_offset)}) then {
if ((_myY > (_min select 1)+_offset) and {(_myY < (_max select 1)-_offset)}) then {
if ((_myZ > (_min select 2)) and {(_myZ < (_max select 2))}) then {
_inside = true;
};
};
};
//diag_log(format["fnc_isInsideBuilding: building:%1 typeOf:%2 bbox:%3 relpos:%4 result:%5", _building, typeOf(_building), _boundingBox, _relPos, _inside ]);
_inside
};
_size = 0;
_unit = _this select 0;
if (typeName _unit == "OBJECT") then {
_size = sizeOf typeOf _unit;
_unit = getPosATL _unit;
};
_inside = false;
if (count _this > 1 AND {(typeName (_this select 1) == "OBJECT")}) then {
// optional argument #1 can be the building used for the check
_building = _this select 1;
_inside = [_building, _unit] call _check;
}
else {
// else perform check with nearest enterable building (contains a path LOD)
if (typeName _unit == "OBJECT") then {
_building = nearestBuilding _unit;
_inside = [_building,getPosATL _unit] call _check;
};
if ((!_inside) AND {(count _this > 1)}) then { // if optional argument is a boolean
{
_building = _x;
_type = typeOf _x;
if ((((!(_type IN DayZ_SafeObjects)) // not installable objects
AND {(!(_type isKindOf "ReammoBox"))}) // not lootpiles (weaponholders and ammoboxes)
AND {((_size + (sizeOf _type)) > _unit distance _x)}) // objects might colliding
AND {([_x, _unit] call _check)}) exitWith { // perform the check. exitWith works only in non-nested "if"
_inside = true;
};
} forEach(nearestObjects [_unit, ["Building"], 50]);
};
};
//diag_log ("fnc_isInsideBuilding Check: " + str(_inside)+ " last building:"+str(_building));
//diag_log ("isinBuilding Check: " + str(_inside) );
_inside