SHARE
TWEET

Starbound Glad Giraffe 1 (2015-12-08) monsterhooks.lua API

a guest Apr 28th, 2017 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- Stubs for global functions monster scripts can define, which will be called by C++
  2.  
  3. --- Called (once) when the monster is added to the world.
  4. --
  5. -- Note that the monster's position may not yet be valid.
  6. function init() end
  7.  
  8. --- Update loop handler, called once every scriptDelta (defined in *.monstertype) ticks
  9. function update(dt) end
  10.  
  11. --- Called when shouldDie has returned true and the monster and is about to be removed from the world
  12. function die() end
  13.  
  14. --- Called after the NPC has taken damage
  15. --
  16. -- @tab args Map of info about the damage, structured as:
  17. --    {
  18. --      sourceId = <entity id of entity that caused the damage>,
  19. --      damage = <numeric amount of damage that was taken>,
  20. --      sourceDamage = <numeric amount of damage that was originally dealt>,
  21. --      sourceKind = <string kind of damage being applied, as defined in "damageKind" value in a *.projectile config>
  22. --    }
  23. -- Note that "sourceDamage" can be higher than "damage" if - for
  24. -- instance - some damage was blocked by a shield.
  25. function damage(args) end
  26.  
  27. --- Called each update to determine if the monster should die.
  28. --
  29. -- If not defined in the monster's lua, will default to returning true when
  30. -- the monster's health has been depleted.
  31. --
  32. -- @treturn bool true if the monster can die, false to keep the monster alive
  33. function shouldDie() end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top