Updated item_generator code to emit gen started/finished signals. hooked up level to play drill animations though the anim player is missing the actual animation
This commit is contained in:
parent
e433f3851b
commit
5e857e478e
@ -3,13 +3,16 @@
|
||||
[ext_resource path="res://scripts/cheat_menu.gd" type="Script" id=1]
|
||||
|
||||
[node name="cheat_menu" type="WindowDialog"]
|
||||
margin_right = 429.0
|
||||
margin_bottom = 336.0
|
||||
anchor_right = 0.223
|
||||
anchor_bottom = 0.451
|
||||
margin_right = 0.839996
|
||||
margin_bottom = -0.0800476
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_bottom = 1.0
|
||||
tab_align = 0
|
||||
|
||||
[node name="Player" type="VBoxContainer" parent="TabContainer"]
|
||||
@ -31,34 +34,10 @@ margin_right = 421.0
|
||||
margin_bottom = 44.0
|
||||
text = "+5 Charge"
|
||||
|
||||
[node name="raw_yam" type="Button" parent="TabContainer/Player"]
|
||||
[node name="clear" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 48.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 68.0
|
||||
text = "Raw Yam"
|
||||
|
||||
[node name="cooked_yam" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 72.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 92.0
|
||||
text = "Cooked Yam"
|
||||
|
||||
[node name="ore" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 96.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 116.0
|
||||
text = "Ore"
|
||||
|
||||
[node name="repair_kit" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 120.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 140.0
|
||||
text = "Repair Kit"
|
||||
|
||||
[node name="clear" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 120.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 140.0
|
||||
text = "Clear Held Item"
|
||||
|
||||
[node name="Events" type="VBoxContainer" parent="TabContainer"]
|
||||
@ -82,10 +61,6 @@ text = "Day Timer 00:02"
|
||||
|
||||
[connection signal="pressed" from="TabContainer/Player/charge" to="." method="_on_charge_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/charge_5" to="." method="_on_charge_5_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/raw_yam" to="." method="_on_raw_yam_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/cooked_yam" to="." method="_on_cooked_yam_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/ore" to="." method="_on_ore_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/repair_kit" to="." method="_on_repair_kit_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/clear" to="." method="_on_clear_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Events/random_damage" to="." method="_on_random_damage_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Events/timer_2_s" to="." method="_on_timer_2_s_pressed"]
|
||||
|
@ -443,5 +443,7 @@ time_per_day = 300.0
|
||||
[connection signal="player_exited" from="cameras/camera_comms" to="cameras" method="_on_camera_room_player_exited"]
|
||||
[connection signal="player_entered" from="cameras/camera_hydroponics" to="cameras" method="_on_camera_room_player_entered"]
|
||||
[connection signal="player_exited" from="cameras/camera_hydroponics" to="cameras" method="_on_camera_room_player_exited"]
|
||||
[connection signal="gen_finished" from="Ore_Conveyor_Room/item_generator" to="Level" method="_on_item_generator_gen_finished"]
|
||||
[connection signal="gen_started" from="Ore_Conveyor_Room/item_generator" to="Level" method="_on_item_generator_gen_started"]
|
||||
|
||||
[editable path="Level"]
|
||||
|
@ -9,3 +9,11 @@ func start_drill():
|
||||
|
||||
func stop_drill():
|
||||
$AnimationPlayer.play("Excavator Reset")
|
||||
|
||||
|
||||
func _on_item_generator_gen_started():
|
||||
start_drill()
|
||||
|
||||
|
||||
func _on_item_generator_gen_finished():
|
||||
stop_drill()
|
||||
|
@ -1,7 +1,9 @@
|
||||
extends WindowDialog
|
||||
|
||||
const ItemDir = "res://item_types"
|
||||
onready var player = get_tree().get_nodes_in_group("player")[0]
|
||||
|
||||
var initialized : bool = false
|
||||
|
||||
func _unhandled_key_input(event):
|
||||
if event.is_action_pressed("open_debug"):
|
||||
if visible:
|
||||
@ -15,18 +17,6 @@ func _on_charge_pressed():
|
||||
func _on_charge_5_pressed():
|
||||
player.modify_inventory("coins", 5)
|
||||
|
||||
func _on_raw_yam_pressed():
|
||||
player.pick_up_item(preload("res://item_types/raw_yam.tres").spawn_node())
|
||||
|
||||
func _on_cooked_yam_pressed():
|
||||
player.pick_up_item(preload("res://item_types/cooked_yam.tres").spawn_node())
|
||||
|
||||
func _on_ore_pressed():
|
||||
player.pick_up_item(preload("res://item_types/ore.tres").spawn_node())
|
||||
|
||||
func _on_repair_kit_pressed():
|
||||
player.pick_up_item(preload("res://item_types/repair_kit.tres").spawn_node())
|
||||
|
||||
func _on_clear_pressed():
|
||||
if player.has_item():
|
||||
player.drop_item_in_hand()
|
||||
@ -37,9 +27,40 @@ func _on_random_damage_pressed():
|
||||
return
|
||||
damageable[randi() % damageable.size()].take_damage()
|
||||
|
||||
|
||||
func _on_timer_2_s_pressed():
|
||||
var game_manager = get_tree().get_nodes_in_group("game_manager")[0]
|
||||
var day_timer = game_manager.get_node("day_timer")
|
||||
day_timer.start(2.0)
|
||||
day_timer.wait_time = game_manager.time_per_day
|
||||
|
||||
func popup(bounds : Rect2 = Rect2(0,0,0,0)):
|
||||
if !initialized:
|
||||
load_item_add_buttons()
|
||||
.popup(bounds)
|
||||
|
||||
func load_item_add_buttons():
|
||||
var dir = Directory.new()
|
||||
dir.open(ItemDir)
|
||||
dir.list_dir_begin()
|
||||
var file_name = dir.get_next()
|
||||
while(file_name!=""):
|
||||
if dir.current_is_dir():
|
||||
pass
|
||||
else:
|
||||
var button : Button = Button.new()
|
||||
button.text = file_name
|
||||
button.connect("button_down", self, "on_item_button_down", [file_name])
|
||||
$TabContainer/Player.add_child(button)
|
||||
file_name = dir.get_next()
|
||||
var button : Button = Button.new()
|
||||
button.text = "Close"
|
||||
$TabContainer/Player.add_child(button)
|
||||
button.connect("button_down", self, "on_close_button_down")
|
||||
initialized = true
|
||||
|
||||
func on_item_button_down(file_name : String):
|
||||
var path : String = ItemDir + "/" + file_name
|
||||
player.pick_up_item(load(path).spawn_node())
|
||||
|
||||
func on_close_button_down():
|
||||
hide()
|
||||
|
@ -1,4 +1,6 @@
|
||||
extends Damageable
|
||||
signal gen_started
|
||||
signal gen_finished
|
||||
|
||||
enum EState {IDLE, WORKING, BLOCKED, BROKEN, NUM_STATES}
|
||||
|
||||
|
@ -16,6 +16,7 @@ func enter_from(state):
|
||||
ctx.progress_text.text = "Progress: 0%"
|
||||
ctx.status_light.activate()
|
||||
ctx.gen_timer.start()
|
||||
ctx.emit_signal("gen_started")
|
||||
|
||||
func exit_to(state):
|
||||
pass
|
||||
@ -36,6 +37,7 @@ func on_gen_timer_timeout():
|
||||
item_slot.spawn_item(ctx.gen_item)
|
||||
count += 1
|
||||
item_slot.add_enabled = true
|
||||
ctx.emit_signal("gen_finished")
|
||||
ctx.change_state(ctx.States[ctx.EState.BLOCKED].new("Finished!"))
|
||||
|
||||
func on_item_slot_item_changed(item):
|
||||
|
Loading…
x
Reference in New Issue
Block a user