Skip to content

Instantly share code, notes, and snippets.

@JPLeBreton
Created March 5, 2018 05:06
Show Gist options
  • Save JPLeBreton/ce9a6ecaedef55e2b78adbe8b11e7213 to your computer and use it in GitHub Desktop.
Save JPLeBreton/ce9a6ecaedef55e2b78adbe8b11e7213 to your computer and use it in GitHub Desktop.
Fishing Rod (multi-phase fire state weapon)
class MFFishingRod : Weapon
{
States
{
Spawn:
SAWG C -1;
Stop;
Ready:
SAWG C 1 A_WeaponReady;
Loop;
Select:
SAWG C 1 A_Raise;
Loop;
Deselect:
SAWG C 1 A_Lower;
Loop;
Fire:
SAWG B 1 A_JumpIf(invoker.ShouldCast(), "LineCast");
Goto Ready;
LineCast:
SAWG AB 5 A_Log("LineCast");
Loop;
}
bool ShouldCast()
{
// TODO: WTF? none of these statements return true
if ( InStateSequence(CurState, ResolveState("Fire")) )
Console.Printf("Fire");
if ( InStateSequence(CurState, ResolveState("Ready")) )
Console.Printf("Ready");
if ( InStateSequence(CurState, ResolveState("LineCast")) )
Console.Printf("LineCast");
if ( InStateSequence(CurState, ResolveState("Reeling")) )
Console.Printf("Reeling");
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment