Skip to content

Commit

Permalink
Add the "No guns"/"Knife only" mode
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoTheMutant committed Jul 23, 2024
1 parent 06b4b91 commit 99920b6
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 80 deletions.
Binary file added SRC/GRAPHICS/KNIFEIND.LMP
Binary file not shown.
19 changes: 16 additions & 3 deletions SRC/INIT.LUA
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ local function VarChange(v) --callback function called by CV_CALL flag
if (v.name == "mm_abilities")
if (v.value) print("\x87Murder Mystery:\x80 Skin abilities are Enabled (no limits)")
else print("\x87Murder Mystery:\x80 Skin abilities are Disabled (\"Regular person\" mode)") end
elseif (v.name == "mm_noguns")
if (v.value == 1) print("\x87Murder Mystery:\x80 Knife-only mode activated")
elseif (v.value == 2) print("\x87Murder Mystery:\x80 Strict knife-only mode activated \x81(Good Luck soldier)\x80")
else print("\x87Murder Mystery:\x80 Knife-only mode deactivated") end
elseif (v.name == "mm_duelmode")
if (v.value) print("\x87Murder Mystery:\x85 Murderers\x80 now have access to all weapons during the Showdown Duel")
else print("\x87Murder Mystery:\x85 Murderers\x80 can only use Red and Infinite Rings during duels") end
Expand All @@ -128,9 +132,10 @@ end
CV_RegisterVar({name = "mm_abilities", defaultvalue = "No", PossibleValue = CV_YesNo, flags = 6, func = VarChange})
CV_RegisterVar({name = "mm_customskins", defaultvalue = "No", PossibleValue = CV_YesNo, flags = 4})
CV_RegisterVar({name = "mm_spam", defaultvalue = 1, PossibleValue = {MIN = 0, MAX = 60}, flags = 4})
CV_RegisterVar({name = "mm_safechat", defaultvalue = "On", PossibleValue = CV_OnOff, flags = 4})
--CV_RegisterVar({name = "mm_safechat", defaultvalue = "On", PossibleValue = CV_OnOff, flags = 4})
CV_RegisterVar({name = "mm_afk", defaultvalue = 2, PossibleValue = {MIN = 0, MAX = 10}, flags = 4})
CV_RegisterVar({name = "mm_duelmode", defaultvalue = "False", PossibleValue = CV_TrueFalse, flags = 6, func = VarChange})
CV_RegisterVar({name = "mm_noguns", defaultvalue = 0, PossibleValue = {MIN = 0, MAX = 2}, flags = 6, func = VarChange})
CV_RegisterVar({name = "mm_duelmode", defaultvalue = "True", PossibleValue = CV_TrueFalse, flags = 6, func = VarChange})
CV_RegisterVar({name = "mm_autofire", defaultvalue = "On", PossibleValue = CV_OnOff, flags = 4})

