Ludeon Forums

RimWorld => Mods => Help => Topic started by: generalcrusher on March 05, 2014, 06:18:29 AM

Title: Stun effect
Post by: generalcrusher on March 05, 2014, 06:18:29 AM
Is it possible to add (without c# scripting) a effect to granades that stuns instead of hurts?
Title: Re: Stun effect
Post by: Jones-250 on March 05, 2014, 12:30:44 PM
Bump. I would like to know too. Halp!
Title: Re: Stun effect
Post by: Cala13er on March 05, 2014, 12:56:09 PM
No, this is not currently possible without c# modding. I could be wrong. But I'm sure stun chance is hardcoded.
Title: Re: Stun effect
Post by: Architect on March 05, 2014, 01:11:24 PM
I can confirm the stun effect is hard coded:
using System;
public class StunHandler
{
public Thing baseThing;
private int stunTicksLeft;
private Mote moteStun;
public bool Stunned
{
get
{
return this.stunTicksLeft > 0;
}
}
public StunHandler(Thing Base)
{
this.baseThing = Base;
}
public void StunHandlerTick()
{
if (this.stunTicksLeft > 0)
{
this.stunTicksLeft--;
Pawn pawn = this.baseThing as Pawn;
if (pawn != null && pawn.Incapacitated)
{
this.stunTicksLeft = 0;
}
if (this.moteStun != null)
{
this.moteStun.Maintain();
}
}
}
public void Notify_DamageApplied(DamageInfo dinfo)
{
if (dinfo.Def == DamageTypeDefOf.Stun)
{
this.StunFor(dinfo.Amount * 11);
}
}
protected void StunFor(int NumTicks)
{
this.stunTicksLeft = NumTicks;
if (this.moteStun == null)
{
this.moteStun = MoteMaker.MakeStunOverlay(this.baseThing);
}
}
}