Fix IBRU websocket prepend recursion

This commit is contained in:
WorldBosse committed 2026-11-02 01:01:43 +04:00
1 parent 89f0da185b
commit 5123d1bc7e
1 file changed
+14 -16
+14 -16
View File
@@ -174,19 +174,20 @@ module MPIslandVoyage
end
if defined?(Game_Player)
class Game_Player
alias ibru_movable_without movable? unless method_defined?(:ibru_movable_without)
module MPIslandVoyageMovementPatch
def movable?(*args, &block)
return false if MPIslandVoyage.transit? && $game_map && $game_map.map_id == 156
ibru_movable_without(*args, &block)
super
end
end
Game_Player.prepend(MPIslandVoyageMovementPatch) unless Game_Player.ancestors.include?(MPIslandVoyageMovementPatch)
end
if defined?(WebSocket)
module WebSocket
class << self
alias ibru_parse_without parse unless method_defined?(:ibru_parse_without)
# PresenceVersionGate and several other mods already prepend WebSocket.
# Aliasing their parse/disconnect methods here makes their super call return
# to this wrapper forever. A final prepend keeps the lookup chain linear.
module MPIslandVoyageWebSocketPatch
def parse(message)
# The server uses a distinct room ID for island interiors. Only the
# transport layer sees it; the game loads the original map data.
@@ -223,31 +224,28 @@ if defined?(WebSocket)
MPIslandVoyage.set_targets(list)
return
end
ibru_parse_without(message)
super(message)
end
alias ibru_disconnect_without disconnect unless method_defined?(:ibru_disconnect_without)
def disconnect(*args, &block)
MPIslandVoyage.set_active(false)
ibru_disconnect_without(*args, &block)
super
end
alias ibru_noclip_without admin_noclip_enabled? unless method_defined?(:ibru_noclip_without)
def admin_noclip_enabled?
MPIslandVoyage.noclip? || ibru_noclip_without
MPIslandVoyage.noclip? || super
end
alias ibru_hidden_without admin_see_hidden_enabled? unless method_defined?(:ibru_hidden_without)
def admin_see_hidden_enabled?
(MPIslandVoyage.active? && !!@admin_see_hidden_enabled) || ibru_hidden_without
(MPIslandVoyage.active? && !!@admin_see_hidden_enabled) || super
end
alias ibru_ghost_without admin_can_ghost? unless method_defined?(:ibru_ghost_without)
def admin_can_ghost?
MPIslandVoyage.active? || ibru_ghost_without
end
MPIslandVoyage.active? || super
end
end
sc = WebSocket.singleton_class
sc.prepend(MPIslandVoyageWebSocketPatch) unless sc.ancestors.include?(MPIslandVoyageWebSocketPatch)
end
if defined?(MPGodMode)