31 lines
770 B
GDScript
31 lines
770 B
GDScript
extends Node
|
|
|
|
func get_context_buttons():
|
|
var buttons = Array()
|
|
# go eat
|
|
var go_eat_button = Button.new()
|
|
go_eat_button.text = "Go Eat"
|
|
go_eat_button.pressed.connect(go_eat)
|
|
buttons.append(go_eat_button)
|
|
|
|
return buttons
|
|
|
|
func go_eat():
|
|
print("I will go eat")
|
|
print(Global.object_selected)
|
|
var selected_person = Global.object_selected
|
|
selected_person.target_action = "eat"
|
|
var result = ItemManager.set_person_target_item(selected_person, "food")
|
|
if result == null:
|
|
print("I cant find food")
|
|
else:
|
|
print("I found food")
|
|
Global.hide_context_menu.emit()
|
|
|
|
func sleep(person, object, action):
|
|
person.action = action
|
|
person.timer.wait_time = 2.0
|
|
person.timer.one_shot = true
|
|
person.timer.start()
|
|
person.timer.timeout.connect(person._on_timer_timeout)
|