Finished basic PickupableItem
This commit is contained in:
parent
63e87e86d5
commit
88c56f8aed
21 changed files with 163 additions and 35 deletions
|
@ -5,7 +5,7 @@ class_name WeaponPickupableResource
|
|||
## Weapon that will be added on interaction
|
||||
@export var weapon: PackedScene
|
||||
|
||||
func _apply(player: Player) -> bool:
|
||||
func _apply(player: Player) -> IdentifiedResource:
|
||||
var slot = player.weapons.first_free_slot()
|
||||
|
||||
# TODO: Implement proper swapping behavior when old or new weapon uses several slots
|
||||
|
@ -13,15 +13,11 @@ func _apply(player: Player) -> bool:
|
|||
slot = player.weapons.current_slot
|
||||
|
||||
var set_data = slot.set_weapon(weapon)
|
||||
set_data.old_weapon.id = id
|
||||
set_data.new_weapon.id = id
|
||||
|
||||
if slot == player.weapons.current_slot:
|
||||
player.weapons.refresh_current_slot()
|
||||
|
||||
return update_by_id(set_data.new_weapon)
|
||||
|
||||
# TODO: implement proper updating
|
||||
func update_by_id(new_id: StringName) -> bool:
|
||||
id = new_id
|
||||
|
||||
return id == ""
|
||||
var new_res = ResourceHandler.get_resource(set_data.old_weapon) as WeaponPickupableResource
|
||||
print(new_res)
|
||||
return new_res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue