* résolution du bug de disparition des items #94 * améliorations définitives dans le camion via compost #88 * ajout de plus d'aléatoire dans le zone de départ * suppression des récompenses de quota (pour l'instant) * équilibrage du gain en graine * ajout de la clarté dans les actions
45 lines
1.0 KiB
GDScript
45 lines
1.0 KiB
GDScript
extends InspectableEntity
|
|
class_name UndergroundLoot
|
|
|
|
const AREA_WIDTH = 20
|
|
const LOOTED_ITEM_RANDOM_RANGE = 50
|
|
|
|
const SPRITE_SCENE : PackedScene = preload("res://entities/underground_loot/underground_loot_sprite.tscn")
|
|
|
|
@export var loot : Array[Item]
|
|
|
|
@onready var sprite_object: Node2D = generate_sprite()
|
|
@onready var collision_shape: CollisionShape2D = generate_collision_shape()
|
|
|
|
|
|
func pointer_text() -> String:
|
|
return "Buried Loot"
|
|
|
|
func inspector_info() -> Inspector.Info:
|
|
return Inspector.Info.new(
|
|
"Buried Loot",
|
|
"Can contain some seeds from the past... Dig it with a shovel."
|
|
)
|
|
|
|
func generate_sprite() -> Node2D:
|
|
var object = SPRITE_SCENE.instantiate()
|
|
|
|
add_child(object)
|
|
|
|
return object
|
|
|
|
func generate_collision_shape() -> CollisionShape2D:
|
|
var collision = CollisionShape2D.new()
|
|
var shape = CircleShape2D.new()
|
|
shape.radius = AREA_WIDTH
|
|
|
|
collision.shape = shape
|
|
add_child(collision)
|
|
|
|
return collision
|
|
|
|
func dig():
|
|
for item in loot:
|
|
planet.drop_item(item, global_position, LOOTED_ITEM_RANDOM_RANGE)
|
|
queue_free()
|