Guest User

Untitled

a guest
Jan 14th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. --Add this function anywhere in your lapis.lua file (workshop-712396897/scripts/prefabs/lapis.lua)
  2.    
  3. local function dotemperaturecheck(inst, dt)
  4.     local moisterpercent = inst.components.moisture.moisture/100
  5.     if moisterpercent > 0.01 then
  6.         if inst.components.sanity.current > 50 then
  7.             inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED*15*moisterpercent
  8.         elseif inst.components.sanity.current > 30 and inst.components.sanity.current <= 50 then
  9.             inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED*10*moisterpercent
  10.         elseif inst.components.sanity.current <= 30 then
  11.             inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED*5*moisterpercent
  12.         end
  13.        
  14.        
  15.     inst.components.temperature.mintemp = 1
  16.     inst.components.temperature.maxtemp = 69
  17.        
  18.        
  19.     else
  20.         inst.components.sanity.dapperness = 0
  21.         inst.components.temperature.mintemp = TUNING.MIN_ENTITY_TEMP
  22.         inst.components.temperature.maxtemp = TUNING.MAX_ENTITY_TEMP
  23.     end
  24. end
  25.  
  26. --Then, add this line to the top of the master_postinit function.
  27.  
  28. local master_postinit = function(inst)
  29.  
  30.     inst:DoPeriodicTask(1/10, function() dotemperaturecheck(inst, 1/10) end)
  31.    
  32.     ...
  33.  
  34. end
  35.  
  36. --This adds a function that asks how wet you are and changes your sanity rate according to that value, and then tells the server to periodically check that function.
Add Comment
Please, Sign In to add comment