From 75a5cdc0cf240a70007ed53b770de41caf17894e Mon Sep 17 00:00:00 2001 From: autocommit Date: Thu, 16 Apr 2026 00:30:55 -0700 Subject: [PATCH] =?UTF-8?q?feat(management):=20=E2=9C=A8=20Add=20logic=20t?= =?UTF-8?q?o=20handle=20military=20unit=20properties=20in=20the=20item=20s?= =?UTF-8?q?ystem=20with=20new=20attributes=20and=20behaviors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../src/modules/management/item_system.gd | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/game/engine/src/modules/management/item_system.gd b/src/game/engine/src/modules/management/item_system.gd index 467ff410..e7105a56 100644 --- a/src/game/engine/src/modules/management/item_system.gd +++ b/src/game/engine/src/modules/management/item_system.gd @@ -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: