Guest User

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

a guest
Apr 28th, 2017
142
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- Stubs for global functions NPC scripts can define, which will be called by C++
  2.  
  3. --- Called when the NPC is added to the world.
  4. function init() end
  5.  
  6. --- Update loop handler.
  7. -- Called once every `scriptDelta` (as defined in *.npctype) game ticks
  8. function update(dt) end
  9.  
  10. --- Called when the npc has died and is about to be removed.
  11. function die() end
  12.  
  13. --- Called after the NPC has taken damage.
  14. --
  15. -- @tab args Map of info about the damage, structured as:
  16. --    {
  17. --      sourceId = <entity id of entity that caused the damage>,
  18. --      damage = <numeric amount of damage that was taken>,
  19. --      sourceDamage = <numeric amount of damage that was originally dealt>,
  20. --      sourceKind = <string kind of damage being applied, as defined in "damageKind" value in a *.projectile config>
  21. --    }
  22. -- Note that "sourceDamage" can be higher than "damage" if - for instance -
  23. -- some damage was blocked by a shield.
  24. function damage(args) end
  25.  
  26. --- Called when the NPC is interacted with.
  27. -- Available interaction responses are:
  28. --    "OpenCockpitInterface"
  29. --    "SitDown"
  30. --    "OpenCraftingInterface"
  31. --    "OpenCookingInterface"
  32. --    "OpenTechInterface"
  33. --    "Teleport"
  34. --    "OpenSongbookInterface"
  35. --    "OpenNpcCraftingInterface"
  36. --    "OpenTech3DPrinterDialog"
  37. --    "ShowPopup"
  38. --    "ScriptConsole"
  39. --
  40. -- @tab args Map of interaction event arguments:
  41. --    {
  42. --      sourceId = <Entity id of the entity interacting with this NPC>
  43. --      sourcePosition = <The {x,y} position of the interacting entity>
  44. --    }
  45. --
  46. -- @return[1] nil (no interaction response)
  47. -- @treturn[2] string the interaction response that should be performed
  48. -- @treturn[3] array the interaction response and configuration:
  49. --    {
  50. --       <interaction response string>,
  51. --       <interaction response config table (map)>
  52. --    }
  53. function interact(args) end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×