feat(management): Add logic to handle military unit properties in the item system with new attributes and behaviors

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-16 00:30:55 -07:00
parent f8fb4b7a67
commit 75a5cdc0cf

View file

@ -99,12 +99,20 @@ static func drop_all_loot(unit: RefCounted, tile: Resource) -> void:
var gd: RefCounted = _gd_items()
if gd == null:
return
var ground: Array = tile.get("ground_loot") if "ground_loot" in tile else []
var equipped_raw: Array = unit.get("equipped_items")
var ground_raw: Array = tile.get("ground_loot") if "ground_loot" in tile else []
if equipped_raw.is_empty() and ground_raw.is_empty():
return
var equipped_typed: Array[Dictionary] = []
for e: Variant in equipped_raw:
if e is Dictionary:
equipped_typed.append(e)
var ground_typed: Array[Dictionary] = []
for g: Variant in ground_raw:
if g is Dictionary:
ground_typed.append(g)
var result: Dictionary = gd.call(
"drop_all_loot",
unit.get("equipped_items"),
ground,
_decay_turns(),
"drop_all_loot", equipped_typed, ground_typed, _decay_turns()
)
unit.set("equipped_items", result.get("equipped", []))
if "ground_loot" in tile: