Complete lab, quest, garrison, and energy tickets
This commit is contained in:
parent
d413d1da9f
commit
0f7edff15a
20 changed files with 238 additions and 45 deletions
26
core/CombatTarget.gd
Normal file
26
core/CombatTarget.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
class_name CombatTarget
|
||||
extends RefCounted
|
||||
|
||||
# One opt-in contract for anything a player weapon may deliberately attack.
|
||||
# Aim assist, autonomous garrisons and projectile impacts all consume the same
|
||||
# group, so a new target composition does not need a concrete-type branch in
|
||||
# each combat system.
|
||||
const GROUP: StringName = &"player_weapon_targets"
|
||||
const PRIORITY_META: StringName = &"player_weapon_target_priority"
|
||||
|
||||
# A garrison protects its post before mining nearby debris. Distances still
|
||||
# decide between targets at the same priority.
|
||||
const RESOURCE_PRIORITY: int = 0
|
||||
const DANGER_PRIORITY: int = 100
|
||||
|
||||
|
||||
static func register(node: Node, priority: int = RESOURCE_PRIORITY) -> void:
|
||||
if node == null:
|
||||
return
|
||||
node.add_to_group(GROUP)
|
||||
node.set_meta(PRIORITY_META, priority)
|
||||
|
||||
|
||||
static func priority(node: Node) -> int:
|
||||
return int(node.get_meta(PRIORITY_META, RESOURCE_PRIORITY)) if node != null \
|
||||
else RESOURCE_PRIORITY
|
||||
Loading…
Reference in a new issue