Skip to content

Commit

Permalink
Building time limit notification is now Paradigm based
Browse files Browse the repository at this point in the history
  • Loading branch information
FightKnight441 committed Sep 10, 2024
1 parent d01e591 commit 1951bb4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions client/functions/basebuilding/fn_abort_building.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ if (!isNil "para_l_placing_keyrotate_handler") then {
para_l_placing_keyrotate_handler = nil;
};

if (!(isNil "para_l_placing_scroll_handler")) then {
(findDisplay 46) displayRemoveEventHandler ["MouseZChanged", para_l_placing_scroll_handler];
para_l_placing_keyrotate_handler = nil;
};

false;
31 changes: 30 additions & 1 deletion client/functions/basebuilding/fn_place_object.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,43 @@ para_l_placing_click_handler = (findDisplay 46) displayAddEventHandler ["MouseBu
};
}];

// Adding key handler for rotation by 45 degrees (R key)
// Adding key handler for rotation by 45 degrees (R key) -Legend
para_l_placing_keyrotate_handler = (findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_displayorcontrol", "_keyCode"];
if (!scriptDone para_l_placing_script && _keyCode in [0x13]) then { // 0x13 is the 'R' key
para_l_placing_final_rotation = para_l_placing_final_rotation + 45;
};
}];

// Update the event handler for the mouse scroll wheel, only works whilst holding ALT, probably due to "if (freeLook) exitWith {};" -FightKnight
para_l_placing_scroll_handler = (findDisplay 46) displayAddEventHandler ["MouseZChanged", {
params ["_displayorcontrol", "_scroll_sign"];

if (!scriptDone para_l_placing_script) then {
switch (para_l_placing_mode) do {
// Mode 0 - Adjust object position distance
// need to find out how to add distance that you are facing
case 0: {
private _increment_position = _scroll_sign * 1; // Adjust distance by +- 1/2 meter
para_l_placing_center_pos = para_l_placing_center_pos vectorAdd [0, _increment_position, 0];
};

// Mode 1 - Adjust object rotation
case 1: {
private _increment_rotation = _scroll_sign * 2; // Adjust rotation by +- 1 degrees
para_l_placing_final_rotation = para_l_placing_final_rotation + _increment_rotation;
};

// Mode 2 - Adjust object height
case 2: {
private _increment_height = _scroll_sign * .25; // Adjust height increment by +- 1/4 meter
para_l_placing_height = para_l_placing_height + _increment_height;
para_l_placing_center_pos set [2, para_l_placing_height];
};
};
};
}];

para_l_placing_mode = 0;
para_l_placing_center_pos = [0,0,0];
para_l_placing_last_player_dir = getDir player;
Expand Down

0 comments on commit 1951bb4

Please sign in to comment.