Guest User

Untitled

a guest
Jan 10th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. local Crazyfear = Class(function(self, inst)
  2.     self.inst = inst
  3.     self.time_to_sad = 60
  4.     self.inst:StartUpdatingComponent(self)
  5.     self.sademote = nil
  6.     self.isspeedy = false
  7.     for k,v in pairs(EMOTES) do
  8.         if v.command == "/bye" then self.sademote = v end
  9.     end
  10. end)
  11.  
  12. function Crazyfear:OnUpdate(dt)
  13.     if self.inst.components.sanity and self.inst.components.sanity:GetPercent() < TUNING.WILLOW_LIGHTFIRE_SANITY_THRESH then
  14.         if not self.isspeedy then
  15.             self.isspeedy = true
  16.             self.inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED*2.00
  17.             self.inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*2.00
  18.             self.inst.components.health:SetMaxHealth(300)
  19.         end
  20.          
  21.         self.time_to_sad = self.time_to_sad - dt
  22.  
  23.         if self.time_to_sad <= 0 then
  24.             self.inst:PushEvent("emote", self.sademote)
  25.             self.time_to_sad = 120*math.random()+120
  26.         end
  27.     else
  28.         if self.isspeedy then
  29.             self.isspeedy = false
  30.             self.inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
  31.             self.inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
  32.             self.inst.components.health:SetMaxHealth(200)
  33.         end
  34.     end
  35. end
  36.  
  37. return Crazyfear
Advertisement
Add Comment
Please, Sign In to add comment