move isTemporary var to cfgBaseBuilding

This commit is contained in:
vbawol 2016-05-02 18:21:16 -05:00
parent 6c18851850
commit 28cfe61d37
4 changed files with 23 additions and 21 deletions

View File

@ -21,7 +21,7 @@
Returns:
NOTHING
*/
private ["_posObj","_savedBuildPos","_previousBuildPos","_saveCheck","_endTime","_worldspace","_class","_newObj","_startTime","_objClass"];
private ["_config","_posObj","_savedBuildPos","_previousBuildPos","_saveCheck","_endTime","_worldspace","_class","_newObj","_startTime","_objClass"];
if (!isNull _this) then {
@ -63,7 +63,8 @@ if (!isNull _this) then {
_objClass = typeOf _this;
// Spawn temporary static item insead of saving.
if (getNumber(configfile >> "CfgVehicles" >> _objClass >> "isTemporary") == 1) then {
_config = 'CfgBaseBuilding' call EPOCH_returnConfig;
if (getNumber(_config >> _objClass >> "isTemporary") == 1) then {
_worldspace = [getposATL _this, vectordir _this, vectorup _this];
deleteVehicle _this;
_class = getText(configfile >> "CfgVehicles" >> _objClass >> "staticClass");

View File

@ -22,10 +22,22 @@ class CfgBaseBuilding {
{
upgradeBuilding[] = { { "FirePlaceOn_EPOCH", { { "WoodLog_EPOCH", 1 } } } };
removeParts[] = { { "ItemRock", 2 } };
staticClass = "FirePlace_EPOCH";
simulClass = "Fireplace_SIM_EPOCH";
GhostPreview = "FirePlace_EPOCH";
limitNearby = 2;
bypassJammer = 1;
isTemporary = 1;
};
class FirePlaceOn_EPOCH : Default
class Fireplace_SIM_EPOCH : FirePlace_EPOCH
{
removeParts[] = { { "ItemRock", 2 } };
upgradeBuilding[] = {};
removeParts[] = {};
};
class FirePlaceOn_EPOCH : FirePlace_EPOCH {
upgradeBuilding[] = {};
};
class Foundation_EPOCH : Default
{

View File

@ -12,7 +12,7 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_bases/EPOCH_server_removeBUILD.sqf
*/
private["_vehSlot", "_gwh", "_wepsItemsCargo", "_magsAmmoCargo", "_objTypes", "_objQty", "_magazine", "_weapon", "_suppressor", "_laser", "_optics", "_arrCount", "_magazineName", "_magazineSize", "_qty", "_objType", "_inventory", "_posWH", "_nearbyWH", "_removeParts", "_isTemporary", "_storageSlot"];
private["_config","_vehSlot", "_gwh", "_wepsItemsCargo", "_magsAmmoCargo", "_objTypes", "_objQty", "_magazine", "_weapon", "_suppressor", "_laser", "_optics", "_arrCount", "_magazineName", "_magazineSize", "_qty", "_objType", "_inventory", "_posWH", "_nearbyWH", "_removeParts", "_isTemporary", "_storageSlot"];
params ["_building","_player",["_token","",[""]]];
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
@ -21,8 +21,8 @@ if (_player distance _building > 20) exitWith{};
// TODO add group check here since this should only be removed by group or owner of pole
_objType = typeOf _building;
_isTemporary = getNumber(configFile >> "CfgVehicles" >> _objType >> "isTemporary");
_config = 'CfgBaseBuilding' call EPOCH_returnConfig;
_isTemporary = getNumber(_config >> _objType >> "isTemporary");
// check that object has building or storage slot
_vehSlot = _building getVariable["BUILD_SLOT", -1];

View File

@ -12,49 +12,38 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_bases/EPOCH_server_upgradeBUILD.sqf
*/
private["_worldspace", "_class", "_newObj", "_objHiveKey", "_VAL", "_return", "_upgrade", "_objSlot", "_objType"];
private["_config","_worldspace", "_class", "_newObj", "_objHiveKey", "_VAL", "_return", "_upgrade", "_objSlot", "_objType"];
params ["_object","_player",["_index",0],["_token","",[""]]];
if (isNull _object) exitWith{};
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
_objSlot = _object getVariable["BUILD_SLOT", -1];
_config = 'CfgBaseBuilding' call EPOCH_returnConfig;
if (_objSlot != -1) then {
_config = 'CfgBaseBuilding' call EPOCH_returnConfig;
_upgrades = getArray(_config >> (typeOf _object) >> "upgradeBuilding");
if !(_upgrades isEqualTo []) then {
_upgrade = _upgrades param [_index,[]];
_objectPos = getposATL _object;
_worldspace = [(_objectPos call EPOCH_precisionPos), vectordir _object, vectorup _object];
deleteVehicle _object;
_class = _upgrade select 0;
_newObj = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
_newObj setVariable ["BUILD_SLOT",_objSlot,true];
_newObj call EPOCH_server_buildingInit;
_newObj setposATL _objectPos;
_newObj setVectorDirAndUp [(_worldspace select 1),(_worldspace select 2)];
_newObj call EPOCH_saveBuilding;
};
} else {
_objType = typeOf _object;
if (getNumber(configFile >> "CfgVehicles" >> _objType >> "isTemporary") == 1) then{
_config = 'CfgBaseBuilding' call EPOCH_returnConfig;
if (getNumber(_config >> _objType >> "isTemporary") == 1) then{
_upgrades = getArray(_config >> (typeOf _object) >> "upgradeBuilding");
if !(_upgrades isEqualTo []) then {
_upgrade = _upgrades param [_index,[]];
_worldspace = [getposATL _object, vectordir _object, vectorup _object];
deleteVehicle _object;
_class = _upgrade select 0;
_newObj = createVehicle[_class, [0,0,0], [], 0, "CAN_COLLIDE"];
_newObj setposATL(_worldspace select 0);
_newObj setVectorDirAndUp[(_worldspace select 1), (_worldspace select 2)];