// Set up general stuff
IfSpawned
  tmpargument = ACTIONJB
  DoAction
  KeepAction
  MakeCrushValid
  MakeAmmoKnown



// Make it poof
IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 0
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 1
  SendMessageNear



// Make it lie on the floor
IfDropped
  KeepAction



// Play a clink or clang
IfHitGround
  tmpargument = 0
  tmpdistance = rand & 2047 + 10000
  PlaySound


// Alert others to draw
IfTakenOut
  SetTargetToWhoeverIsHolding
  IfTargetIsAPlayer
    tmpargument = 2
    SendMessageNear



// Tell them what they've won...
IfGrabbed
  SetTargetToWhoeverIsHolding
  IfTargetIsAPlayer
    tmpargument = 0
    SendMessageNear



// REfill the lamp
IfUsed
  tmpargument = 30
  SetReloadTime
  SetTargetToWhoeverIsHolding
  IfHeldInLeftHand
    SetTargetToTargetRightHand
  Else
    SetTargetToTargetLeftHand
  tmpargument = [LAMP]
  IfTargetHasID
    SetTargetToWhoeverIsHolding
    tmpargument = [LAMP]
    RestockTargetAmmoIDFirst
    tmpargument = 2
    SendMessageNear
    CostAmmo
    IfAmmoOut
      GoPoof
  Else
    SetTargetToWhoeverIsHolding
    IfNameIsKnown
      tmpargument = 4
      SendMessageNear
    Else
      tmpargument = 5
      SendMessageNear
      MakeSimilarNamesKnown

IfReaffirmed
  tmpargument = 6
  SendMessageNear
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 1
  SpawnExactParticle
  GoPoof
  tmpargument = 2
  tmpdistance = 8000 + rand & 4000
  PlaySound
  tmpargument = [WAKE]
  OrderSpecialID

// Finish up
End
