can drag / drop functions, localization

This commit is contained in:
commy2 2015-03-16 20:39:49 +01:00
parent 2da0eee1e2
commit 2aaef08c1d
5 changed files with 102 additions and 5 deletions

View File

@ -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};

View File

@ -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

View File

@ -45,7 +45,7 @@ if (_actionID != -1) then {
};
_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)),
nil,
20,

View File

@ -48,5 +48,5 @@ if (_type in _initializedClasses) exitWith {};
_initializedClasses pushBack _type;
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(drop)], "drp", "", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}, 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)], localize "STR_ACE_Dragging_Drop", "", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}, 2] call EFUNC(interact_menu,addClassAction);

View 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>