diff --git a/ModScripts/9999999999999999999999_IBRUIsland.rb b/ModScripts/9999999999999999999999_IBRUIsland.rb index 7d72fa2..618b4e1 100644 --- a/ModScripts/9999999999999999999999_IBRUIsland.rb +++ b/ModScripts/9999999999999999999999_IBRUIsland.rb @@ -175,7 +175,7 @@ end if defined?(Game_Player) class Game_Player - alias ibru_movable_without movable? + alias ibru_movable_without movable? unless method_defined?(:ibru_movable_without) def movable?(*args, &block) return false if MPIslandVoyage.transit? && $game_map && $game_map.map_id == 156 ibru_movable_without(*args, &block) @@ -186,7 +186,7 @@ end if defined?(WebSocket) module WebSocket class << self - alias ibru_parse_without parse + alias ibru_parse_without parse unless method_defined?(:ibru_parse_without) 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. @@ -226,17 +226,17 @@ if defined?(WebSocket) ibru_parse_without(message) end - alias ibru_noclip_without admin_noclip_enabled? + alias ibru_noclip_without admin_noclip_enabled? unless method_defined?(:ibru_noclip_without) def admin_noclip_enabled? MPIslandVoyage.noclip? || ibru_noclip_without end - alias ibru_hidden_without admin_see_hidden_enabled? + 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 - alias ibru_ghost_without admin_can_ghost? + alias ibru_ghost_without admin_can_ghost? unless method_defined?(:ibru_ghost_without) def admin_can_ghost? MPIslandVoyage.active? || ibru_ghost_without end @@ -247,12 +247,12 @@ end if defined?(MPGodMode) module MPGodMode class << self - alias ibru_active_without active? + alias ibru_active_without active? unless method_defined?(:ibru_active_without) def active? return !!@enabled && MPIslandVoyage.active? && Time.now.to_f < @expires.to_f if MPIslandVoyage.active? ibru_active_without end - alias ibru_toggle_without request_toggle + alias ibru_toggle_without request_toggle unless method_defined?(:ibru_toggle_without) def request_toggle return ibru_toggle_without unless MPIslandVoyage.active? return if pending? || !WebSocket.connected? @@ -260,7 +260,7 @@ if defined?(MPGodMode) WebSocket.send_line("god_toggle:#{active? ? 0 : 1}") refresh_menu end - alias ibru_tick_without tick + alias ibru_tick_without tick unless method_defined?(:ibru_tick_without) def tick ibru_tick_without if MPIslandVoyage.active? && WebSocket.bootstrap_sync_unlocked? && (!@ibru_hello_at || Time.now.to_f - @ibru_hello_at > 10) @@ -274,7 +274,9 @@ end if defined?(Scene_Map) class Scene_Map - alias ibru_update_without update + # A script reload must not alias our own wrapper: that would recurse until + # SystemStackError on this frame's call to ibru_update_without. + alias ibru_update_without update unless method_defined?(:ibru_update_without) def update(*args, &block) result = ibru_update_without(*args, &block) MPIslandVoyage.tick @@ -286,20 +288,20 @@ end # Keep the island tools in the existing VIP overlay, without granting OWNER. if defined?(Scene_Map) && Scene_Map.method_defined?(:mp_admin_open_root) class Scene_Map - alias ibru_hotkey_without mp_admin_update_hotkey + alias ibru_hotkey_without mp_admin_update_hotkey unless method_defined?(:ibru_hotkey_without) def mp_admin_update_hotkey return ibru_hotkey_without unless MPIslandVoyage.active? && WebSocket.admin_role_rank <= 0 return if MPAdminMenu.blocked_by_other_ui? || !MPAdminMenu.open_triggered? mp_admin_menu_active? ? mp_admin_dispose_menu : mp_admin_open_root end - alias ibru_validate_role_without mp_admin_validate_menu_role + alias ibru_validate_role_without mp_admin_validate_menu_role unless method_defined?(:ibru_validate_role_without) def mp_admin_validate_menu_role return if MPIslandVoyage.active? && WebSocket.connected? ibru_validate_role_without end - alias ibru_admin_root_without mp_admin_open_root + alias ibru_admin_root_without mp_admin_open_root unless method_defined?(:ibru_admin_root_without) def mp_admin_open_root return ibru_admin_root_without unless MPIslandVoyage.active? rows = [] @@ -321,7 +323,7 @@ if defined?(Scene_Map) && Scene_Map.method_defined?(:mp_admin_open_root) @mp_admin_window.set_handler(:cancel, method(:mp_admin_dispose_menu)) end - alias ibru_admin_back_without mp_admin_back + alias ibru_admin_back_without mp_admin_back unless method_defined?(:ibru_admin_back_without) def mp_admin_back return mp_admin_open_root if @mp_admin_state == :ibru_targets ibru_admin_back_without @@ -372,7 +374,7 @@ end if defined?(MPAdminMenu) module MPAdminMenu class << self - alias ibru_grid_title_without grid_title + alias ibru_grid_title_without grid_title unless method_defined?(:ibru_grid_title_without) def grid_title(state) return 'Остров IBRU_VIZ' if state == :root && MPIslandVoyage.active? ibru_grid_title_without(state) @@ -384,12 +386,12 @@ end # Gray the item entry and block both keyboard and mouse access to its page. if defined?(Menu_Command) class Menu_Command - alias ibru_menu_initialize_without initialize + alias ibru_menu_initialize_without initialize unless method_defined?(:ibru_menu_initialize_without) def initialize(command_names) @ibru_item_index = command_names.index($game_text['menu:core/items']) rescue nil ibru_menu_initialize_without(command_names) end - alias ibru_menu_refresh_without refresh + alias ibru_menu_refresh_without refresh unless method_defined?(:ibru_menu_refresh_without) def refresh ibru_menu_refresh_without if MPIslandVoyage.active? && @ibru_item_index && @menu_sprites[@ibru_item_index] @@ -401,7 +403,7 @@ end if defined?(Scene_Menu) class Scene_Menu - alias ibru_menu_start_without start + alias ibru_menu_start_without start unless method_defined?(:ibru_menu_start_without) def start(*args, &block) result = ibru_menu_start_without(*args, &block) if MPIslandVoyage.active? && @contents && @contents.contents[@menu_index].is_a?(Menu_Items) @@ -409,7 +411,7 @@ if defined?(Scene_Menu) end result end - alias ibru_menu_switch_without process_switchMenuIndex + alias ibru_menu_switch_without process_switchMenuIndex unless method_defined?(:ibru_menu_switch_without) def process_switchMenuIndex(index) if MPIslandVoyage.active? && @contents && @contents.contents[index].is_a?(Menu_Items) direction = index.to_i >= @menu_index.to_i ? 1 : -1 @@ -419,7 +421,7 @@ if defined?(Scene_Menu) end ibru_menu_switch_without(index) end - alias ibru_menu_ok_without process_ok + alias ibru_menu_ok_without process_ok unless method_defined?(:ibru_menu_ok_without) def process_ok return SndLib.sys_buzzer if MPIslandVoyage.active? && @contents && @contents.contents[@menu_index].is_a?(Menu_Items) ibru_menu_ok_without @@ -444,7 +446,7 @@ if defined?(Battle_System) end if defined?(Game_SandboxObject) class Game_SandboxObject - alias ibru_sandbox_damage_without take_damage + alias ibru_sandbox_damage_without take_damage unless method_defined?(:ibru_sandbox_damage_without) def take_damage(user, *args, &block) return [] if MPIslandVoyage.active? && $game_player && user.equal?($game_player.actor) ibru_sandbox_damage_without(user, *args, &block)