--
Expand All @@ -139,7 +144,7 @@ CV_RegisterVar({name = "mm_autofire", defaultvalue = "On", PossibleValue = CV_On
print("\n\x87MURDER MYSTERY \x81v"..MM.version.."\n")

--Freeslot Gametype, Sheriff's Emerald & Knife object
freeslot('TOL_MURDERMYSTERY', 'MT_SHREML')
freeslot('TOL_MURDERMYSTERY', 'MT_SHREML', 'MT_MMKNIFE')
freeslot('sfx_mmdth1', 'sfx_mmdth2', 'sfx_mmdth3', 'sfx_mmdth4', 'sfx_mmdth5', 'sfx_mmdth6', 'sfx_mmdth7')

G_AddGametype({
Expand All @@ -163,6 +168,14 @@ mobjinfo[MT_SHREML]={
flags = MF_SPECIAL
}

--Knife weapon
mobjinfo[MT_MMKNIFE]={
spawnstate = S_SPRK1,
radius = 4194304, --64*FU
height = 3145728, --48*FU
flags = 513 --MF_NOGRAVITY|MF_SPECIAL
}

--Death SFX captions
sfxinfo[sfx_mmdth1].caption = "\19 Good Night"
sfxinfo[sfx_mmdth2].caption = "Killed"
Expand Down
3 changes: 2 additions & 1 deletion SRC/LUA/CCMD.LUA
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ local function helpCMD(p, page)

if ((p == server) or (IsPlayerAdmin(p)))
CONS_Printf(p, "\n\x82".."ADMIN CONSOLE VARIABLES")
CONS_Printf(p, "\x87MM_ABILITIES\x80 - Switch between \"Mystery\" and \"Vanilla\" skin abilities mode. Default is \"Mystery\" (OFF)")
CONS_Printf(p, "\x87MM_ABILITIES\x80 - Switch between \x81\"Mystery\"\x80 and \x81\"Vanilla\"\x80 skin abilities mode. Default is \"Mystery\" (OFF).")
CONS_Printf(p, "\x87MM_CUSTOMSKINS\x80 - Allow the usage of the Custom Skins/Characters in MM.")
CONS_Printf(p, "\x87MM_SPAM\x80 - Set the sending delay time in ticks to prevent chat spamming.")
CONS_Printf(p, "\x87MM_SAFECHAT\x80 - Enable/Disable the chat automoderation system for cases like \"I am [role]\" reveals.")
CONS_Printf(p, "\x87MM_AFK\x80 - AFK timeout in minutes. If player is AFK for [MMAFK] minutes straight he is going to be kicked.")
CONS_Printf(p, "\x87MM_NOGUNS\x80 - Take all weapons from everyone except the knife. Possible values:\x89 0 - Unlock all weapons\x80;\x8A 1 - Limit to Knife when not Duel\x80;\x8B 2 - Limit to Knife all the time\x80.")
CONS_Printf(p, "\x87MM_DUELMODE\x80 - Enable/Disable access to all weapons for \x85Murderers\x80 during the \x88Showdown Duel\x80.")
CONS_Printf(p, "\x87MM_AUTOFIRE\x80 - Turn weapon autofire ON/OFF.")
end
Expand Down
2 changes: 1 addition & 1 deletion SRC/LUA/FUNCTIONS.LUA
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ rawset(_G, "MM_PlayerQuit", function(p)
elseif (p.role == ROLE_INNOCENT)
p.role = ROLE_NONE
if (not PlayerCount(ROLE_INNOCENT)) and (not PlayerCount(ROLE_SHERIFF)) and (not PlayerCount(ROLE_HERO))
MM_EndRound(0, "LAST_LEFT", ROLE_HERO) --Innocent left the game where he was the last hope, we will still count him as Hero
MM_EndRound(0, "LAST_LEFT", 3) --Innocent has left the game where he was the last hope, we will still consider him as the Hero
end
end

Expand Down
12 changes: 8 additions & 4 deletions SRC/LUA/GAME.LUA
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
-- hit detection, player parameters, AFK logic, and round endings

local afkCVAR = CV_FindVar("mm_afk")
local mmtimelimitCVAR = CV_FindVar("mm_timelimit")
local rejointimeoutCVAR = CV_FindVar("rejointimeout")
local duelmodeCVAR = CV_FindVar("mm_duelmode")
local nogunsCVAR = CV_FindVar("mm_noguns")

local function MM_GetSHREMLinterval(dist)
if (dist < 256) return 5
Expand Down Expand Up @@ -276,7 +277,7 @@ addHook("MobjDamage", function(v, i, a, d) --Victim, inflictor (unused here), at
end
elseif (vp.role == ROLE_INNOCENT)
MM_KillPlayerByPlayer(v, a)
if ((ap.role == ROLE_MURDERER) and not PlayerCount(ROLE_INNOCENT))
if (ap.role == ROLE_MURDERER) and (not PlayerCount(ROLE_INNOCENT)) and (not PlayerCount(ROLE_SHERIFF)) and (not PlayerCount(ROLE_HERO))
MM_EndRound(ROLE_MURDERER, "WIN", WIN_MURD)
elseif (ap.role == ROLE_SHERIFF)
-- Sheriff killed an innocent, remove the "Sheriff" role from the player if there are still Innos alive,
Expand Down Expand Up @@ -336,8 +337,11 @@ end, MT_SHREML)
addHook("PlayerThink", function(p)
if (gametype != GT_MURDERMYSTERY) return end

--remove weapons from Murderer in case it is not Duel or Murderers are not allowed to have other weapons during Duels
if ((p.role == ROLE_MURDERER) and (PlayerCount(ROLE_INNOCENT) or (not CV_FindVar("mm_duelmode").value))) p.ringweapons = 0 end
--lock weapons from Murderer in case it is not Duel or Murderers are not allowed to have other weapons during Duels
--OR lock weapons from everyone if the Knife-only mode is activated
if ((p.role == ROLE_MURDERER) and PlayerCount(ROLE_INNOCENT) or (not duelmodeCVAR.value)) or (((nogunsCVAR.value == 1) and (not MM.shwdwn) and PlayerCount(ROLE_INNOCENT)) or (nogunsCVAR.value == 2))
p.currentweapon = 0
end

p.weapondelay = 1 --vanilla weapons don't shoot anymore, only the MM recreation
p.powers[3] = 0 --disable shields completely
Expand Down
84 changes: 47 additions & 37 deletions SRC/LUA/HUD.LUA
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
local HudInfoSize = {0,0,0}
local maxHudIfnfoSize = 0
local duelmodeCVAR = CV_FindVar("mm_duelmode")
local nogunsCVAR = CV_FindVar("mm_noguns")

local function wep2rw(wep) --convert WEP_* constant to RW_* constant
return 2^(wep - 1)
Expand Down Expand Up @@ -283,48 +284,57 @@ hud.add(function(v, p)
end
end

--Ring weapons
if (p.role == ROLE_MURDERER) and (PlayerCount(ROLE_INNOCENT) or ((not PlayerCount(ROLE_INNOCENT)) and (not duelmodeCVAR.value)))
--draw the only icon for Murderer
if (p.powers[pw_infinityring])
if (p.powers[pw_infinityring] >= MM.weapons[0][5]) then wepTextFlags[0] = wepTextFlags[0] | V_YELLOWMAP end
v.draw((MM.hud.game.pos.ringWepMurd.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[0][1]), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Infinite Ring icon
v.drawString(MM.hud.game.pos.ringWepMurd.x + 24, (MM.hud.game.pos.ringWep.y + 8), p.powers[pw_infinityring], wepTextFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER, "thin-right") --Infinite Ring ammo counter
else
if (p.rings < 1) then wepPatchFlags[0] = V_80TRANS end
v.draw((MM.hud.game.pos.ringWepMurd.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[-1][1]), wepPatchFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER) --Red Ring icon
end
if ((nogunsCVAR.value == 1) and (not MM.shwdwn) and PlayerCount(ROLE_INNOCENT)) or (nogunsCVAR.value == 2)
if (p.rings < 1) then wepPatchFlags[0] = V_80TRANS end
v.draw((MM.hud.game.pos.ringWepMurd.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[-2][1]), wepPatchFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER) --Knife icon
v.draw((MM.hud.game.pos.ringWepMurd.x + 6), (MM.hud.game.pos.ringWep.y - 2 - (del >> 1)), v.cachePatch("CURWEAP"), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --selector
elseif ((p.role == ROLE_SHERIFF) or (p.role == ROLE_HERO) or ((p.role == ROLE_MURDERER) and (not PlayerCount(ROLE_INNOCENT)) and duelmodeCVAR.value))
if (p.powers[pw_infinityring])
if (p.powers[pw_infinityring] >= MM.weapons[0][5]) then wepTextFlags[0] = wepTextFlags[0] | V_YELLOWMAP end
v.draw((MM.hud.game.pos.ringWep.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[0][1]), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Infinite Ring icon
v.drawString((MM.hud.game.pos.ringWep.x + 24), (MM.hud.game.pos.ringWep.y + 8), p.powers[pw_infinityring], wepTextFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag(), "thin-right") --Infinite Ring ammo counter
else
if (p.rings < 1) then wepPatchFlags[0] = V_80TRANS end
v.draw((MM.hud.game.pos.ringWep.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[-1][1]), wepPatchFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Red Ring icon
end
for weapon = 1, 6 do
if (p.powers[weapon + 14])
if (p.powers[weapon + 14] >= MM.weapons[weapon][5]) then wepTextFlags[weapon] = wepTextFlags[weapon] | V_YELLOWMAP end

if (p.ringweapons & wep2rw(weapon))
else
wepPatchFlags[weapon] = V_80TRANS
wepTextFlags[weapon] = wepTextFlags[weapon] | V_TRANSLUCENT
else
--Ring weapons
if (p.role == ROLE_MURDERER) and (PlayerCount(ROLE_INNOCENT) or ((not PlayerCount(ROLE_INNOCENT)) and (not duelmodeCVAR.value)))
--draw the only icon for Murderer
if (p.powers[pw_infinityring])
if (p.powers[pw_infinityring] >= MM.weapons[0][5]) then wepTextFlags[0] = wepTextFlags[0] | V_YELLOWMAP end
v.draw((MM.hud.game.pos.ringWepMurd.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[0][1]), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Infinite Ring icon
v.drawString(MM.hud.game.pos.ringWepMurd.x + 24, (MM.hud.game.pos.ringWep.y + 8), p.powers[pw_infinityring], wepTextFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER, "thin-right") --Infinite Ring ammo counter
else
if (p.rings < 1) then wepPatchFlags[0] = V_80TRANS end
v.draw((MM.hud.game.pos.ringWepMurd.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[-1][1]), wepPatchFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER) --Red Ring icon
end
v.draw((MM.hud.game.pos.ringWepMurd.x + 6), (MM.hud.game.pos.ringWep.y - 2 - (del >> 1)), v.cachePatch("CURWEAP"), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --selector
elseif ((p.role == ROLE_SHERIFF) or (p.role == ROLE_HERO) or ((p.role == ROLE_MURDERER) and (not PlayerCount(ROLE_INNOCENT)) and duelmodeCVAR.value))
if (p.powers[pw_infinityring])
if (p.powers[pw_infinityring] >= MM.weapons[0][5]) then wepTextFlags[0] = wepTextFlags[0] | V_YELLOWMAP end
v.draw((MM.hud.game.pos.ringWep.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[0][1]), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Infinite Ring icon
v.drawString((MM.hud.game.pos.ringWep.x + 24), (MM.hud.game.pos.ringWep.y + 8), p.powers[pw_infinityring], wepTextFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag(), "thin-right") --Infinite Ring ammo counter
else
if (p.rings < 1) then wepPatchFlags[0] = V_80TRANS end
v.draw((MM.hud.game.pos.ringWep.x + 8), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[-1][1]), wepPatchFlags[0]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Red Ring icon
end
for weapon = 1, 6 do
if (p.powers[weapon + 14])
if (p.powers[weapon + 14] >= MM.weapons[weapon][5]) then wepTextFlags[weapon] = wepTextFlags[weapon] | V_YELLOWMAP end

if (p.ringweapons & wep2rw(weapon))
else
wepPatchFlags[weapon] = V_80TRANS
wepTextFlags[weapon] = wepTextFlags[weapon] | V_TRANSLUCENT
end
v.draw((MM.hud.game.pos.ringWep.x + 8 + weapon*20), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[weapon][1]), wepPatchFlags[weapon]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Ring weapon icon
v.drawString((MM.hud.game.pos.ringWep.x + 24 + weapon*20), (MM.hud.game.pos.ringWep.y + 8), p.powers[weapon + 14], wepTextFlags[weapon]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag(), "thin-right") --Ammo counter
elseif (p.ringweapons & wep2rw(weapon))
v.draw((MM.hud.game.pos.ringWep.x + 8 + weapon*20), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[weapon][1]), V_PERPLAYER|V_SNAPTOBOTTOM|V_TRANSLUCENT|v.localTransFlag())
end
v.draw((MM.hud.game.pos.ringWep.x + 8 + weapon*20), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[weapon][1]), wepPatchFlags[weapon]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Ring weapon icon
v.drawString((MM.hud.game.pos.ringWep.x + 24 + weapon*20), (MM.hud.game.pos.ringWep.y + 8), p.powers[weapon + 14], wepTextFlags[weapon]|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag(), "thin-right") --Ammo counter
elseif (p.ringweapons & wep2rw(weapon))
v.draw((MM.hud.game.pos.ringWep.x + 8 + weapon*20), (MM.hud.game.pos.ringWep.y), v.cachePatch(MM.weapons[weapon][1]), V_PERPLAYER|V_SNAPTOBOTTOM|V_TRANSLUCENT|v.localTransFlag())
end
if ((p.ammoremovaltimer) and ((leveltime % 8) < 4))
v.drawString((MM.hud.game.pos.ringWep.x + 8 + (p.ammoremovalweapon*20)), (MM.hud.game.pos.ringWep.y), "-"..p.ammoremoval, V_REDMAP|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Ammo removal penalty
end
v.draw((MM.hud.game.pos.ringWep.x + 6 + p.currentweapon*20), (MM.hud.game.pos.ringWep.y - 2 - (del >> 1)), v.cachePatch("CURWEAP"), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --selector
end
if ((p.ammoremovaltimer) and ((leveltime % 8) < 4))
v.drawString((MM.hud.game.pos.ringWep.x + 8 + (p.ammoremovalweapon*20)), (MM.hud.game.pos.ringWep.y), "-"..p.ammoremoval, V_REDMAP|V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --Ammo removal penalty
end
v.draw((MM.hud.game.pos.ringWep.x + 6 + p.currentweapon*20), (MM.hud.game.pos.ringWep.y - 2 - (del >> 1)), v.cachePatch("CURWEAP"), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --selector
end
elseif ((p.role == ROLE_INNOCENT) and (#MM.shremls) and (p.shreml_dist)) --innocents have Sheriff Emerald radar instead of weapon dock
end

--Sheriff Emerald Radar for Innocents
if (p.role == ROLE_INNOCENT) and (#MM.shremls) and (p.shreml_dist)
v.drawScaled(10027008, 10223616, 32768, v.cachePatch("IDEYAR"..V_GetSHREMLiconID(fixint(p.shreml_dist))), V_SNAPTOBOTTOM|V_PERPLAYER|v.localTransFlag()) --153*FU, 156*FU, FU/2
end

Expand Down
57 changes: 34 additions & 23 deletions SRC/LUA/WEAPONS.LUA
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@
-- Vanilla weaponry recreation for modding it

local autofireCVAR = CV_FindVar("mm_autofire")
MM.weapons={}
local nogunsCVAR = CV_FindVar("mm_noguns")
MM.weapons = {}

-- VANILLA WEAPONS
MM.weapons[-2]={ --Knife
"KNIFEIND", --HUD icon
MT_MMKNIFE, --MOBJ_T of this weapon
0, --MF2_* flag
35, --Weapon delay
}
MM.weapons[-1]={ --Red Ring
"RINGIND", --HUD icon
MT_REDRING, --MOBJ_T that represents this weapon
MT_REDRING, --MOBJ_T of this weapon
0, --MF2_* flag
16, --weapondelay
16, --Weapon delay
}
MM.weapons[0]={ --Infinity Ring
"INFNIND", --HUD icon
MT_THROWNINFINITY, --MOBJ_T that represents this weapon
MT_THROWNINFINITY, --MOBJ_T of this weapon
0, --MF2_* flag
16, --weapondelay
16, --Weapon delay
800 --max amonut
}
MM.weapons[1]={ --Automatic Ring
Expand Down Expand Up @@ -85,7 +92,9 @@ end
local function P_SetWeaponDelay(p, delay)
p.mmweapondelay = delay;

if (p.skin == 2) -- Knuckles
--Decrease the delay for Knuckles
--Note that Knuckles has this feature in the vanilla game too, I just copied this feature into MM
if (p.skin == 2)
-- Multiply before dividing.
-- Loss of precision can make a surprisingly large difference.
p.mmweapondelay = ($ << 1)/3
Expand All @@ -101,27 +110,23 @@ addHook("PlayerThink", function(p) --this whole hook is a port of P_DoFiring() f
return
end

if ((p.pflags & PF_ATTACKDOWN) or (p.climbing) or (p.mmweapondelay)
if (p.pflags & PF_ATTACKDOWN) or (p.climbing) or (p.mmweapondelay)
or (not p.role) or (p.role == ROLE_INNOCENT) or ((MM.minigame) and (p.minigame))
or (p.playerstate == PST_DEAD) or (p.spectator))
or (p.playerstate == PST_DEAD) or (p.spectator)
then return end

local noguns = ((nogunsCVAR.value == 1) and (not MM.shwdwn) and PlayerCount(ROLE_INNOCENT)) or (nogunsCVAR.value == 2)

if (not autofireCVAR.value) p.pflags = $|PF_ATTACKDOWN end
local mo

if (p.cmd.buttons & BT_FIRENORMAL)
if (p.cmd.buttons & BT_FIRENORMAL) or ((p.cmd.buttons & BT_ATTACK) and noguns)
-- KNIFE --
if (p.rings > 0)
P_SetWeaponDelay(p, 35)
mo = P_SpawnPlayerMissile(p.mo, MT_MMKNIFE, 0)
P_SetWeaponDelay(p, MM.weapons[-2][4])
mo = P_SpawnPlayerMissile(p.mo, MM.weapons[-2][2], MM.weapons[-2][3])
P_GivePlayerRings(p, -1)

searchBlockmap("objects", function(ref, fmo)
if ((fmo.valid) and valid(fmo.player) and (fmo != ref.target) and (P_AproxDistance(P_AproxDistance(fmo.x - ref.x, fmo.y - ref.y), fmo.z - ref.z) < USERANGE))
P_DamageMobj(fmo, ref, ref.target)
end
end, mo)

if (not p.sneak) S_StartSound(p.mo, sfx_wepfir) end --yeah, stealth included
end
elseif (p.currentweapon == WEP_AUTO) and (p.powers[pw_automaticring])
Expand Down Expand Up @@ -180,7 +185,7 @@ addHook("PlayerThink", function(p) --this whole hook is a port of P_DoFiring() f
mo = P_SpawnPlayerMissile(p.mo, MM.weapons[WEP_RAIL][2], MM.weapons[WEP_RAIL][3])
-- Rail has no unique thrown object, therefore its sound plays here.
S_StartSound(p.mo, sfx_rail1)
else
elseif (not noguns)
if (p.currentweapon == 0) and (p.powers[pw_infinityring])
-- INFINITY --
P_SetWeaponDelay(p, MM.weapons[0][4])
Expand Down Expand Up @@ -211,6 +216,12 @@ addHook("PlayerThink", function(p) --this whole hook is a port of P_DoFiring() f
end
end)

--Knife collision and attack
addHook("TouchSpecial", function(special, toucher)
P_DamageMobj(toucher, special, special.target)
return true
end, MT_MMKNIFE)

-- "Wall hug" bug fix for all weapons
--
-- Bug explanation:
Expand All @@ -220,15 +231,15 @@ end)
-- You can watch Decino's much more detailed explanation here:
-- https://www.youtube.com/watch?v=kRC7hGDrNsM

addHook("MapLoad", do
addHook("ThinkFrame", do
for weapon = 0, #MM.weapons do
if (gametype == GT_MURDERMYSTERY)
--weapons are still broken but at least there are less chances of wallclip
mobjinfo[MM.weapons[weapon][2]].radius = 16 << FRACBITS
mobjinfo[MM.weapons[weapon][2]].speed = 32 << FRACBITS
mobjinfo[MM.weapons[weapon][2]].radius = 1048576 --16*FU
mobjinfo[MM.weapons[weapon][2]].speed = 2097152 --32*FU
else --return everything to default if gametype is not MM
mobjinfo[MM.weapons[weapon][2]].radius = 16 << FRACBITS
mobjinfo[MM.weapons[weapon][2]].speed = 60 <<FRACBITS
mobjinfo[MM.weapons[weapon][2]].radius = 1048576 --16*FU
mobjinfo[MM.weapons[weapon][2]].speed = 3932160 --60*FU
end
end
end)
Loading

0 comments on commit 99920b6

Please sign in to comment.