Skip to content

Commit

Permalink
fix: curator , fix DB
Browse files Browse the repository at this point in the history
- fix: object inside container or venhicle not saved
- fix: the number of object after restat from db increase
-fix objects from curator without interation
- Update doc
- need localise the modified string `STR_BTC_HAM_DOC_LOGISTIC_TEXT` : "See ACE3 documentation."#400
  • Loading branch information
Vdauphin committed May 15, 2018
1 parent d63bc63 commit 694f927
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 79 deletions.
10 changes: 6 additions & 4 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load_old.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,13 @@ private _vehs = profileNamespace getVariable [format ["btc_hm_%1_vehs", _name],
{
_x params ["_type", "_rearm_magazineClass", "_cargo_obj"];

private _obj = _type createVehicle [0, 0, 0];
private _l = createVehicle [_type, getPosATL _obj, [], 0, "CAN_COLLIDE"];
[_l] call btc_fnc_log_init;
private _isloaded = [_l, _obj] call ace_cargo_fnc_loadItem;
if (btc_debug_log) then {
[format ["Object loaded: %1 in veh/container %2 IsLoaded: %3", _l, _obj, _isloaded], __FILE__, [false]] call btc_fnc_debug_message;
};
if (_rearm_magazineClass != "") then {_obj setVariable ["ace_rearm_magazineClass", _rearm_magazineClass, true]};
btc_log_obj_created pushBack _obj;
btc_curator addCuratorEditableObjects [[_obj], false];

clearWeaponCargoGlobal _obj;clearItemCargoGlobal _obj;clearMagazineCargoGlobal _obj;
_cargo_obj params ["_weap_obj", "_mags_obj", "_items_obj"];
Expand All @@ -182,7 +185,6 @@ private _vehs = profileNamespace getVariable [format ["btc_hm_%1_vehs", _name],
_obj addItemCargoGlobal [(_items_obj select 0) select _i, (_items_obj select 1) select _i];
};
};
[_obj, _veh] call ace_cargo_fnc_loadItem;
} forEach _veh_cargo;

clearWeaponCargoGlobal _veh;clearItemCargoGlobal _veh;clearMagazineCargoGlobal _veh;
Expand Down
96 changes: 50 additions & 46 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/loadcargo.sqf
Original file line number Diff line number Diff line change
@@ -1,63 +1,67 @@
params ["_obj", "_cargo", "_inventory"];
[{
params ["_obj", "_cargo", "_inventory"];

//handle cargo
{
_x params ["_type", "_magClass", "_cargo_obj"];
//handle cargo
{
_x params ["_type", "_magClass", "_cargo_obj"];

private _l = _type createVehicle [0, 0, 0];
if (_magClass != "") then {
_l setVariable ["ace_rearm_magazineClass", _magClass, true]
};
btc_log_obj_created pushBack _l;
btc_curator addCuratorEditableObjects [[_l], false];
private _l = createVehicle [_type, getPosATL _obj, [], 0, "CAN_COLLIDE"];
[_l] call btc_fnc_log_init;
private _isloaded = [_l, _obj] call ace_cargo_fnc_loadItem;
if (btc_debug_log) then {
[format ["Object loaded: %1 in veh/container %2 IsLoaded: %3", _l, _obj, _isloaded], __FILE__, [false]] call btc_fnc_debug_message;
};

clearWeaponCargoGlobal _l;
clearItemCargoGlobal _l;
clearMagazineCargoGlobal _l;
if (_magClass != "") then {
_l setVariable ["ace_rearm_magazineClass", _magClass, true]
};

_cargo_obj params ["_weap_obj", "_mags_obj", "_items_obj"];
clearWeaponCargoGlobal _l;
clearItemCargoGlobal _l;
clearMagazineCargoGlobal _l;

if !(_weap_obj isEqualTo []) then {
for "_i" from 0 to ((count (_weap_obj select 0)) - 1) do {
_l addWeaponCargoGlobal [(_weap_obj select 0) select _i, (_weap_obj select 1) select _i];
_cargo_obj params ["_weap_obj", "_mags_obj", "_items_obj"];

if !(_weap_obj isEqualTo []) then {
for "_i" from 0 to ((count (_weap_obj select 0)) - 1) do {
_l addWeaponCargoGlobal [(_weap_obj select 0) select _i, (_weap_obj select 1) select _i];
};
};
};

if !(_mags_obj isEqualTo []) then {
for "_i" from 0 to ((count (_mags_obj select 0)) - 1) do {
_l addMagazineCargoGlobal [(_mags_obj select 0) select _i, (_mags_obj select 1) select _i];
if !(_mags_obj isEqualTo []) then {
for "_i" from 0 to ((count (_mags_obj select 0)) - 1) do {
_l addMagazineCargoGlobal [(_mags_obj select 0) select _i, (_mags_obj select 1) select _i];
};
};
};

if !(_items_obj isEqualTo []) then {
for "_i" from 0 to ((count (_items_obj select 0)) - 1) do {
_l addItemCargoGlobal [(_items_obj select 0) select _i, (_items_obj select 1) select _i];
if !(_items_obj isEqualTo []) then {
for "_i" from 0 to ((count (_items_obj select 0)) - 1) do {
_l addItemCargoGlobal [(_items_obj select 0) select _i, (_items_obj select 1) select _i];
};
};
};
[_l, _obj] call ace_cargo_fnc_loadItem;
} forEach _cargo;
} forEach _cargo;

//set inventory content for weapons, magazines and items
_inventory params ["_weap", "_mags", "_items"];
//set inventory content for weapons, magazines and items
_inventory params ["_weap", "_mags", "_items"];

clearWeaponCargoGlobal _obj;
clearItemCargoGlobal _obj;
clearMagazineCargoGlobal _obj;
clearWeaponCargoGlobal _obj;
clearItemCargoGlobal _obj;
clearMagazineCargoGlobal _obj;

if !(_weap isEqualTo []) then {
for "_i" from 0 to ((count (_weap select 0)) - 1) do {
_obj addWeaponCargoGlobal [(_weap select 0) select _i, (_weap select 1) select _i];
if !(_weap isEqualTo []) then {
for "_i" from 0 to ((count (_weap select 0)) - 1) do {
_obj addWeaponCargoGlobal [(_weap select 0) select _i, (_weap select 1) select _i];
};
};
};
if !(_mags isEqualTo []) then {
for "_i" from 0 to ((count (_mags select 0)) - 1) do {
_obj addMagazineCargoGlobal [(_mags select 0) select _i, (_mags select 1) select _i];
if !(_mags isEqualTo []) then {
for "_i" from 0 to ((count (_mags select 0)) - 1) do {
_obj addMagazineCargoGlobal [(_mags select 0) select _i, (_mags select 1) select _i];
};
};
};
if !(_items isEqualTo []) then {
for "_i" from 0 to ((count (_items select 0)) - 1) do {
_obj addItemCargoGlobal [(_items select 0) select _i, (_items select 1) select _i];
if !(_items isEqualTo []) then {
for "_i" from 0 to ((count (_items select 0)) - 1) do {
_obj addItemCargoGlobal [(_items select 0) select _i, (_items select 1) select _i];
};
};
};

_obj
}, _this] call CBA_fnc_waitAndExecute;
4 changes: 2 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/save.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private _array_veh = [];
private _cargo = [];
{
_cargo pushBack [typeOf _x, _x getVariable ["ace_rearm_magazineClass", ""], [getWeaponCargo _x, getMagazineCargo _x, getItemCargo _x]]
} forEach (_x getVariable ["cargo", []]);
} forEach (_x getVariable ["ace_cargo_loaded", []]);
_data pushBack _cargo;
private _cont = [getWeaponCargo _x, getMagazineCargo _x, getItemCargo _x];
_data pushBack _cont;
Expand All @@ -133,7 +133,7 @@ private _array_obj = [];
if !(_data isEqualTo []) then {
_array_obj pushBack _data;
};
} forEach btc_log_obj_created;
} forEach (btc_log_obj_created select {!(isObjectHidden _x)});
profileNamespace setVariable [format ["btc_hm_%1_objs", _name], _array_obj];

//Player Markers
Expand Down
8 changes: 0 additions & 8 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/veh_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,10 @@ switch true do {
[_type, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToClass;
_action = ["log_hook", localize "STR_BTC_HAM_ACTION_VEHINIT_UHOOK", "\z\ace\addons\attach\UI\detach_ca.paa", {(_this select 0) spawn btc_fnc_log_unhook;}, {true}] call ace_interact_menu_fnc_createAction; //Unhook
[_type, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToClass;
//Cargo
_action = ["check_cargo", localize "STR_BTC_HAM_ACTION_LOGISTIC_CHECKCARGO", "\A3\ui_f\data\igui\cfg\simpleTasks\types\search_ca.paa", {(_this select 0) spawn btc_fnc_log_check_cargo;}, {true}] call ace_interact_menu_fnc_createAction; //Check Cargo
//Outside Vehicle
[_type, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToClass; //Logistic
};
case (_type isKindOf "Helicopter") : {
private _action = ["Logistic", localize "STR_BTC_HAM_ACTION_LOC_MAIN", "\A3\ui_f\data\igui\cfg\simpleTasks\letters\L_ca.paa", {}, {true}] call ace_interact_menu_fnc_createAction; //Logistic
[_type, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToClass;
//Cargo
_action = ["check_cargo", localize "STR_BTC_HAM_ACTION_LOGISTIC_CHECKCARGO", "\A3\ui_f\data\igui\cfg\simpleTasks\types\search_ca.paa", {(_this select 0) spawn btc_fnc_log_check_cargo;}, {true}] call ace_interact_menu_fnc_createAction; //Check Cargo
//Outside Vehicle
[_type, 0, ["ACE_MainActions", "Logistic"], _action] call ace_interact_menu_fnc_addActionToClass; //Logistic
//Lift
_action = ["Deploy_ropes", localize "STR_BTC_HAM_ACTION_VEHINIT_DEPLOYROPES", "\A3\ui_f\data\igui\cfg\simpleTasks\types\container_ca.paa", {[] spawn btc_fnc_log_lift_deploy_ropes;}, {!btc_ropes_deployed && {(driver vehicle player) isEqualTo player} && {(getposATL player) select 2 > 4}}] call ace_interact_menu_fnc_createAction; //Deploy ropes
[_type, 1, ["ACE_SelfActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
Expand Down
1 change: 0 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/int/ask_var.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ private _data = switch (_id) do {
_hd;
};
case 2 : {btc_global_reputation;};
case 3 : {_target getVariable ["cargo", []];};
case 4 : {_target getVariable ["tow", objNull];};
case 5 : {btc_side_jip_data;};
case 6 : {btc_fobs;};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
params ["_obj_created"];

btc_log_obj_created pushBack _obj_created;
[_obj_created] call btc_fnc_log_init;

if (btc_debug_log) then {
[format ["btc_log_obj_created UPDATED by curator %1", _obj_created], __FILE__, [false]] call btc_fnc_debug_message;
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/paste.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if ({!((_x isKindOf "Animal") || (_x isKindOf "Module_F") || (_x isKindOf "Weapo

if (isNil "_copy_container") exitWith {hint localize "STR_BTC_HAM_O_PASTE_NOCOPIED"}; //No copied container!

[_copy_container] remoteExec ["btc_fnc_db_loadObjectStatus", 2];
[_copy_container] remoteExecCall ["btc_fnc_db_loadObjectStatus", 2];
18 changes: 2 additions & 16 deletions =BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@
<German>Logistik</German>
</Key>
<Key ID="STR_BTC_HAM_DOC_LOGISTIC_TEXT">
<Original>&lt;marker name='blufor_base'&gt;Cargo System:&lt;/marker&gt;&lt;br/&gt; - &lt;img image='a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Load:&lt;/marker&gt; You can load objects inside vehicles. Approach the object you want to load and interact with it.&lt;br/&gt; Select 'LOAD IN' option.&lt;br/&gt; After that interact with the vehicle and select 'LOAD object selected' option.&lt;br/&gt; The object has to be close to the vehicle.&lt;br/&gt;&lt;br/&gt; - &lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\search_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Unload:&lt;/marker&gt; You can unload an object from a vehicle interacting with it. You can be inside the vehicle (personal interaction) or outside (object interaction).&lt;br/&gt; Select the option 'CHECK CARGO', then choose the object you want to unload from the list, and click 'UNLOAD'.&lt;br/&gt; If you are inside a chopper the object will be paradropped with a chute. If your height is too low, the object will crash down.&lt;br/&gt; Every vehicle has a 'CARGO CAPACITY' (CC in game), and every object has a 'REQUIRED CAPACITY' value (RC in game.)&lt;br/&gt; You can check those values in game with 'LOAD IN' and 'CHECK CARGO' options.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Towing system:&lt;/marker&gt;&lt;br/&gt; To tow a vehicle interact with it and select the option 'HOOK'.&lt;br/&gt;After that place the tow vehicle in front of it and select 'TOW' in the interaction menu.&lt;br/&gt; If the two vehicles are too far away or the vehicle can't tow that load (Car can't tow truck or tank), the option will be disabled.&lt;br/&gt; To unhook interact with one of the two vehicles and select the option 'UNHOOK'.&lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Place option:&lt;/marker&gt;&lt;br/&gt; With this option you can move heavy objects to build small outpost or base.&lt;br/&gt; When you select the option an hint will show all the keys required to move the object.</Original>
<German>&lt;marker name='blufor_base'&gt;Fracht-System:&lt;/marker&gt;&lt;br/&gt; - &lt;img image='a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Beladen:&lt;/marker&gt; Man kann Objekte in Fahrzeuge einladen. Gehen Sie an das Obekt heran und interagieren sie damit.&lt;br/&gt; Wählen sie 'EINLADEN'aus.&lt;br/&gt; Als nächstes gehen Sie zum Fahrzeug und wählen 'AUSGEWÄHLTES EINLADEN' aus.&lt;br/&gt; Denken Sie daran, dass das zu verladende Objekt sich in der Nähe des Fahrzeuges befinden muss.&lt;br/&gt;&lt;br/&gt; - &lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\search_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Abladen:&lt;/marker&gt; Man kann Objekte aus einen Fahrzeug entladen, indem man mit diesem interagiert. Das funktioniert von Innen (Eigen-Interaktionsmenü) und von Aussen (mit dem Objekt interagieren).&lt;br/&gt; Über den Menüpunkt 'FRACHT ÜBERPRÜFEN' kann man das zu entladende Objekt aus einer Liste auswählen und mit einem Klick auf 'ENTLADEN' ausladen.&lt;br/&gt; Wenn man sich beim Ausladen in einem Hubschrauber befindet, so wird das Objekt automatisch mit einem Fallschrim abgeworfen. Aber Achtung: Der Fallschirm öffnet sich erst ab einer bestimmten Flughöhe.&lt;br/&gt; Jedes Fahrzeug hat eine gewisse Ladekapazität ('Frachtkapazität' - CC im Spiel genannt) und jedes Objekt hat ein gewisses Ladevolumen ('benötigte Kapazität' - RC im Spiel genannt).&lt;br/&gt; Diese Werte können im Spiel mit den Actionen 'EINLADEN' und 'FRACHT ÜBERPRÜFEN' geprüft werden.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Abschleppsystem:&lt;/marker&gt;&lt;br/&gt; Um ein Fahrzeug abzuschleppen muss man mit diesem interagieren und 'EINHACKEN' auswählen.&lt;br/&gt;Als nächstes muss man das Zugfahrzeug vor das abzuschleppende Fahrzeug stellen und über das Interagtionsmenü die Option 'ABSCHLEPPEN' aktivieren.&lt;br/&gt; Zu beachten ist dabei, dass die beiden Fahrzeuge nicht zu weit von einander entfernt sein dürfen. Ebenso ist daruf zu achten, dass das Zugfahrzeug auch das andere Fahrzeug abschleppen kann (zB. Autos können keine Lkw/Panzer abschleppen).&lt;br/&gt; Um das Abschleppseil wieder zu entfernen muss man einen bei einem der beiden Fahrzeuge die Option 'AUSHACKEN' auswählen.&lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Platzierung von Objekten:&lt;/marker&gt;&lt;br/&gt; Mit dieser Option können Sie schwere Objekte bewegen, um einen kleinen Außenposten oder eine Basis zu bauen.&lt;br/&gt; Wenn Sie die Option auswählen, zeigt ein Hinweis alle Tasten an, die zum Verschieben des Objekts erforderlich sind.</German>
<Original>&lt;marker name='blufor_base'&gt;Cargo System:&lt;/marker&gt;&lt;br/&gt; See ACE3 documentation. &lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Towing system:&lt;/marker&gt;&lt;br/&gt; To tow a vehicle interact with it and select the option 'HOOK'.&lt;br/&gt;After that place the tow vehicle in front of it and select 'TOW' in the interaction menu.&lt;br/&gt; If the two vehicles are too far away or the vehicle can't tow that load (Car can't tow truck or tank), the option will be disabled.&lt;br/&gt; To unhook interact with one of the two vehicles and select the option 'UNHOOK'.&lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Place option:&lt;/marker&gt;&lt;br/&gt; With this option you can move heavy objects to build small outpost or base.&lt;br/&gt; When you select the option an hint will show all the keys required to move the object.</Original>
<German>&lt;marker name='blufor_base'&gt;Fracht-System:&lt;/marker&gt;&lt;br/&gt; &lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Abschleppsystem:&lt;/marker&gt;&lt;br/&gt; Um ein Fahrzeug abzuschleppen muss man mit diesem interagieren und 'EINHACKEN' auswählen.&lt;br/&gt;Als nächstes muss man das Zugfahrzeug vor das abzuschleppende Fahrzeug stellen und über das Interagtionsmenü die Option 'ABSCHLEPPEN' aktivieren.&lt;br/&gt; Zu beachten ist dabei, dass die beiden Fahrzeuge nicht zu weit von einander entfernt sein dürfen. Ebenso ist daruf zu achten, dass das Zugfahrzeug auch das andere Fahrzeug abschleppen kann (zB. Autos können keine Lkw/Panzer abschleppen).&lt;br/&gt; Um das Abschleppseil wieder zu entfernen muss man einen bei einem der beiden Fahrzeuge die Option 'AUSHACKEN' auswählen.&lt;br/&gt;&lt;br/&gt; &lt;marker name='blufor_base'&gt;Platzierung von Objekten:&lt;/marker&gt;&lt;br/&gt; Mit dieser Option können Sie schwere Objekte bewegen, um einen kleinen Außenposten oder eine Basis zu bauen.&lt;br/&gt; Wenn Sie die Option auswählen, zeigt ein Hinweis alle Tasten an, die zum Verschieben des Objekts erforderlich sind.</German>
</Key>
</Container>
<Container name="Documentation: Hideout">
Expand Down Expand Up @@ -919,20 +919,6 @@
<German>Fahrzeug anfordern</German>
</Key>
</Container>
<Container name="Action(ACE): Logistic">
<Key ID="STR_BTC_HAM_ACTION_LOGISTIC_LOADIN">
<Original>Load in</Original>
<German>Einladen</German>
</Key>
<Key ID="STR_BTC_HAM_ACTION_LOGISTIC_LOADSEL">
<Original>Load selected</Original>
<German>Ausgewähltes einladen</German>
</Key>
<Key ID="STR_BTC_HAM_ACTION_LOGISTIC_CHECKCARGO">
<Original>Check cargo</Original>
<German>Fracht überprüfen</German>
</Key>
</Container>
<Container name="Action(ACE): FOB">
<Key ID="STR_BTC_HAM_ACTION_FOB_MOUNT">
<Original>Mount FOB</Original>
Expand Down

0 comments on commit 694f927

Please sign in to comment.