Stun effect

Started by generalcrusher, March 05, 2014, 06:18:29 AM

Previous topic - Next topic

generalcrusher

Is it possible to add (without c# scripting) a effect to granades that stuns instead of hurts?

Jones-250

Bump. I would like to know too. Halp!
Skill,
  Cohesion
      and a Forward spirit.

Cala13er

No, this is not currently possible without c# modding. I could be wrong. But I'm sure stun chance is hardcoded.

Architect

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);
}
}
}
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.