feat: add ranged combat targeting
This commit is contained in:
@@ -32,6 +32,10 @@ var ai_behavior: StringName = &"legacy"
|
||||
# global-chase behavior while catalog-backed enemies overwrite this value.
|
||||
var vision_range := 99
|
||||
var attack_range := 1
|
||||
# C4 retains equipment as data definitions until the inventory slice owns it.
|
||||
# The active ranged definition is enough to resolve targeting safely now.
|
||||
var ranged_weapon: Dictionary = {}
|
||||
var ammunition := 0
|
||||
var wounds: LimbWounds
|
||||
|
||||
func _init(new_id: StringName, new_cell: Vector2i, new_hit_points: int, new_attack_damage: int, new_content_id: StringName = &"", combat_data: Dictionary = {}) -> void:
|
||||
@@ -60,6 +64,13 @@ func _init(new_id: StringName, new_cell: Vector2i, new_hit_points: int, new_atta
|
||||
attack_range = int(combat_data.get("range", combat_data.get("attack_range", attack_range)))
|
||||
wounds = LimbWoundsType.new()
|
||||
|
||||
func equip_ranged_weapon(definition: Dictionary, ammunition_count: int) -> void:
|
||||
if StringName(definition.get("weapon_kind", "")) != &"ranged":
|
||||
push_warning("Only ranged weapon definitions can be equipped for ranged combat.")
|
||||
return
|
||||
ranged_weapon = definition.duplicate(true)
|
||||
ammunition = maxi(0, ammunition_count)
|
||||
|
||||
func is_alive() -> bool:
|
||||
return hit_points > 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user