Skip to content

Commit

Permalink
Sync shops but in another way..?
Browse files Browse the repository at this point in the history
  • Loading branch information
IntQuant committed Dec 13, 2024
1 parent 77455c7 commit 1082aa4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions quant.ew/files/system/wang_hooks/wang_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ local function generate_detour_fn(orig_fn_name)
local detour_fn_name = detour_name(orig_fn_name)

local detour_fn = "\n".."function " .. detour_fn_name .. [[(x, y, w, h, is_open_path)
local entity_load_orig = EntityLoad
local entity_load_camera_bound = EntityLoadCameraBound
if CrossCall("ew_wang_detour", EW_CURRENT_FILE, "]]..orig_fn_name..[[", x, y, w, h, is_open_path) then
return
EntityLoad = function(...) end
EntityLoadCameraBound = function(...) end
end
return ]] .. orig_fn_name .. [[(x, y, w, h, is_open_path)
]] .. orig_fn_name .. [[(x, y, w, h, is_open_path)
EntityLoad = entity_load_orig
EntityLoadCameraBound = entity_load_camera_bound
end
]]

Expand All @@ -38,6 +45,10 @@ local function patch_fn(color, orig_fn_name)
return nil
end

if orig_fn_name ~= "spawn_all_shopitems" then
return nil
end

local detour_fn_name = detour_name(orig_fn_name)
local detour_fn = generate_detour_fn(orig_fn_name)

Expand All @@ -52,7 +63,7 @@ local function patch_file(filename)
local content = ModTextFileGetContent(filename)
current_file = filename
-- A textbook example of how to NOT use regular expressions.
-- content = string.gsub(content, 'RegisterSpawnFunction[(][ ]?(.-), "(.-)"[ ]?[)]', patch_fn)
content = string.gsub(content, 'RegisterSpawnFunction[(][ ]?(.-), "(.-)"[ ]?[)]', patch_fn)
content = content .. "\n"..'EW_CURRENT_FILE="'..filename..'"\n'

content = content .. generate_detour_fn("spawn_small_enemies")
Expand Down
2 changes: 1 addition & 1 deletion quant.ew/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ local function load_modules()
ctx.load_system("spectate")
ctx.load_system("effect_data_sync")
if ctx.proxy_opt.item_dedup then
ctx.load_system("gen_sync")
-- ctx.load_system("gen_sync")
end
ctx.load_system("karl")
ctx.load_system("remove_wand_sound")
Expand Down

0 comments on commit 1082aa4

Please sign in to comment.