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:
parent
f8fb4b7a67
commit
75a5cdc0cf
1 changed files with 13 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue