context menu added

player can find food and eat it
This commit is contained in:
Nikolai Fesenko
2025-08-20 16:45:03 +02:00
parent 9bab0ff0f3
commit a0efc6b9b8
11 changed files with 131 additions and 15 deletions

View File

@@ -1,6 +1,27 @@
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