Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Update UCD to 1.0.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanplecki committed Feb 17, 2014
1 parent e053004 commit cb0ee9b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Arma 2/Unit Caching/scripts/unitCaching/init.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Title: Unit Caching and Distribution Script
Author: Dylan Plecki (Naught)
Version: 1.0.2.5
Version: 1.0.2.8
Description:
An SQF script designed to dynamically cache and distribute AI units
Expand All @@ -27,8 +27,8 @@
Group: Definitons
*/

// Don't change this!
UCD_init = false;
UCD_A3 = isClass(configFile >> "CfgPatches" >> "A3_UI_F");

#include "config.sqf"

Expand Down
49 changes: 41 additions & 8 deletions Arma 2/Unit Caching/scripts/unitCaching/lib/caching.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ CLASS_EXTENDS("UCD_obj_cachedAsset","UCD_obj_cachedObject")
if ((vehicle _obj) != _obj) then {
["insert", ["vehicle", (vehicle _obj)]] call _prop;
["insert", ["unitVehPos", (_obj call UCD_fnc_unitVehPos)]] call _prop;
[_obj] allowGetIn false;
UnAssignVehicle _obj;
_obj action ["EJECT", (vehicle _obj)];
doGetOut _obj;
};
if (CHECK_MOD("ace")) then {
["insert", ["ruckWeps", [_obj] call ACE_fnc_RuckWeaponsList]] call _prop;
Expand All @@ -93,6 +97,7 @@ CLASS_EXTENDS("UCD_obj_cachedAsset","UCD_obj_cachedObject")
["insert", ["magazineCargo", (getMagazineCargo _obj)]] call _prop;
};
MEMBER("properties",_prop);
waitUntil {(vehicle _obj) == _obj};
deleteVehicle _obj;
};
PUBLIC FUNCTION("","spawn") {
Expand Down Expand Up @@ -136,17 +141,45 @@ CLASS_EXTENDS("UCD_obj_cachedAsset","UCD_obj_cachedObject")
_obj setVariable ["ACE_weapononback", (["get", ["wob", ""]] call _prop), true];
};
private ["_veh"];
_veh = ["get", "vehicle"] call _prop;
if (!isNil "_veh" && {!isNull _veh} && {alive _veh}) then {
_veh = ["get", ["vehicle", objNull]] call _prop;
if (!(isNull _veh) && {alive _veh}) then {
private ["_unitVehPos"];
_unitVehPos = ["get", ["unitVehPos", [""]]] call _prop;
_unitVehPos = ["get", ["unitVehPos", ["", []]]] call _prop;
switch (_unitVehPos select 0) do {
case "Commander": {_obj moveInCommander _veh};
case "Gunner": {_obj moveInGunner _veh};
case "Driver": {_obj moveInDriver _veh};
case "Turret": {_obj moveInTurret [_veh, (_unitVehPos select 1)]};
case "Cargo": {_obj moveInCargo _veh};
case "Commander": {
//_obj action ["GetInCommander", _veh];
_obj moveInCommander _veh;
//_obj assignAsCommander _veh;
};
case "Gunner": {
//_obj action ["GetInGunner", _veh];
_obj moveInGunner _veh;
//_obj assignAsGunner _veh;
};
case "Driver": {
//_obj action ["GetInDriver", _veh];
_obj moveInDriver _veh;
//_obj assignAsDriver _veh;
};
case "Turret": {
//_obj action ["GetInTurret", _veh, (_unitVehPos select 1)];
_obj moveInTurret [_veh, (_unitVehPos select 1)];
/*
#ifdef RVE_4_ADV_ENABLED
_obj assignAsTurret [_veh, (_unitVehPos select 1)]; // Arma 3 only
#else
_obj assignAsCargo _veh; // Workaround for Arma 2?
#endif
*/
};
default {
//_obj action ["GetInCargo", _veh];
_obj moveInCargo _veh;
//_obj assignAsCargo _veh;
};
};
//[_obj] allowGetIn true;
//[_obj] orderGetIn true;
};
} else { // Vehicle
_obj = (["get", "type"] call _prop) createVehicle _pos;
Expand Down
4 changes: 2 additions & 2 deletions Arma 2/Unit Caching/scripts/unitCaching/lib/objects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ UCD_fnc_unitVehPos = {
Examples:
(begin example)
_vehpos = player call ACE_fnc_unitvehpos
_vehpos = player call UCD_fnc_unitvehpos;
(end)
Author:
Expand Down Expand Up @@ -111,7 +111,7 @@ UCD_fnc_unitVehPos = {
_ptp = [];
{if (_u == _v turretUnit _x) exitwith {_ptp = _x}} foreach _tp;
if (count _ptp > 0) then {
_res = ["Turret",_ptp];
_res = ["Turret", _ptp];
} else {
_res = switch (true) do { // redundant for safety
case (_u == commander _v): {["Commander"]};
Expand Down

0 comments on commit cb0ee9b

Please sign in to comment.