mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Better positioning for loaded Buildings Storages
Thx to @Sneer for his help with it
This commit is contained in:
parent
d12d58e4bf
commit
4ea25cc909
@ -22,7 +22,7 @@ if !(isNull _this) then {
|
|||||||
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
|
||||||
_this setDamage 0;
|
_this setDamage 0;
|
||||||
_class = typeOf _this;
|
_class = typeOf _this;
|
||||||
_worldspace = [(getposATL _this call EPOCH_precisionPos), vectordir _this, vectorup _this];
|
_worldspace = [getposworld _this, vectordir _this, vectorup _this, true];
|
||||||
_objHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _objSlot];
|
_objHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _objSlot];
|
||||||
_animPhases = [];
|
_animPhases = [];
|
||||||
{
|
{
|
||||||
|
@ -75,12 +75,8 @@ for "_i" from 0 to _this do {
|
|||||||
// experiment with damage factor based on time only for now.
|
// experiment with damage factor based on time only for now.
|
||||||
_damage = ((1 - (_ttl / _maxTTL)) min 1) max 0;
|
_damage = ((1 - (_ttl / _maxTTL)) min 1) max 0;
|
||||||
|
|
||||||
_location = _worldspace deleteAt 0;
|
_worldspace params ["_pos","_vectordir","_vectorup",["_useworld",false]];
|
||||||
|
_vectordirup = [_vectordir,_vectorup];
|
||||||
// increased position precision
|
|
||||||
if (count _location == 2) then{
|
|
||||||
_location = (_location select 0) vectorAdd (_location select 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
// remove old safes on && !(_class isKindOf 'Constructions_lockedstatic_F')
|
// remove old safes on && !(_class isKindOf 'Constructions_lockedstatic_F')
|
||||||
if (isClass (configFile >> "CfgVehicles" >> _class) && (_damage < 1) && !(_class isKindOf 'Constructions_lockedstatic_F')) then {
|
if (isClass (configFile >> "CfgVehicles" >> _class) && (_damage < 1) && !(_class isKindOf 'Constructions_lockedstatic_F')) then {
|
||||||
@ -115,8 +111,13 @@ for "_i" from 0 to _this do {
|
|||||||
} foreach _DeSimulateObjects;
|
} foreach _DeSimulateObjects;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
_baseObj setposATL _location;
|
if (_useworld) then {
|
||||||
_baseObj setVectorDirAndUp _worldspace;
|
_baseObj setposworld _pos;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_baseObj setposATL _pos;
|
||||||
|
};
|
||||||
|
_baseObj setVectorDirAndUp _vectordirup;
|
||||||
|
|
||||||
if (_Simulated && _baseDynamicSimulationSystem) then { // Only needed, if simulation is not disabled
|
if (_Simulated && _baseDynamicSimulationSystem) then { // Only needed, if simulation is not disabled
|
||||||
// new Dynamicsimulation
|
// new Dynamicsimulation
|
||||||
@ -130,8 +131,13 @@ for "_i" from 0 to _this do {
|
|||||||
if(isText _ammoClass) then {
|
if(isText _ammoClass) then {
|
||||||
_ammoClass = getText _ammoClass;
|
_ammoClass = getText _ammoClass;
|
||||||
_ammoObj = createVehicle [_ammoClass, [0,0,0], [], 0, "CAN_COLLIDE"];
|
_ammoObj = createVehicle [_ammoClass, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||||
_ammoObj setVectorDirAndUp _worldspace;
|
if (_useworld) then {
|
||||||
_ammoObj setposATL _location;
|
_ammoObj setposworld _pos;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_ammoObj setposATL _location;
|
||||||
|
};
|
||||||
|
_ammoObj setVectorDirAndUp _vectordirup;
|
||||||
_baseObj setVariable ["EPOCH_TRAP_OBJ",_ammoObj];
|
_baseObj setVariable ["EPOCH_TRAP_OBJ",_ammoObj];
|
||||||
_baseObj addEventHandler ["Explosion", {(_this select 0) setDamage 1}];
|
_baseObj addEventHandler ["Explosion", {(_this select 0) setDamage 1}];
|
||||||
};
|
};
|
||||||
@ -165,7 +171,7 @@ for "_i" from 0 to _this do {
|
|||||||
if (_class in (call EPOCH_JammerClasses)) then {
|
if (_class in (call EPOCH_JammerClasses)) then {
|
||||||
EPOCH_Plotpoles pushbackunique _baseObj;
|
EPOCH_Plotpoles pushbackunique _baseObj;
|
||||||
if (EPOCH_SHOW_JAMMERS) then {
|
if (EPOCH_SHOW_JAMMERS) then {
|
||||||
_marker = createMarker [str(_location), _location];
|
_marker = createMarker [str(_pos), _pos];
|
||||||
_marker setMarkerShape "ICON";
|
_marker setMarkerShape "ICON";
|
||||||
// TODO allow players to change this per base
|
// TODO allow players to change this per base
|
||||||
_marker setMarkerType "mil_dot";
|
_marker setMarkerType "mil_dot";
|
||||||
@ -200,7 +206,7 @@ for "_i" from 0 to _this do {
|
|||||||
|
|
||||||
EPOCH_BuildingSlots set [_i,1];
|
EPOCH_BuildingSlots set [_i,1];
|
||||||
if (EPOCH_DEBUG_VEH) then {
|
if (EPOCH_DEBUG_VEH) then {
|
||||||
_marker = createMarker [str(_location) , _location];
|
_marker = createMarker [str(_pos) , _pos];
|
||||||
_marker setMarkerShape "ICON";
|
_marker setMarkerShape "ICON";
|
||||||
_marker setMarkerType "mil_dot";
|
_marker setMarkerType "mil_dot";
|
||||||
_marker setMarkerText _class;
|
_marker setMarkerText _class;
|
||||||
|
@ -49,31 +49,8 @@ for "_i" from 1 to _maxStorageLimit do {
|
|||||||
if !(_inventory isEqualType []) then { _inventory = []; };
|
if !(_inventory isEqualType []) then { _inventory = []; };
|
||||||
|
|
||||||
_worldspace = _arr select 1;
|
_worldspace = _arr select 1;
|
||||||
_wsCount = count _worldspace;
|
_worldspace params ["_pos","_vectordir","_vectorup",["_useworld",false]];
|
||||||
|
_vectordirup = [_vectordir,_vectorup];
|
||||||
// new worldspace format
|
|
||||||
if (_wsCount == 3) then {
|
|
||||||
_location = _worldspace deleteAt 0;
|
|
||||||
_dir = _worldspace;
|
|
||||||
} else {
|
|
||||||
_dir = _worldspace select 0;
|
|
||||||
_location = _worldspace select 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
// increased position precision
|
|
||||||
if (count _location == 2) then{
|
|
||||||
_location = (_location select 0) vectorAdd(_location select 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
// set to ground if only x,y
|
|
||||||
if (count _location == 2) then {
|
|
||||||
_location set [2, 0];
|
|
||||||
};
|
|
||||||
|
|
||||||
// try to recover from negitive z
|
|
||||||
if ((_location select 2) < 0) then {
|
|
||||||
_location set [2, 0];
|
|
||||||
};
|
|
||||||
|
|
||||||
_vehicle = createVehicle[_class, [0,0,0], [], 0, "CAN_COLLIDE"];
|
_vehicle = createVehicle[_class, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
@ -96,19 +73,18 @@ for "_i" from 1 to _maxStorageLimit do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_dir isEqualType []) then {
|
if (_useworld) then {
|
||||||
_vehicle setposATL _location;
|
_vehicle setposworld _pos;
|
||||||
_vehicle setVectorDirAndUp _dir;
|
}
|
||||||
} else {
|
else {
|
||||||
_vehicle setposATL _location;
|
_vehicle setposATL _pos;
|
||||||
_vehicle setDir _dir;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_vehicle setVectorDirAndUp _vectordirup;
|
||||||
|
|
||||||
// temp set damage to mark for maint
|
// temp set damage to mark for maint
|
||||||
_vehicle setDamage 0.01;
|
_vehicle setDamage 0.01;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_vehicle setVariable ["STORAGE_SLOT", str(_i), true];
|
_vehicle setVariable ["STORAGE_SLOT", str(_i), true];
|
||||||
|
|
||||||
if (isDamageAllowed _vehicle) then {
|
if (isDamageAllowed _vehicle) then {
|
||||||
@ -162,7 +138,7 @@ for "_i" from 1 to _maxStorageLimit do {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (EPOCH_DEBUG_VEH) then {
|
if (EPOCH_DEBUG_VEH) then {
|
||||||
_marker = createMarker [str(_location) , _location];
|
_marker = createMarker [str(_pos) , _pos];
|
||||||
_marker setMarkerShape "ICON";
|
_marker setMarkerShape "ICON";
|
||||||
_marker setMarkerType "mil_dot";
|
_marker setMarkerType "mil_dot";
|
||||||
_marker setMarkerText _class;
|
_marker setMarkerText _class;
|
||||||
|
@ -26,14 +26,13 @@ if (!isNull _vehicle) then {
|
|||||||
|
|
||||||
_damage = 0;
|
_damage = 0;
|
||||||
_vehicle setDamage 0;
|
_vehicle setDamage 0;
|
||||||
_vehiclePos = getposATL _vehicle;
|
|
||||||
|
|
||||||
_inventory = _vehicle call EPOCH_server_CargoSave;
|
_inventory = _vehicle call EPOCH_server_CargoSave;
|
||||||
|
|
||||||
_colorSlot = _vehicle getVariable ["STORAGE_TEXTURE",0];
|
_colorSlot = _vehicle getVariable ["STORAGE_TEXTURE",0];
|
||||||
_storageOwners = _vehicle getVariable["STORAGE_OWNERS",[]];
|
_storageOwners = _vehicle getVariable["STORAGE_OWNERS",[]];
|
||||||
_locked = if (_vehicle getVariable["EPOCH_Locked", true]) then {1} else {-1};
|
_locked = if (_vehicle getVariable["EPOCH_Locked", true]) then {1} else {-1};
|
||||||
_worldspace = [(_vehiclePos call EPOCH_precisionPos), vectordir _vehicle, vectorup _vehicle];
|
_worldspace = [getposworld _vehicle, vectordir _vehicle, vectorup _vehicle, true];
|
||||||
|
|
||||||
_VAL = [_class, _worldspace, _damage, _inventory, _colorSlot, _storageOwners, _locked];
|
_VAL = [_class, _worldspace, _damage, _inventory, _colorSlot, _storageOwners, _locked];
|
||||||
["Storage", _vehHiveKey, EPOCH_expiresBuilding, _VAL] call EPOCH_fnc_server_hiveSETEX;
|
["Storage", _vehHiveKey, EPOCH_expiresBuilding, _VAL] call EPOCH_fnc_server_hiveSETEX;
|
||||||
|
Loading…
Reference in New Issue
Block a user