mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
small npctrade fixes
In very rare cases it could be, that the Server or Client do not take the nearest local vehicle for trading
This commit is contained in:
parent
7ec16f978e
commit
fe3a1d62f2
Sources
epoch_code/compile/traders
epoch_server/compile/epoch_trading
@ -65,7 +65,7 @@ if !(isNull EPOCH_lastNPCtradeTarget) then {
|
||||
_vehicle = _x;
|
||||
if (local _vehicle && (typeof _vehicle) isequalto _uiItem) then {
|
||||
{
|
||||
if ((["wheel",tolower _x] call bis_fnc_instring) || _x isequalto "HitEngine") then {
|
||||
if ((["wheel",tolower _x] call bis_fnc_instring) || (tolower _x) isequalto "hitengine") then {
|
||||
if (((getAllHitPointsDamage _vehicle) select 2 select _foreachindex) >= 1) then {
|
||||
_allowAdd = false;
|
||||
_errormsg = "Cannot be sold - too much damage";
|
||||
|
@ -88,17 +88,13 @@ if (alive _this) then {
|
||||
_added = true;
|
||||
}
|
||||
else {
|
||||
_vehicles = _this nearEntities[[_item], 30];
|
||||
_vehicles = (nearestobjects [_this,[_item], 30]) select {local _x && alive _x};
|
||||
if (!(_vehicles isEqualTo[])) then {
|
||||
_vehicle = _vehicles select 0;
|
||||
if (!isNull _vehicle) then {
|
||||
if (local _vehicle) then {
|
||||
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
|
||||
if (_vehSlot != "ABORT" || _EnableTempVehTrade) then {
|
||||
_arrayIn pushBack [_item,_rounds];
|
||||
_added = true;
|
||||
};
|
||||
};
|
||||
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
|
||||
if (_vehSlot != "ABORT" || _EnableTempVehTrade) then {
|
||||
_arrayIn pushBack [_item,_rounds];
|
||||
_added = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -69,36 +69,31 @@ if (_slot != -1) then {
|
||||
_itemWorth = round (_itemWorth*(_itemQty/_maxrnd));
|
||||
_makeTradeIn = false;
|
||||
if (_item isKindOf "Air" || _item isKindOf "Ship" || _item isKindOf "LandVehicle" || _item isKindOf "Tank") then{
|
||||
_vehicles = _trader nearEntities[[_item], 30];
|
||||
_vehicles = (nearestobjects [_trader,[_item],30]) select {owner _x == owner _player && alive _x};
|
||||
if !(_vehicles isEqualTo[]) then {
|
||||
_vehicle = _vehicles select 0;
|
||||
if (!isNull _vehicle) then {
|
||||
_playerNetID = owner _player;
|
||||
if (_playerNetID == (owner _vehicle)) then {
|
||||
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
|
||||
if (!_vehicleSold && (_vehSlot != "ABORT" || _EnableTempVehTrade)) then {
|
||||
_vehicleSold = true;
|
||||
_makeTradeIn = true;
|
||||
if (_vehSlot == "ABORT") exitwith {
|
||||
_itemQty = 0;
|
||||
_itemsIn set [_foreachindex,[_item,_itemQty]];
|
||||
removeFromRemainsCollector [_vehicle];
|
||||
deleteVehicle _vehicle;
|
||||
};
|
||||
_BaseClass = _vehicle getvariable ["VEHICLE_BaseClass",""];
|
||||
if !(_BaseClass isequalto "") then {
|
||||
_item = _BaseClass;
|
||||
_itemsIn set [_foreachindex,[_item,_itemQty]];
|
||||
};
|
||||
removeFromRemainsCollector [_vehicle];
|
||||
deleteVehicle _vehicle;
|
||||
_vehHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _vehSlot];
|
||||
_VAL = [];
|
||||
["Vehicle", _vehHiveKey, _VAL] call EPOCH_fnc_server_hiveSET;
|
||||
EPOCH_VehicleSlots pushBack _vehSlot;
|
||||
missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true];
|
||||
};
|
||||
_vehSlot = _vehicle getVariable["VEHICLE_SLOT", "ABORT"];
|
||||
if (!_vehicleSold && (_vehSlot != "ABORT" || _EnableTempVehTrade)) then {
|
||||
_vehicleSold = true;
|
||||
_makeTradeIn = true;
|
||||
if (_vehSlot == "ABORT") exitwith {
|
||||
_itemQty = 0;
|
||||
_itemsIn set [_foreachindex,[_item,_itemQty]];
|
||||
removeFromRemainsCollector [_vehicle];
|
||||
deleteVehicle _vehicle;
|
||||
};
|
||||
_BaseClass = _vehicle getvariable ["VEHICLE_BaseClass",""];
|
||||
if !(_BaseClass isequalto "") then {
|
||||
_item = _BaseClass;
|
||||
_itemsIn set [_foreachindex,[_item,_itemQty]];
|
||||
};
|
||||
removeFromRemainsCollector [_vehicle];
|
||||
deleteVehicle _vehicle;
|
||||
_vehHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _vehSlot];
|
||||
_VAL = [];
|
||||
["Vehicle", _vehHiveKey, _VAL] call EPOCH_fnc_server_hiveSET;
|
||||
EPOCH_VehicleSlots pushBack _vehSlot;
|
||||
missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user