Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | None | 0 0
  1. local MakePlayerCharacter = require "prefabs/player_common"
  2.  
  3. local assets = {
  4.  
  5. Asset( "ANIM", "anim/player_basic.zip" ),
  6. Asset( "ANIM", "anim/player_idles_shiver.zip" ),
  7. Asset( "ANIM", "anim/player_actions.zip" ),
  8. Asset( "ANIM", "anim/player_actions_axe.zip" ),
  9. Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),
  10. Asset( "ANIM", "anim/player_actions_shovel.zip" ),
  11. Asset( "ANIM", "anim/player_actions_blowdart.zip" ),
  12. Asset( "ANIM", "anim/player_actions_eat.zip" ),
  13. Asset( "ANIM", "anim/player_actions_item.zip" ),
  14. Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),
  15. Asset( "ANIM", "anim/player_actions_bugnet.zip" ),
  16. Asset( "ANIM", "anim/player_actions_fishing.zip" ),
  17. Asset( "ANIM", "anim/player_actions_boomerang.zip" ),
  18. Asset( "ANIM", "anim/player_bush_hat.zip" ),
  19. Asset( "ANIM", "anim/player_attacks.zip" ),
  20. Asset( "ANIM", "anim/player_idles.zip" ),
  21. Asset( "ANIM", "anim/player_rebirth.zip" ),
  22. Asset( "ANIM", "anim/player_jump.zip" ),
  23. Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),
  24. Asset( "ANIM", "anim/player_teleport.zip" ),
  25. Asset( "ANIM", "anim/wilson_fx.zip" ),
  26. Asset( "ANIM", "anim/player_one_man_band.zip" ),
  27. Asset( "ANIM", "anim/shadow_hands.zip" ),
  28. Asset( "SOUND", "sound/sfx.fsb" ),
  29. Asset( "SOUND", "sound/wilson.fsb" ),
  30. Asset( "ANIM", "anim/beard.zip" ),
  31. }
  32.  
  33.  
  34. local prefabs = {
  35. }
  36.  
  37. local start_inv = {
  38. -- Custom starting items
  39. }
  40.  
  41.  
  42. -- Heat Immunity function
  43. local function onstartoverheating(inst)
  44. inst.components.temperature:SetTemperature(23) -- Sets the temperature to 23ΒΊC
  45. end
  46.  
  47. -- Wetness Debuff function
  48. local function onmoisturedelta(inst)
  49. if inst.components.moisture:IsWet() then -- If the character is wet
  50. inst.components.sanity.dapperness = TUNING.DAPPERNESS_TINY*-1 -- Drain sanity at a rate of 1.33/minute
  51. else -- If the character is not wet
  52. inst.components.sanity.dapperness = 0 -- Reset the sanity drain to 0
  53. end
  54. end
  55.  
  56. -- Eating Meat Bonus
  57. local function oneat(inst, food)
  58. if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT then -- If it is food, edible, and meat
  59.  
  60. local healthvalue = food.components.edible.healthvalue -- Shortcuts for having to write only "healthvalue" instead of "food.components.edible.healthvalue"
  61. local hungervalue = food.components.edible.foodvalue
  62. local sanityvalue = food.components.edible.sanityvalue
  63.  
  64. if healthvalue and not healthvalue = 0 then -- If the food item has a health value, and it isn't 0
  65. if healthvalue >= 0 then -- If the food item's health value is over 0
  66. inst.components.health:DoDelta(healthvalue * 1.5) -- Multiplies food's health value by 1.5
  67. else -- If the food item's health value is below 0
  68. inst.components.health:DoDelta(healthvalue * -1.5) -- Multiplies food's health value by 1.5 and makes it positive
  69. end
  70. end
  71. if hungervalue and not hungervalue = 0 then
  72. if hungervalue >= 0 then
  73. inst.components.hunger:DoDelta(hungervalue * 1.5) -- Multiplies food's hunger value by 1.5
  74. else
  75. inst.components.hunger:DoDelta(hungervalue * -1.5) -- Multiplies food's hunger value by 1.5 and makes it positive
  76. end
  77. end
  78. if sanityvalue and not sanityvalue = 0 then
  79. if sanityvalue >= 0 then
  80. inst.components.sanity:DoDelta(sanityvalue * 1.5) -- Multiplies food's sanity value by 1.5
  81. else
  82. inst.components.sanity:DoDelta(sanityvalue * -1.5) -- Multiplies food's sanity value by 1.5 and makes it positive
  83. end
  84. end
  85. end
  86. end
  87.  
  88.  
  89. -- This initializes for both clients and the host
  90. local common_postinit = function(inst)
  91. inst.MiniMapEntity:SetIcon( "wilson.tex" ) -- Minimap icon
  92. end
  93.  
  94. -- This initializes for the host only
  95. local master_postinit = function(inst)
  96. inst.soundsname = "wilson" -- The sounds your character will play
  97.  
  98. -- Stats
  99. inst.components.health:SetMaxHealth(150) -- Base health
  100. inst.components.hunger:SetMax(150) -- Base hunger
  101. inst.components.sanity:SetMax(150) -- Base sanity
  102.  
  103. -- Fire Immunity
  104. inst.components.health.fire_damage_scale = TUNING.WILLOW_FIRE_DAMAGE -- Willow's fire immunity
  105. inst.components.health.fire_timestart = TUNING.WILLOW_FIRE_IMMUNITY -- Willow's fire immunity
  106.  
  107. -- Heat Immunity
  108. inst:ListenForEvent("startoverheating", onstartoverheating) -- Wait for the event saying the character starts overheating, and execute a function when it does
  109.  
  110. -- Wetness Debuff
  111. inst:ListenForEvent("moisturedelta", onmoisturedelta) -- Wait for the event saying the moisture of the character has changed, and execute a function when it does
  112.  
  113. -- Hounds don't attack you
  114. inst:AddTag("hound") -- Add the tag "hound" to the player
  115.  
  116. -- Add the eater component
  117. if inst.components.eater == nil then -- If the character doesn't have the component
  118. inst:AddComponent("eater") -- Add the component "eater" to let us execute a function when it eats
  119. end
  120. -- Execute a function when the character eats
  121. inst.components.eater:SetOnEatFn(oneat) -- Execute a function when the character eats
  122.  
  123. end
  124.  
  125. return MakePlayerCharacter("wilson", prefabs, assets, common_postinit, master_postinit, start_inv)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement