Guest User

Untitled

a guest
Jan 11th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 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 == "/sad" then self.sademote = v end
  9.     end
  10. end)
  11.  
  12. function Crazyfear:OnUpdate(dt)
  13.  
  14.     if self.inst.components.sanity and self.inst.components.sanity:GetPercent() < TUNING.WILLOW_LIGHTFIRE_SANITY_THRESH then
  15.    
  16.             if not self.isspeedy then
  17.                 self.isspeedy = true
  18.                 self.inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED*2.00
  19.                 self.inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*2.00
  20.                 self.inst.components.health:SetMaxHealth(300)
  21.             end
  22.         else
  23.  
  24.             if self.isspeedy then
  25.                 self.isspeedy = false
  26.                 self.inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED*1.00
  27.                 self.inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*1.00
  28.                 self.inst.components.health:SetMaxHealth(200)
  29.             end
  30.     end
  31.  
  32.  
  33.     if self.inst.components.sanity and self.inst.components.sanity:GetPercent() < TUNING.WILLOW_LIGHTFIRE_SANITY_THRESH * 2 then
  34.  
  35.         self.time_to_sad = self.time_to_sad - dt
  36.  
  37.         if self.time_to_sad <= 0 then
  38.         self.inst:PushEvent("emote", self.sademote)
  39.         self.time_to_sad = 120*math.random()+120
  40.         end
  41.  
  42.     end
  43.  
  44.  
  45.  
  46. end
  47.  
  48. return Crazyfear
Advertisement
Add Comment
Please, Sign In to add comment