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