diff --git a/quant.ew/files/system/hamis/append.lua b/quant.ew/files/system/hamis/append.lua new file mode 100644 index 00000000..d79e1d56 --- /dev/null +++ b/quant.ew/files/system/hamis/append.lua @@ -0,0 +1,3 @@ +function interacting(entity_who_interacted, entity_interacted, interactable_name) + CrossCall("ew_pet_hamis", entity_who_interacted, entity_interacted) +end \ No newline at end of file diff --git a/quant.ew/files/system/hamis/hamis.lua b/quant.ew/files/system/hamis/hamis.lua new file mode 100644 index 00000000..9f06c418 --- /dev/null +++ b/quant.ew/files/system/hamis/hamis.lua @@ -0,0 +1,68 @@ +dofile_once("data/scripts/lib/utilities.lua") + +local rpc = net.new_rpc_namespace() + +ModLuaFileAppend("data/scripts/animals/longleg_pet.lua", "mods/quant.ew/files/system/hamis/append.lua") + +local function frame() + if ctx.my_id == ctx.host_id then + return GameGetFrameNum() + else + return ctx.host_frame_num + end +end + +rpc.opts_everywhere() +function rpc.pet(entity_who_interacted, entity_interacted, num, hx, hy) + local rnd = entity_interacted + if not ctx.is_host then + entity_interacted = ctx.entity_by_remote_id[entity_interacted].id + end + entity_who_interacted = entity_who_interacted.entity or entity_who_interacted + local x, y = EntityGetTransform( entity_interacted ) + + edit_component( entity_interacted, "VelocityComponent", function(comp,vars) + ComponentSetValueVector2( comp, "mVelocity", 0, 0 ) + end) + + edit_component( entity_interacted, "CharacterDataComponent", function(comp,vars) + ComponentSetValueVector2( comp, "mVelocity", 0, 0 ) + end) + + edit_component( entity_who_interacted, "VelocityComponent", function(comp,vars) + ComponentSetValueVector2( comp, "mVelocity", 0, 0 ) + end) + + edit_component( entity_who_interacted, "CharacterDataComponent", function(comp,vars) + ComponentSetValueVector2( comp, "mVelocity", 0, 0 ) + end) + + SetRandomSeed( hx + rnd, hy + num ) + rnd = Random( 1, 20 ) + + if ( rnd ~= 13 ) then + GamePlayAnimation( entity_interacted, "pet", 99, "stand", 0 ) + EntitySetComponentsWithTagEnabled( entity_interacted, "enabled_if_charmed", false ) + + GamePrint( "$ui_longleg_love_msg1" ) + else + EntityLoad( "data/entities/projectiles/explosion.xml", x, y ) + + GamePrint( "$ui_longleg_love_msg2" ) + end + + GameEntityPlaySound( entity_who_interacted, "pet" ) +end + +np.CrossCallAdd("ew_pet_hamis", function(x, y) + local hx, hy = EntityGetTransform(y) + local ent = y + for a, b in pairs(ctx.entity_by_remote_id) do + if b.id == y then + ent = a + end + end + rpc.pet(ctx.player_data_by_local_entity[x] or x, ent, frame(), hx, hy) +end) + +return {} \ No newline at end of file diff --git a/quant.ew/files/system/perk_patches/append/perks_common.lua b/quant.ew/files/system/perk_patches/append/perks_common.lua index 093e25ec..e8443916 100644 --- a/quant.ew/files/system/perk_patches/append/perks_common.lua +++ b/quant.ew/files/system/perk_patches/append/perks_common.lua @@ -37,6 +37,17 @@ patch_perk_2("LEGGY_FEET", function(entity_perk_item, entity_who_picked, item_na orig_fn(entity_perk_item, entity_who_picked, item_name, pickup_count) end) -for _, perk in ipairs(util.string_split(ctx.proxy_opt.perk_ban_list)) do +local function string_split( s, splitter ) + local words = {}; + if s == nil or splitter == nil then + return {} + end + for word in string.gmatch( s, '([^'..splitter..']+)') do + table.insert( words, word ); + end + return words; +end + +for _, perk in ipairs(string_split(CrossCall("ew_perk_ban_list"), ',')) do hide_perk(perk) -end \ No newline at end of file +end \ No newline at end of file diff --git a/quant.ew/files/system/perk_patches/perk_patches.lua b/quant.ew/files/system/perk_patches/perk_patches.lua index cea962ea..77067654 100644 --- a/quant.ew/files/system/perk_patches/perk_patches.lua +++ b/quant.ew/files/system/perk_patches/perk_patches.lua @@ -45,6 +45,8 @@ end np.CrossCallAdd("ew_perks_modify_max_hp", rpc.modify_max_hp) +np.CrossCallAdd("ew_perk_ban_list", ctx.proxy_opt.perk_ban_list) + rpc.opts_everywhere() function rpc.sync_perk_amount(items, genome) GlobalsSetValue("TEMPLE_SHOP_ITEM_COUNT", tostring(items)) diff --git a/quant.ew/init.lua b/quant.ew/init.lua index c91e696f..c7530fa8 100755 --- a/quant.ew/init.lua +++ b/quant.ew/init.lua @@ -122,6 +122,7 @@ local function load_modules() ctx.load_system("gate_boss") ctx.load_system("tapion") ctx.load_system("world_sync_cuts") + ctx.load_system("hamis") end local function load_extra_modules()