Skip to content

Instantly share code, notes, and snippets.

@DaZombieKiller
Created February 28, 2017 08:35
Show Gist options
  • Select an option

  • Save DaZombieKiller/0ad116a649b85013cd330bf8e2a4adcb to your computer and use it in GitHub Desktop.

Select an option

Save DaZombieKiller/0ad116a649b85013cd330bf8e2a4adcb to your computer and use it in GitHub Desktop.
class GlobalStates : Weapon
{
static GlobalStates Instance()
{
let p = ThinkerIterator.Create("GlobalStates").Next();
if (p == null) p = new("GlobalStates");
return GlobalStates(p);
}
// nullify anything an instance of this could do
override void BeginPlay() {}
override void PostBeginPlay() {}
override void Tick() {}
states
{
LolZScriptBendsToMyWill:
POSS A -1 {
A_Log("this is amazing");
}
stop;
}
}
class TestItem : CustomInventory
{
states
{
Pickup:
TNT1 A 0
{
let globalStates = GlobalStates.Instance();
let state = globalStates.ResolveState("LolZScriptBendsToMyWill");
// weapons can use these states
player.SetPSprite(PSP_WEAPON + 1, state);
// and so can regular actors
player.mo.SetState(state);
}
stop;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment