diff --git a/CHANGELOG.md b/CHANGELOG.md index d5e1e7c00..3661d5ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## 0.96.8 (TBD) +* Added: Czech translation. Thanks to [MJVEVERUSKA](https://github.com/MJVEVERUSKA) +* Added: Ability to carry ressource crates. * Added: Scripts/configs to setup and run development environment from VSCode tasks * Updated: Italian localization. Thanks to [k4s0](https://github.com/k4s0) * Tweaked: Splitted the config file in separate files, as it was getting quite big. diff --git a/Missionframework/functions/fn_addActionsPlayer.sqf b/Missionframework/functions/fn_addActionsPlayer.sqf index 89f647f48..06b3eea99 100644 --- a/Missionframework/functions/fn_addActionsPlayer.sqf +++ b/Missionframework/functions/fn_addActionsPlayer.sqf @@ -2,7 +2,7 @@ File: fn_addActionsPlayer.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2020-04-13 - Last Update: 2020-09-12 + Last Update: 2023-10-28 License: MIT License - http://www.opensource.org/licenses/MIT Description: @@ -370,4 +370,33 @@ _player addAction [ " ]; +// Drop crate +_player addAction [ + ["", localize "STR_ACTION_CRATE_DROP", ""] joinString "", + { + params ["_player"]; + private _crate = _player getVariable ["KPLIB_carriedObject", objNull]; + + // prevent players from putting crates inside vehicles + private _crateSize = sizeOf typeOf _crate * 1.5; + private _nearObjects = (_crate nearEntities [["Man", "Air", "Car", "Tank"], _crateSize]) - [_crate, _player]; + if (_nearObjects isNotEqualTo []) exitWith { + hint format [localize "STR_PLACEMENT_IMPOSSIBLE", count _nearObjects, _crateSize toFixed 0]; + }; + + _player setVariable ["KPLIB_carriedObject", nil]; + detach _crate; + _crate awake true; + }, + nil, + -504, + true, + false, + "", + toString { + alive _originalTarget && + build_confirmed == 0 && _this in _this && {!isNull (_this getVariable ["KPLIB_carriedObject", objNull])} + } +]; + true diff --git a/Missionframework/scripts/client/ammoboxes/ammobox_action_manager.sqf b/Missionframework/scripts/client/ammoboxes/ammobox_action_manager.sqf index 6586b6eda..c6667e08e 100644 --- a/Missionframework/scripts/client/ammoboxes/ammobox_action_manager.sqf +++ b/Missionframework/scripts/client/ammoboxes/ammobox_action_manager.sqf @@ -57,10 +57,24 @@ while {true} do { _b_action_id2 = _next_box addAction ["" + localize "STR_ACTION_STORE_CRATE" + "",{[(_this select 0), (nearestObjects [player,KPLIB_storageBuildings,20]) select 0,true] call KPLIB_fnc_crateToStorage;},"",-502,true,true,"","build_confirmed == 0 && (_this distance _target < 5) && (vehicle player == player)"]; _b_action_id3 = _next_box addAction ["" + localize "STR_ACTION_CRATE_VALUE" + "",{[_this select 0] call KPLIB_fnc_checkCrateValue;uiSleep 3; hint "";},"",-503,true,true,"","build_confirmed == 0 && (_this distance _target < 5) && (vehicle player == player)"]; _b_action_id4 = _next_box addAction ["" + localize "STR_ACTION_CRATE_PUSH" + "",{(_this select 0) setPos ((_this select 0) getPos [1, (player getDir (_this select 0))]);},"",-504,true,false,"","build_confirmed == 0 && (_this distance _target < 5) && (vehicle player == player)"]; + _b_action_id_carry = _next_box addAction [ + "" + localize "STR_ACTION_CRATE_CARRY" + "", + { + params ["_crate", "_player"]; + _crate attachTo [_player, [0, 2, 1]]; + _player setVariable ["KPLIB_carriedObject", _crate]; + }, + "", -504, true, false, "", + toString { + build_confirmed == 0 && _this in _this && {isNull (_this getVariable ["KPLIB_carriedObject", objNull])} + }, + 5 // radius + ]; _next_box setVariable ["KPLIB_ammo_box_action", _b_action_id1, false]; _next_box setVariable ["KP_crate_store_action", _b_action_id2, false]; _next_box setVariable ["KP_crate_value_action", _b_action_id3, false]; _next_box setVariable ["KP_crate_push_action", _b_action_id4, false]; + _next_box setVariable ["KP_crate_carry_action", _b_action_id_carry, false]; _managed_boxes pushback _next_box; }; @@ -75,6 +89,8 @@ while {true} do { _next_box removeAction (_next_box getVariable ["KP_crate_store_action", -1]); _next_box removeAction (_next_box getVariable ["KP_crate_value_action", -1]); _next_box removeAction (_next_box getVariable ["KP_crate_push_action", -1]); + _next_box removeAction (_next_box getVariable ["KP_crate_carry_action", -1]); + _next_box removeAction (_next_box getVariable ["KP_crate_drop_action", -1]); } } foreach _managed_boxes; diff --git a/Missionframework/scripts/client/init_client.sqf b/Missionframework/scripts/client/init_client.sqf index adb30622f..69644cfa8 100644 --- a/Missionframework/scripts/client/init_client.sqf +++ b/Missionframework/scripts/client/init_client.sqf @@ -39,6 +39,12 @@ player addEventHandler ["GetInMan", {[_this select 2] spawn kp_fuel_consumption; player addEventHandler ["GetInMan", {[_this select 2] call KPLIB_fnc_setVehiclesSeized;}]; player addEventHandler ["GetInMan", {[_this select 2] call KPLIB_fnc_setVehicleCaptured;}]; player addEventHandler ["GetInMan", {[_this select 2] call kp_vehicle_permissions;}]; +player addEventHandler ["GetInMan", { + params ["_player"]; + // prevent players from getting into vehicles while carrying + if (isNull (_player getVariable ["KPLIB_carriedObject", objNull])) exitWith {}; + moveOut _player; +}]; player addEventHandler ["SeatSwitchedMan", {[_this select 2] call kp_vehicle_permissions;}]; player addEventHandler ["HandleRating", {if ((_this select 1) < 0) then {0};}]; diff --git a/Missionframework/stringtable.xml b/Missionframework/stringtable.xml index dbd98a68d..4d689bece 100644 --- a/Missionframework/stringtable.xml +++ b/Missionframework/stringtable.xml @@ -5109,6 +5109,14 @@ -- 군수물품 밀기 -- TLAČIT KRABICI + + -- CARRY CRATE + -- KISTE TRAGEN + + + -- DROP CRATE + -- KISTE ABLEGEN + -- STACK AND SORT -- STAPELN UND SORTIEREN