From e157dca8bd7f5b8e938a3ec58837b03dffe35bc1 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 27 Jan 2022 23:56:44 -0800 Subject: [PATCH] Fixed incompatible tag comparisons, added two simple mods --- mods/character-movesets.lua | 2 +- mods/faster-swimming.lua | 21 +++++++++++++++++++++ mods/low-gravity.lua | 15 +++++++++++++++ src/pc/mod_list.c | 3 +++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 mods/faster-swimming.lua create mode 100644 mods/low-gravity.lua diff --git a/mods/character-movesets.lua b/mods/character-movesets.lua index 11d0e987..d35a861a 100644 --- a/mods/character-movesets.lua +++ b/mods/character-movesets.lua @@ -30,7 +30,7 @@ function luigi_before_phys_step(m) -- faster swimming if (m.action & ACT_FLAG_SWIMMING) ~= 0 then - hScale = hScale * 1.25 + hScale = hScale * 1.5 end -- slower holding item diff --git a/mods/faster-swimming.lua b/mods/faster-swimming.lua new file mode 100644 index 00000000..57cffd1e --- /dev/null +++ b/mods/faster-swimming.lua @@ -0,0 +1,21 @@ +-- name: Faster Swimming +-- incompatible: +-- description: Everyone swims faster. + +function mario_before_phys_step(m) + local hScale = 1.0 + + -- faster swimming + if (m.action & ACT_FLAG_SWIMMING) ~= 0 then + hScale = hScale * 2 + end + + m.vel.x = m.vel.x * hScale + m.vel.z = m.vel.z * hScale +end + +----------- +-- hooks -- +----------- + +hook_event(HOOK_BEFORE_PHYS_STEP, mario_before_phys_step) diff --git a/mods/low-gravity.lua b/mods/low-gravity.lua new file mode 100644 index 00000000..a81a82a8 --- /dev/null +++ b/mods/low-gravity.lua @@ -0,0 +1,15 @@ +-- name: Low Gravity +-- incompatible: +-- description: Gives everyone low gravity + +function mario_update(m) + if (m.action & ACT_FLAG_AIR) ~= 0 then + m.vel.y = m.vel.y + 1 + end +end + +----------- +-- hooks -- +----------- + +hook_event(HOOK_MARIO_UPDATE, mario_update) diff --git a/src/pc/mod_list.c b/src/pc/mod_list.c index cf466f58..353db803 100644 --- a/src/pc/mod_list.c +++ b/src/pc/mod_list.c @@ -203,6 +203,9 @@ static bool mod_list_incompatible_match(struct ModListEntry* a, struct ModListEn if (a->incompatible == NULL || b->incompatible == NULL) { return false; } + if (strlen(a->incompatible) == 0 || strlen(b->incompatible) == 0) { + return false; + } char* ai = a->incompatible; char* bi = b->incompatible;