added poses for items in shelf
This commit is contained in:
@@ -3,12 +3,15 @@ extends Interactable
|
||||
|
||||
var test: bool = false
|
||||
|
||||
@export var items_pos_master: Node
|
||||
var item_poses: Array
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
max_person_using = 1
|
||||
can_store = true
|
||||
func _ready() -> void:
|
||||
self.owner = $".."
|
||||
print(self)
|
||||
#object_placed.connect(_on_object_placed.bind(self))
|
||||
|
||||
|
||||
@@ -20,14 +23,29 @@ func start_action(person, object):
|
||||
|
||||
|
||||
func give_out(person):
|
||||
var pose = get_item_pose(person.target_item)
|
||||
pose.remove_item()
|
||||
person.hold_item(person.target_item)
|
||||
stored_items.erase(person.target_item)
|
||||
|
||||
|
||||
func add_item(item):
|
||||
stored_items.append(item)
|
||||
print(item_poses)
|
||||
for pose in item_poses:
|
||||
if pose.is_free:
|
||||
pose.add_item(item)
|
||||
break
|
||||
|
||||
|
||||
func get_item_pose(item):
|
||||
for pose in item_poses:
|
||||
if pose.item == item:
|
||||
return pose
|
||||
return null
|
||||
|
||||
func create():
|
||||
for pose in items_pos_master.get_children():
|
||||
item_poses.append(pose)
|
||||
var newItem = ItemManager.get_item(0).instantiate()
|
||||
ItemManager.add_shelf(self)
|
||||
ItemManager.add_item_to_shelf(self, newItem)
|
||||
|
||||
Reference in New Issue
Block a user