fix: align loot feedback with pickup outcomes
This commit is contained in:
+10
-5
@@ -1274,9 +1274,9 @@ func _record_narrative_event(kind: StringName, event_id: StringName, payload: Di
|
||||
|
||||
func _process_ground_pickup() -> Array[TurnResult]:
|
||||
var pickup := run_state.inventory.pick_up_ground_item(game_state.floor_state, game_state.player.cell)
|
||||
var item: ItemInstance = pickup.item
|
||||
var item: ItemInstance = pickup.get("item", null)
|
||||
var result: TurnResult
|
||||
if bool(pickup.accepted):
|
||||
if bool(pickup.get("accepted", false)) and item != null:
|
||||
result = TurnResult.new(
|
||||
game_state.player.id,
|
||||
&"item_picked_up",
|
||||
@@ -1285,9 +1285,14 @@ func _process_ground_pickup() -> Array[TurnResult]:
|
||||
&"",
|
||||
0,
|
||||
"Picked up %s x%d." % [item.definition.name, item.quantity],
|
||||
{"item_id": item.definition.id, "instance_id": item.instance_id, "quantity": item.quantity, "stack_merged_into": pickup.stack_merged_into}
|
||||
{"item_id": item.definition.id, "instance_id": item.instance_id, "quantity": item.quantity, "stack_merged_into": pickup.get("stack_merged_into", &"")}
|
||||
)
|
||||
else:
|
||||
var reason := StringName(pickup.get("reason", &"no_ground_item"))
|
||||
var payload := {"reason": reason}
|
||||
if item != null:
|
||||
payload.merge({"item_id": item.definition.id, "instance_id": item.instance_id, "quantity": item.quantity}, true)
|
||||
var message := "Rien à ramasser." if reason == &"no_ground_item" else "Inventaire plein." if reason == &"capacity" else "Ramassage impossible."
|
||||
result = TurnResult.new(
|
||||
game_state.player.id,
|
||||
&"pickup_refused",
|
||||
@@ -1295,8 +1300,8 @@ func _process_ground_pickup() -> Array[TurnResult]:
|
||||
game_state.player.cell,
|
||||
&"",
|
||||
0,
|
||||
"Inventory is full.",
|
||||
{"item_id": item.definition.id, "instance_id": item.instance_id, "quantity": item.quantity, "reason": pickup.reason}
|
||||
message,
|
||||
payload
|
||||
)
|
||||
_resolve_player_action([result], false)
|
||||
return [result]
|
||||
|
||||
Reference in New Issue
Block a user