36 lines
1.0 KiB
GDScript
36 lines
1.0 KiB
GDScript
extends StaticBody3D
|
|
## Your X, on the ground (treasure.gd): a mound of loose earth by a marker
|
|
## stone, with two sticks crossed in it. It answers like a boulder does
|
|
## (Actions.harvest_hit), so a pickaxe digs it; the treasure decides the rest.
|
|
|
|
var treasure: Node3D
|
|
var owner_id := ""
|
|
var uid := ""
|
|
var tool_kind := "pickaxe"
|
|
var min_tier := 1
|
|
var max_hp := 18.0
|
|
var hp := 18.0
|
|
var depleted := false
|
|
var kind := "rock"
|
|
var chip_color := Color(0.36, 0.27, 0.18)
|
|
|
|
func display_name() -> String:
|
|
return "Loose earth"
|
|
|
|
func refusal() -> String:
|
|
return ""
|
|
|
|
func interact_prompt(_player: Node) -> String:
|
|
return "Loose earth by a marker stone: X marks the spot. [LMB] Dig with a pickaxe (about %d blows left)" % ceili(hp)
|
|
|
|
func interact(player: Node) -> void:
|
|
Actions.tell(player, interact_prompt(player))
|
|
|
|
## One blow (from Actions.harvest_hit).
|
|
func hit(damage: float, _at: Vector3, _from: Vector3) -> Dictionary:
|
|
hp = maxf(hp - damage, 0.0)
|
|
treasure.mound_hit(self)
|
|
if hp <= 0.0 and not depleted:
|
|
depleted = true
|
|
return {}
|