forked from Giallustio/HeartsAndMinds
-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from 1kuemmel1/ADD-overhaul_place_options
Add: Expand place options
- Loading branch information
Showing
6 changed files
with
157 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,69 @@ | ||
|
||
private ["_bbr","_c"]; | ||
|
||
btc_log_placing_obj = _this; | ||
|
||
[btc_log_placing_obj,player] remoteExec ["btc_fnc_set_owner", 2]; | ||
|
||
hint composeText [ | ||
(localize "STR_BTC_HAM_LOG_PLACE_HINT1"), //Q/Z to raise/lower the object | ||
localize "STR_BTC_HAM_LOG_PLACE_HINT1", //Q/Z to raise/lower the object | ||
lineBreak, | ||
localize "STR_BTC_HAM_LOG_PLACE_HINT2", //X/C to rotate the object | ||
lineBreak, | ||
(localize "STR_BTC_HAM_LOG_PLACE_HINT2"), //X/C to rotate the object | ||
localize "STR_BTC_HAM_LOG_PLACE_HINT3", //F/R to tilt the object | ||
lineBreak, | ||
(localize "STR_BTC_HAM_LOG_PLACE_HINT3") //X/C to rotate the object | ||
localize "STR_BTC_HAM_LOG_PLACE_HINT4" //SHIFT to increase the movement | ||
]; | ||
|
||
btc_log_placing = true; | ||
btc_log_placing_dir = 180; | ||
btc_log_release = player addAction [("<t color=""#ED2744"">" + (localize "STR_BTC_HAM_LOG_PLACE_RELEASE") + "</t>"),{btc_log_placing = false;}, [], 9, true, false, "", "true"]; //Release | ||
btc_log_rotating_dir = 0; | ||
btc_log_ptich_dir = 0; | ||
|
||
//add action ACE | ||
[player, "DefaultAction", {true}, {btc_log_placing = false;}] call ace_common_fnc_addActionEventHandler; | ||
|
||
//show mouse hint for release | ||
[localize "STR_BTC_HAM_LOG_PLACE_RELEASE",""] call ace_interaction_fnc_showMouseHint; //Release | ||
|
||
//add actions to keys | ||
btc_log_place_EH_keydown = (findDisplay 46) displayAddEventHandler ["KeyDown", btc_fnc_log_place_key_down]; | ||
|
||
[player] call ace_weaponselect_fnc_putWeaponAway; | ||
player forceWalk true; | ||
|
||
btc_log_placing_obj enableSimulation false; | ||
|
||
_bbr = boundingBoxReal btc_log_placing_obj; | ||
_c = boundingCenter btc_log_placing_obj; | ||
private _bbr = boundingBoxReal btc_log_placing_obj; | ||
private _c = boundingCenter btc_log_placing_obj; | ||
|
||
btc_log_placing_h = (abs ((_bbr select 0) select 2)) - (_c select 2); | ||
btc_log_placing_d = 1.5 + (abs (((_bbr select 1) select 1) - ((_bbr select 0) select 1))); | ||
|
||
btc_log_placing_obj attachTo [player,[0,(btc_log_placing_d),btc_log_placing_h]]; | ||
btc_log_placing_obj setDir btc_log_placing_dir; | ||
btc_log_placing_obj setDir btc_log_rotating_dir; | ||
|
||
[{ | ||
params ["_arguments", "_idPFH"]; | ||
if (!alive player || player getVariable ["ACE_isUnconscious",false] || !btc_log_placing) then { | ||
|
||
btc_log_placing_obj enableSimulation true; | ||
detach btc_log_placing_obj; | ||
|
||
//save to DB | ||
[btc_log_placing_obj] call btc_fnc_db_saveObjectStatus; | ||
//btc_log_obj_created pushBack btc_log_placing_obj; | ||
|
||
player forceWalk false; | ||
|
||
btc_log_placing_obj = objNull; | ||
(findDisplay 46) displayRemoveEventHandler ["KeyDown",btc_log_place_EH_keydown]; | ||
|
||
hintSilent ""; | ||
|
||
waitUntil {!alive player || player getVariable ["ACE_isUnconscious",false] || !btc_log_placing}; | ||
//remove mouse hint | ||
call ace_interaction_fnc_hideMouseHint; | ||
|
||
btc_log_placing_obj enableSimulation true; | ||
detach btc_log_placing_obj; | ||
player forceWalk false; | ||
//remove PFH | ||
[_idPFH] call CBA_fnc_removePerFrameHandler; | ||
|
||
btc_log_placing_obj = objNull; | ||
(findDisplay 46) displayRemoveEventHandler ["KeyDown",btc_log_place_EH_keydown]; | ||
player removeAction btc_log_release; | ||
hintSilent ""; | ||
}; | ||
}, 0.5, [_this]] call CBA_fnc_addPerFrameHandler; |
93 changes: 74 additions & 19 deletions
93
=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/log/place_key_down.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,80 @@ | ||
/* | ||
16 Q | ||
44 Z | ||
30 A | ||
32 D | ||
45 X | ||
46 C | ||
DIK_KeyCodes: https://community.bistudio.com/wiki/DIK_KeyCodes | ||
*/ | ||
params ["_display","_key","_shift","_ctrl","_alt",["_keyPressed",false]]; | ||
|
||
private ["_key","_shift","_ctrl","_alt","_turbo"]; | ||
private _turbo = if (_shift) then {1} else {0}; | ||
|
||
_key = _this select 1; | ||
_shift = _this select 2; | ||
_ctrl = _this select 3; | ||
_alt = _this select 4; | ||
//height [+] (Key 16: Q) | ||
if (_key isEqualTo 16) then { | ||
//check for max height | ||
if !(btc_log_placing_h > btc_log_placing_max_h) then { | ||
//increase height | ||
btc_log_placing_h = btc_log_placing_h + 0.1 + (_turbo/2); | ||
//placing | ||
btc_log_placing_obj attachTo [player,[0,btc_log_placing_d,btc_log_placing_h]]; | ||
}; | ||
//set var | ||
_keyPressed = true; | ||
}; | ||
//height [-] (Key 44: Z*) (*German keyboard: Y) | ||
if (_key isEqualTo 44) then { | ||
//check for min height | ||
if !(btc_log_placing_h < - 2) then { | ||
//decrease heigth | ||
btc_log_placing_h = btc_log_placing_h - 0.1 - (_turbo/2); | ||
//placing | ||
btc_log_placing_obj attachTo [player,[0,btc_log_placing_d,btc_log_placing_h]]; | ||
}; | ||
//set var | ||
_keyPressed = true; | ||
}; | ||
//yaw [+] (Key 45: X) | ||
if (_key isEqualTo 45) then { | ||
//rotating clockwise | ||
btc_log_placing_dir = btc_log_placing_dir + 0.5 + _turbo; | ||
//set var | ||
_keyPressed = true; | ||
}; | ||
//yaw [-] (Key 46: C) | ||
if (_key isEqualTo 46) then { | ||
//rotating counterclockwise | ||
btc_log_placing_dir = btc_log_placing_dir - 0.5 - _turbo; | ||
//set var | ||
_keyPressed = true; | ||
}; | ||
//roll [+] (Key 33: F) | ||
if (_key isEqualTo 33) then { | ||
//tilting clockwise | ||
btc_log_rotating_dir = btc_log_rotating_dir + 0.5 + _turbo; | ||
//set var | ||
_keyPressed = true; | ||
}; | ||
//roll [-] (Key 19: R) | ||
if (_key isEqualTo 19) then { | ||
//tilting counterclockwise | ||
btc_log_rotating_dir = btc_log_rotating_dir - 0.5 - _turbo; | ||
//set var | ||
_keyPressed = true; | ||
}; | ||
|
||
_turbo = if (_shift) then {1} else {0}; | ||
//set object position (rotation and tilting) | ||
if (_keyPressed) then { | ||
btc_log_placing_obj setVectorDirAndUp [ | ||
[ | ||
(sin btc_log_placing_dir) * (cos btc_log_ptich_dir), | ||
(cos btc_log_placing_dir) * (cos btc_log_ptich_dir), | ||
(sin btc_log_ptich_dir) | ||
], | ||
[ | ||
[ | ||
(sin btc_log_rotating_dir), | ||
(-sin btc_log_ptich_dir), | ||
(cos btc_log_rotating_dir * cos btc_log_ptich_dir) | ||
], | ||
-btc_log_placing_dir | ||
] call BIS_fnc_rotateVector2D | ||
]; | ||
}; | ||
|
||
switch (true) do { | ||
case (_key == 16) : {if (btc_log_placing_h > btc_log_placing_max_h) exitWith {true};btc_log_placing_h = btc_log_placing_h + 0.1 + (_turbo/2);btc_log_placing_obj attachTo [player,[0,btc_log_placing_d,btc_log_placing_h]];true}; | ||
case (_key == 44) : {if (btc_log_placing_h < - 2) exitWith {true};btc_log_placing_h = btc_log_placing_h - 0.1 - (_turbo/2);btc_log_placing_obj attachTo [player,[0,btc_log_placing_d,btc_log_placing_h]];true}; | ||
case (_key == 45) : {btc_log_placing_dir = btc_log_placing_dir + 0.5 + _turbo;btc_log_placing_obj setDir btc_log_placing_dir;true}; | ||
case (_key == 46) : {btc_log_placing_dir = btc_log_placing_dir - 0.5 - _turbo;btc_log_placing_obj setDir btc_log_placing_dir;true}; | ||
default {false}; | ||
}; | ||
_keyPressed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters