From 5123d1bc7ef159cae6e953f6ebff158d07652565 Mon Sep 17 00:00:00 2001 From: worldbosse Date: Mon, 2 Nov 2026 01:01:43 +0400 Subject: [PATCH] Fix IBRU websocket prepend recursion --- .../9999999999999999999999_IBRUIsland.rb | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/ModScripts/9999999999999999999999_IBRUIsland.rb b/ModScripts/9999999999999999999999_IBRUIsland.rb index 4eeeee8..f84ecbc 100644 --- a/ModScripts/9999999999999999999999_IBRUIsland.rb +++ b/ModScripts/9999999999999999999999_IBRUIsland.rb @@ -174,20 +174,21 @@ 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) - def parse(message) + # 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. if message =~ /\Abootstrap_map:(10\d{3})\z/ @@ -223,31 +224,28 @@ if defined?(WebSocket) MPIslandVoyage.set_targets(list) return end - ibru_parse_without(message) - end + 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) - end + def disconnect(*args, &block) + MPIslandVoyage.set_active(false) + super + end - alias ibru_noclip_without admin_noclip_enabled? unless method_defined?(:ibru_noclip_without) - def admin_noclip_enabled? - MPIslandVoyage.noclip? || ibru_noclip_without - end + def admin_noclip_enabled? + 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 - end + def admin_see_hidden_enabled? + (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 + def admin_can_ghost? + MPIslandVoyage.active? || super end end + sc = WebSocket.singleton_class + sc.prepend(MPIslandVoyageWebSocketPatch) unless sc.ancestors.include?(MPIslandVoyageWebSocketPatch) end if defined?(MPGodMode)