The Story why you can ignite yourself with a FireExinguisher

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

The Story why you can ignite yourself with a FireExinguisher

Post by Hanfling »

Try to start 14_OceanLab_Lab on a dedicated server, join the game, grab the fire exinguisher, use it and voila you are burning!

Solution:
The FireExinguisher spawns HalonGas-projectiles. And somehow PlayerPawn.TakeDamage() is called on the client, but with DamageType = 'Flamed'. Then the client calls CatchFire(), but for whatever foolish reason this function is replicated to the server. So you are on fire. MEGA BARF!
Just another example how fucked up DeusEx code is.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

Re: The Story why you can ignite yourself with a FireExingui

Post by Jonas »

I found this anecdote highly amusing.
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
G-Flex
Silhouette
Posts: 621
Joined: Mon Jul 11, 2011 10:16 pm

Re: The Story why you can ignite yourself with a FireExingui

Post by G-Flex »

Huh, why is Flamed being used for the damage type? There's got to be some reason for that.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: The Story why you can ignite yourself with a FireExingui

Post by Hanfling »

FireExtinguisher.uc

Code: Select all

		gen = Spawn(class'ProjectileGenerator', None,, loc, rot);
		if (gen != None)
		{
			gen.ProjectileClass = class'HalonGas';
			// [...]
		}
ProjectileGenerator.uc

Code: Select all

defaultproperties
{
	// [...]
	ProjectileClass=Class'DeusEx.Fireball'
	// [...]
}
ProjectileClass is NOT replication. So the client spawns Fireballs.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
G-Flex
Silhouette
Posts: 621
Joined: Mon Jul 11, 2011 10:16 pm

Re: The Story why you can ignite yourself with a FireExingui

Post by G-Flex »

I have to say, being able to set yourself on fire with a fire extinguisher is a pretty great bug.

What would be necessary to fix it, out of curiosity? I know very little about replication.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: The Story why you can ignite yourself with a FireExingui

Post by Hanfling »

HXHuman.uc:

Code: Select all


// ----------------------------------------------------------------------
// CatchFireNonRep()
// ----------------------------------------------------------------------

function CatchFire( Pawn burner )
{
	// replication is fucked up, so get rid of it
}

// ----------------------------------------------------------------------
// CatchFireNonRep()
// ----------------------------------------------------------------------

function CatchFireNonRep( Pawn burner )
{
	local Fire f;
	local int i;
	local vector loc;

	//Log( Self $ ".CatchFire( " $ burner $ " ) called." );

	myBurner = burner;

	burnTimer = 0;

   if (bOnFire || Region.Zone.bWaterZone)
		return;

	bOnFire = True;
	burnTimer = 0;

	for (i=0; i<8; i++)
	{
		loc.X = 0.5*CollisionRadius * (1.0-2.0*FRand());
		loc.Y = 0.5*CollisionRadius * (1.0-2.0*FRand());
		loc.Z = 0.6*CollisionHeight * (1.0-2.0*FRand());
		loc += Location;

      // DEUS_EX AMSD reduce the number of smoke particles in multiplayer
      // by creating smokeless fire (better for server propagation).
      if ((Level.NetMode == NM_Standalone) || (i <= 0))		
         f = Spawn(class'Fire', Self,, loc);
      else
         f = Spawn(class'SmokelessFire', Self,, loc);

		if (f != None)
		{
			f.DrawScale = 0.5*FRand() + 1.0;

         //DEUS_EX AMSD Reduce the penalty in multiplayer
         //if (Level.NetMode != NM_Standalone)
            //f.DrawScale = f.DrawScale * 0.5;

			// turn off the sound and lights for all but the first one
			if (i > 0)
			{
				f.AmbientSound = None;
				f.LightType = LT_None;
			}

			// turn on/off extra fire and smoke
         // MP already only generates a little.
			if ((FRand() < 0.5) && (Level.NetMode == NM_Standalone))
				f.smokeGen.Destroy();
			if ((FRand() < 0.5) && (Level.NetMode == NM_Standalone))
				f.AddFire();
		}
	}

	// set the burn timer
	SetTimer(1.0, True);
}


// ----------------------------------------------------------------------
// TakeDamage()
// ----------------------------------------------------------------------

function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
{
	// [...]

	if ((DamageType == 'Flamed') && !bOnFire)
	{
		// Notify player if they're getting burned for the first time
		if ( Level.NetMode != NM_Standalone )
			ServerConditionalNotifyMsg( MPMSG_FirstBurn );
		
		if ( Role == ROLE_Authority ) // <-------------------------------
			CatchFireNonRep( instigatedBy ); // <-------------------------------

	}
	myProjKiller = None;
}

That's what i did. Can't remember if this was all to fix it. CatchFireNonRep() was just a plain copy of the old CatchFire(). Maybe there are some coop related changes in the code i postet.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
G-Flex
Silhouette
Posts: 621
Joined: Mon Jul 11, 2011 10:16 pm

Re: The Story why you can ignite yourself with a FireExingui

Post by G-Flex »

Wait, I thought the problem was related to replication with the projectile generator itself, though?

Also, does catching on fire when you're supposed to still work with that non-replicating version of the function?
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: The Story why you can ignite yourself with a FireExingui

Post by Hanfling »

The real problem was that the Client could call this SetOnFire() function on the Server. But the Server should have the authority about gameplay related stuff. So it's still called on the Server. Okay check for server and renaming the function is probably not necessary. On of the fixes should be enough.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Post Reply