Started buildings undo system implementation

This commit is contained in:
2024-07-26 13:44:03 +03:00
parent 42ac0f19ca
commit e30e1ed2d8
4 changed files with 39 additions and 12 deletions

View File

@@ -17,6 +17,7 @@ func _ready():
$"%select_poi",
$"%select_road_lines",
$"%select_npc",
$"%buildings_save",
]:
b.connect("pressed", $WorldEditor, "editor_command", [b.name, []])
$WorldEditor.connect("editor_event", self, "editor_event")
@@ -120,8 +121,9 @@ func check_edit_building():
print("get closest building")
$WorldEditor.editor_command("get_closest_building", [Transform(Basis(), proj)])
elif Input.is_action_pressed("mouse1"):
# Moving buildings
if $"%buildings_edit_mode".selected == 1:
if drag_delay < 0.0:
if drag_delay < 0.0 && !dragging:
dragging = true
var position = get_viewport().get_mouse_position()
var camera = get_viewport().get_camera()
@@ -132,8 +134,8 @@ func check_edit_building():
var result = space_state.intersect_ray(start, end, [], 1 << 15, false, true)
if result.has("collider"):
var proj = result.position
if $"%buildings_edit_mode".selected == 1:
drag_start = proj
drag_start = proj
$WorldEditor.editor_command("buildings_checkpoint", [])
else:
drag_delay -= get_process_delta_time()
else: