fix(items): safe cast in _try_return_to_chest, typed chest state param, object_states reset
- Replace unsafe direct cast in HoldableItem._try_return_to_chest() with guarded as-cast - Type set_chest_state() parameter as Array[String] to match RoomChest._get_spawned_ids() - Add else-branch in apply_save_data() to reset _object_states when key absent - Rename test_save_data_has_version_two to test_save_data_has_version_three
This commit is contained in:
@@ -43,7 +43,10 @@ func _try_return_to_chest() -> bool:
|
||||
return false
|
||||
if global_position.distance_to(home_chest.global_position) >= CHEST_RETURN_RADIUS:
|
||||
return false
|
||||
(home_chest as RoomChest).receive_item(self)
|
||||
var chest: RoomChest = home_chest as RoomChest
|
||||
if chest == null:
|
||||
return false
|
||||
chest.receive_item(self)
|
||||
return true
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user