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.
This commit is contained in:
vbawol 2017-10-11 00:42:11 -05:00
parent 976baf9660
commit 28340c2311
2 changed files with 15 additions and 5 deletions

View File

@ -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];
};

View File

@ -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];