diff --git a/scenes/drop_area.gd b/scenes/drop_area.gd index cf489a3..9762d76 100644 --- a/scenes/drop_area.gd +++ b/scenes/drop_area.gd @@ -37,14 +37,17 @@ func _input(event): get_parent_with_type().dropped_on(area.get_parent_with_type()) _turn_off_highlights() dragged = false - if game.dragged_object: + game.dragged_object = null + elif game.dragged_object and game.dragged_object.has_method("try_play"): if hovered and highlighted: game.dragged_object.dropped_on(get_parent_with_type()) if event.button_index == BUTTON_LEFT and event.pressed and hovered: - if get_parent().type == "file" and get_parent().item_type == "wd": - dragged = true - _turn_on_highlights() + if not game.dragged_object: + if get_parent().type == "file" and get_parent().item_type == "wd": + dragged = true + game.dragged_object = self + _turn_on_highlights() func _set_highlighted(new_highlighted): highlighted = new_highlighted diff --git a/scenes/file_browser.tscn b/scenes/file_browser.tscn index 74a31ef..1eb48d0 100644 --- a/scenes/file_browser.tscn +++ b/scenes/file_browser.tscn @@ -127,6 +127,6 @@ margin_right = 20.0 margin_bottom = 20.0 [node name="DropArea" parent="." instance=ExtResource( 4 )] -position = Vector2( 121.101, 116.61 ) +position = Vector2( 79.9581, 82.3243 ) [connection signal="pressed" from="Panel/TextEdit/SaveButton" to="." method="save"] [connection signal="pressed" from="Panel/TextEdit/CloseButton" to="." method="close"] diff --git a/scenes/item.gd b/scenes/item.gd index 6628fb6..5b9872c 100644 --- a/scenes/item.gd +++ b/scenes/item.gd @@ -118,6 +118,6 @@ func dropped_on(other): if other.type == "inventory": file_browser.shell.run("take '%s'" % label) else: - other.shell.run("drop '%s'" % label) + other.shell.run("drop '%s' %d %d" % [label, rand_range(50, 400), rand_range(50, 200)]) file_browser.update() other.update() diff --git a/scenes/main.gd b/scenes/main.gd index ba57cba..2ee1cf1 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -45,19 +45,9 @@ func _ready(): # Load first chapter. load_chapter(current_chapter) - file_browser.grab_focus() inventory.shell = Shell.new() inventory.shell.cd(game.tmp_prefix + "inventory") - - -func _input(event): - if event.is_action_pressed("tab"): - print("ha") - if file_browser.has_focus(): - terminal.grab_focus() - else: - file_browser.grab_focus() func load_chapter(id): current_chapter = id @@ -156,8 +146,7 @@ func update_repos(): var repo = repositories[r] repo.update_everything() file_browser.update() - #index.update() - file_browser.grab_focus() + inventory.update() if levels.chapters[current_chapter].levels[current_level].check_win(): show_win_status() diff --git a/scripts/take b/scripts/take index 1aa490c..fed4b5b 100755 --- a/scripts/take +++ b/scripts/take @@ -3,3 +3,10 @@ echo "Taking $1!" mkdir -p ~/inventory mv "$1" ~/inventory + +X=50 +for file in ~/inventory/*; do + echo "x = $X" > $file + echo "y = 50" >> $file + X=$(expr $X + 100) +done