#58 ajout d'un item package servant à déployer des machines
This commit is contained in:
22
common/inventory/scripts/items/package.gd
Normal file
22
common/inventory/scripts/items/package.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends Item
|
||||
class_name Package
|
||||
|
||||
@export var scene: PackedScene
|
||||
|
||||
func _init(_scene : PackedScene = null):
|
||||
scene = _scene
|
||||
|
||||
func use_text() -> String:
|
||||
return "Build " + name
|
||||
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Area2D) -> bool:
|
||||
print(zone.global_position)
|
||||
return player.planet.is_in_zone(zone.global_position)
|
||||
|
||||
func use(player : Player, zone : Area2D) -> bool:
|
||||
print(zone.global_position)
|
||||
player.planet.instantiate_entity(scene, zone.global_position)
|
||||
return true
|
||||
1
common/inventory/scripts/items/package.gd.uid
Normal file
1
common/inventory/scripts/items/package.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b6kubqgq0k7vj
|
||||
Reference in New Issue
Block a user