mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
can drag / drop functions, localization
This commit is contained in:
parent
2da0eee1e2
commit
2aaef08c1d
@ -1 +1,23 @@
|
|||||||
true
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
*
|
||||||
|
* Check if unit can drag the object. Doesn't check weight.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Unit that should do the dragging (Object)
|
||||||
|
* 1: Object to drag (Object)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Can the unit drag the object? (Bool)
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit", "_target"];
|
||||||
|
|
||||||
|
_unit = _this select 0;
|
||||||
|
_target = _this select 1;
|
||||||
|
|
||||||
|
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
|
||||||
|
// a static weapon has to be empty for dragging
|
||||||
|
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||||
|
@ -1 +1,22 @@
|
|||||||
true
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
*
|
||||||
|
* Check if unit can drop the object.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Unit that currently drags a object (Object)
|
||||||
|
* 1: Object that is dragged (Object)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Can the unit drop the object? (Bool)
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit", "_target"];
|
||||||
|
|
||||||
|
_unit = _this select 0;
|
||||||
|
_target = _this select 1;
|
||||||
|
|
||||||
|
if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
|
||||||
|
_unit getVariable [QGVAR(draggedObject), objNull] == _target
|
||||||
|
@ -45,7 +45,7 @@ if (_actionID != -1) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_actionID = _unit addAction [
|
_actionID = _unit addAction [
|
||||||
format ["<t color='#FF0000'>%1</t>", "STR_AGM_Drag_EndDrag"],
|
format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Dragging_Drop"],
|
||||||
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)),
|
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)),
|
||||||
nil,
|
nil,
|
||||||
20,
|
20,
|
||||||
|
@ -48,5 +48,5 @@ if (_type in _initializedClasses) exitWith {};
|
|||||||
_initializedClasses pushBack _type;
|
_initializedClasses pushBack _type;
|
||||||
GVAR(initializedClasses) = _initializedClasses;
|
GVAR(initializedClasses) = _initializedClasses;
|
||||||
|
|
||||||
[_type, 0, ["ACE_MainActions", QGVAR(drag)], "drg", "", "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}, 2] call EFUNC(interact_menu,addClassAction);
|
[_type, 0, ["ACE_MainActions", QGVAR(drag)], localize "STR_ACE_Dragging_Drag", "", "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}, 2] call EFUNC(interact_menu,addClassAction);
|
||||||
[_type, 0, ["ACE_MainActions", QGVAR(drop)], "drp", "", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}, 2] call EFUNC(interact_menu,addClassAction);
|
[_type, 0, ["ACE_MainActions", QGVAR(drop)], localize "STR_ACE_Dragging_Drop", "", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}, 2] call EFUNC(interact_menu,addClassAction);
|
||||||
|
54
addons/dragging/stringtable.xml
Normal file
54
addons/dragging/stringtable.xml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Edited with tabler - 2014-12-21 -->
|
||||||
|
<Project name="ACE">
|
||||||
|
<Package name="Dragging">
|
||||||
|
<Key ID="STR_ACE_Dragging_Drag">
|
||||||
|
<English>Drag</English>
|
||||||
|
<Russian>Тащить</Russian>
|
||||||
|
<Spanish>Arrastrar</Spanish>
|
||||||
|
<Polish>Ciągnij</Polish>
|
||||||
|
<Czech>Táhnout</Czech>
|
||||||
|
<French>Tracter</French>
|
||||||
|
<German>Ziehen</German>
|
||||||
|
<Portuguese>Arrastar</Portuguese>
|
||||||
|
<Italian>Trascina</Italian>
|
||||||
|
<Hungarian>Húzás</Hungarian>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Dragging_Drop">
|
||||||
|
<English>Release</English>
|
||||||
|
<Russian>Отпустить</Russian>
|
||||||
|
<Spanish>Soltar</Spanish>
|
||||||
|
<Polish>Puść</Polish>
|
||||||
|
<Czech>Položit</Czech>
|
||||||
|
<French>Lâcher</French>
|
||||||
|
<German>Loslassen</German>
|
||||||
|
<Portuguese>Largar</Portuguese>
|
||||||
|
<Italian>Lascia</Italian>
|
||||||
|
<Hungarian>Elengedés</Hungarian>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Dragging_UnableToDrag">
|
||||||
|
<English>Unable to drag item due to weight</English>
|
||||||
|
<Russian>Слишком тяжелый предмет</Russian>
|
||||||
|
<Spanish>No se puede arrastrar el objeto debido a su peso</Spanish>
|
||||||
|
<Polish>Nie można ciągnąć tego przedmiotu z powodu jego wagi</Polish>
|
||||||
|
<Czech>Předmět je příliž těžký!</Czech>
|
||||||
|
<French>Trop lourd pour être tracté</French>
|
||||||
|
<German>Dieser Gegenstand kann nicht gezogen werden, da er zu schwer ist.</German>
|
||||||
|
<Portuguese>Não é possível carregar o item devido a seu peso</Portuguese>
|
||||||
|
<Italian>Non è possibile trascinare l'oggetto a causa del suo peso</Italian>
|
||||||
|
<Hungarian>Túl nehéz ahhoz, hogy elhúzd</Hungarian>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Dragging_Carry">
|
||||||
|
<English>Carry</English>
|
||||||
|
<German>Tragen</German>
|
||||||
|
<Spanish>Portar</Spanish>
|
||||||
|
<Polish>Nieś</Polish>
|
||||||
|
<French>Porter</French>
|
||||||
|
<Czech>Nést</Czech>
|
||||||
|
<Portuguese>Carregar</Portuguese>
|
||||||
|
<Italian>Trascina</Italian>
|
||||||
|
<Hungarian>Felvesz</Hungarian>
|
||||||
|
<Russian>Нести</Russian>
|
||||||
|
</Key>
|
||||||
|
</Package>
|
||||||
|
</Project>
|
Loading…
Reference in New Issue
Block a user