MFE_JUSTHITFLOOR triggers endlessly when standing on a monitor

Flame

WR 102
Consider the following code:

Code below is supposed to spawn MT_TNTDUST in 16 directions in a 360 degree circle when the player hits the floor.

Code:
addHook("PlayerThink", function(p)
	if p and p.valid and not p.spectator
		and p.mo and p.mo.valid
		local zpos = P_FloorzAtPos(p.mo.x,
						p.mo.y,
						p.mo.z,
						p.mo.height)
										
		if (p.mo.eflags & MFE_JUSTHITFLOOR) and P_IsObjectOnGround(p.mo)
			for i = 1, 16 do
				local fa = i*ANGLE_22h
				local mobj = P_SpawnMobj(p.mo.x + FixedMul(cos(fa), (p.mo.radius)),
								p.mo.y + FixedMul(sin(fa), (p.mo.radius)),
								zpos + FRACUNIT,
								MT_TNTDUST)
				mobj.angle = fa
				mobj.flags = ($|MF_NOGRAVITY)
				P_InstaThrust(mobj, mobj.angle, FRACUNIT)
			end
		end
	end
end)

However if we land on top of a monitor, this code triggers endlessly.

attachment.php



Flame Edit 3/8/2020:
From my understanding, the intended behavior of MFE_JUSTHITFLOOR flag should only trigger true for one tic and then false for the next tic upon landing. This is the case when touching the actual sector floor (Ie, when the Player's Z value is less than or equal to that of the Player's Floor Z value), but not when standing on top of an object. I identified this through additional testing and playing around in devmode.

attachment.php
 

Attachments

  • srb20008.gif
    srb20008.gif
    4.2 MB · Views: 299
  • srb20015.gif
    srb20015.gif
    3.5 MB · Views: 169
Last edited:

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top