Fixed incompatible tag comparisons, added two simple mods

This commit is contained in:
MysterD 2022-01-27 23:56:44 -08:00
parent 880afd79c3
commit e157dca8bd
4 changed files with 40 additions and 1 deletions

View file

@ -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

21
mods/faster-swimming.lua Normal file
View file

@ -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)

15
mods/low-gravity.lua Normal file
View file

@ -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)

View file

@ -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;