From 28340c23113fa2037449d1815c60bac687eab7eb Mon Sep 17 00:00:00 2001 From: vbawol Date: Wed, 11 Oct 2017 00:42:11 -0500 Subject: [PATCH] Base Building: spawn only ghost used to spawn static version then swap, now it just spawns ghost version first. should also fix Garden_Epoch and other new item kicks. --- Sources/epoch_code/compile/EPOCH_consumeItem.sqf | 9 +++++++-- .../epoch_code/compile/building/EPOCH_staticMove.sqf | 11 ++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf index 33f0367f..12736db6 100644 --- a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf +++ b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf @@ -13,7 +13,7 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_consumeItem.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_buildClass","_buildingCountLimit","_buildingJammerRange","_canCapacity","_cfgBaseBuilding","_cfgItemInteractions","_color","_currentDMG","_currentFuel","_currentHIT","_fuelCapacity","_highestDMG","_inputCount","_interactAttributes","_interactOption","_interactReturnOnUse","_isOk","_isStorage","_magazineSize","_magazineSizeMax","_magazinesAmmoFull","_newDMG","_newFuel","_object","_otherObjects","_output","_paintCanColor","_paintCanIndex","_partCheck","_pos","_removeItem","_transportFuel","_unifiedInteract","_vehicle","_vehicles"]; +private ["_buildClass","_buildingCountLimit","_buildingJammerRange","_canCapacity","_cfgBaseBuilding","_cfgItemInteractions","_color","_currentDMG","_currentFuel","_currentHIT","_fuelCapacity","_ghostClass","_highestDMG","_inputCount","_interactAttributes","_interactOption","_interactReturnOnUse","_isOk","_isStorage","_magazineSize","_magazineSizeMax","_magazinesAmmoFull","_msg","_newDMG","_newFuel","_object","_otherObjects","_output","_paintCanColor","_paintCanIndex","_partCheck","_pos","_removeItem","_transportFuel","_unifiedInteract","_vehicle","_vehicles"]; //[[[end]]] EPOCH_InteractedItem params ["_text","_item","_pic"]; @@ -133,6 +133,11 @@ switch _interactOption do { }; } else { + // use ghost GhostPreview if set + _ghostClass = getText(_cfgBaseBuilding >> _buildClass >> "GhostPreview"); + if !(_ghostClass isEqualTo "") then { + _buildClass = _ghostClass; + }; _object=createVehicle[_buildClass,_pos,[],0,"CAN_COLLIDE"]; _object setDir ((getDir player) - 180); [format["Press '%1' to drop object.", "1"], 5] call Epoch_message; @@ -234,7 +239,7 @@ switch _interactOption do { _newDMG = ((_highestDMG - 0.5) max 0); if (local _vehicle) then { - [_vehicle, [[_currentHIT, _newDMG]]] call EPOCH_client_repairVehicle; + [_vehicle, [[_currentHIT, _newDMG]] ] call EPOCH_client_repairVehicle; } else { [_vehicle,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; }; diff --git a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf index ce2450e2..3edf4050 100644 --- a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf @@ -81,11 +81,16 @@ if (_class != "") then { _objSlot = _object getVariable["BUILD_SLOT", -1]; - deleteVehicle _object; - _pos2 = player modelToWorldVisual[EPOCH_X_OFFSET, EPOCH_Y_OFFSET, EPOCH_Z_OFFSET]; - EPOCH_target = createVehicle[_class, _pos2, [], 0, "CAN_COLLIDE"]; + // object already ghost + if (_objType isEqualTo _class) then { + EPOCH_target = _object; + } else { + deleteVehicle _object; + EPOCH_target = createVehicle[_class, _pos2, [], 0, "CAN_COLLIDE"]; + }; + // send to server [EPOCH_target] remoteExec ["EPOCH_localCleanup",2];