Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. State{
  2. name = "play_flute",
  3. tags = { "doing", "playing" },
  4.  
  5. onenter = function(inst)
  6. inst.components.locomotor:Stop()
  7. inst.AnimState:PlayAnimation("action_uniqueitem_pre")
  8. inst.AnimState:PushAnimation("flute", false)
  9. inst.AnimState:OverrideSymbol("pan_flute01", "pan_flute", "pan_flute01")
  10. inst.AnimState:Hide("ARM_carry")
  11. inst.AnimState:Show("ARM_normal")
  12. if inst.components.inventory.activeitem and inst.components.inventory.activeitem.components.instrument then
  13. inst.components.inventory:ReturnActiveItem()
  14. end
  15. end,
  16.  
  17. timeline =
  18. {
  19. TimeEvent(30*FRAMES, function(inst)
  20. inst.SoundEmitter:PlaySound("dontstarve/wilson/flute_LP", "flute")
  21. inst:PerformBufferedAction()
  22. end),
  23. TimeEvent(85*FRAMES, function(inst)
  24. inst.SoundEmitter:KillSound("flute")
  25. end),
  26. },
  27.  
  28. events =
  29. {
  30. EventHandler("animqueueover", function(inst)
  31. if inst.AnimState:AnimDone() then
  32. inst.sg:GoToState("idle")
  33. end
  34. end),
  35. },
  36.  
  37. onexit = function(inst)
  38. inst.SoundEmitter:KillSound("flute")
  39. if inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) then
  40. inst.AnimState:Show("ARM_carry")
  41. inst.AnimState:Hide("ARM_normal")
  42. end
  43. end,
  44. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement