added more spell effects, fixed bomb effects, allow to pickup bomb...
This commit is contained in:
@@ -408,6 +408,28 @@ func can_be_thrown() -> bool:
|
||||
func can_be_destroyed() -> bool:
|
||||
return is_destroyable
|
||||
|
||||
func _is_wooden_burnable() -> bool:
|
||||
var t = object_type if object_type != "" else _get_configured_object_type()
|
||||
return t in ["Box", "Pot", "LiftableBarrel", "PushableBarrel", "PushableHighBox"]
|
||||
|
||||
func take_fire_damage(amount: float, _attacker_position: Vector2) -> void:
|
||||
if not is_destroyable or is_broken or not _is_wooden_burnable():
|
||||
return
|
||||
health -= amount
|
||||
if health > 0:
|
||||
return
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if multiplayer.has_multiplayer_peer():
|
||||
if multiplayer.is_server():
|
||||
if game_world and game_world.has_method("_rpc_to_ready_peers"):
|
||||
game_world._rpc_to_ready_peers("_sync_object_break", [name])
|
||||
_break_into_pieces()
|
||||
else:
|
||||
if game_world and game_world.has_method("_sync_object_break"):
|
||||
game_world._sync_object_break.rpc_id(1, name)
|
||||
else:
|
||||
_break_into_pieces()
|
||||
|
||||
func on_grabbed(by_player):
|
||||
# Special handling for chests - open instead of grab
|
||||
if object_type == "Chest" and not is_chest_opened:
|
||||
@@ -526,9 +548,9 @@ func _convert_to_bomb_projectile(by_player, force: Vector2):
|
||||
if bomb.has_node("Sprite2D"):
|
||||
bomb.get_node("Sprite2D").visible = true
|
||||
|
||||
# Sync bomb throw to other clients
|
||||
# Sync bomb throw to other clients (pass our name so they can free the lifted bomb)
|
||||
if multiplayer.has_multiplayer_peer() and by_player.is_multiplayer_authority() and by_player.has_method("_rpc_to_ready_peers") and by_player.is_inside_tree():
|
||||
by_player._rpc_to_ready_peers("_sync_throw_bomb", [current_pos, force])
|
||||
by_player._rpc_to_ready_peers("_sync_throw_bomb", [name, current_pos, force])
|
||||
|
||||
# Remove the interactable object
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user