Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. local assets =
  2. {
  3. Asset("ANIM", "anim/myamulets.zip"),
  4. Asset("ANIM", "anim/torso_myamulets.zip"),
  5. Asset("ATLAS", "images/inventoryimages/skullamulet.xml"),
  6. Asset("IMAGE", "images/inventoryimages/skullamulet.tex"),
  7. }
  8.  
  9. local function onequip(inst, owner)
  10. owner.AnimState:OverrideSymbol("swap_body", "torso_myamulets", "skullamulet")
  11.  
  12. if inst.components.fueled then
  13. inst.components.fueled:StartConsuming()
  14. end
  15.  
  16. owner.components.combat.damagemultiplier = 1+.5
  17. owner.components.health:SetAbsorptionAmount(-(TUNING.WATHGRITHR_ABSORPTION*120))
  18.  
  19. end
  20.  
  21. local function onunequip(inst, owner)
  22. owner.AnimState:ClearOverrideSymbol("swap_body")
  23.  
  24. if inst.components.fueled then
  25. inst.components.fueled:StopConsuming()
  26. end
  27.  
  28. owner.components.combat.damagemultiplier = 1
  29. owner.components.health:SetAbsorptionAmount(0)
  30. end
  31.  
  32.  
  33. local function fn()
  34. local inst = CreateEntity()
  35.  
  36. inst.entity:AddTransform()
  37. inst.entity:AddAnimState()
  38. inst.entity:AddNetwork()
  39.  
  40. MakeInventoryPhysics(inst)
  41.  
  42. inst.AnimState:SetBank("amulets")
  43. inst.AnimState:SetBuild("myamulets")
  44. inst.AnimState:PlayAnimation("skullamulet")
  45.  
  46. inst.entity:SetPristine()
  47.  
  48. if not TheWorld.ismastersim then
  49. return inst
  50. end
  51.  
  52. inst:AddComponent("fueled")
  53. inst.components.fueled.fueltype = FUELTYPE.MAGIC
  54. inst.components.fueled:InitializeFuelLevel(TUNING.RAINCOAT_PERISHTIME)
  55. inst.components.fueled:SetDepletedFn(inst.Remove)
  56.  
  57. inst:AddComponent("inspectable")
  58.  
  59. inst:AddComponent("inventoryitem")
  60. inst.components.inventoryitem.imagename = "skullamulet"
  61. inst.components.inventoryitem.atlasname = "images/inventoryimages/skullamulet.xml"
  62.  
  63. inst:AddComponent("equippable")
  64. inst.components.equippable.equipslot = EQUIPSLOTS.NECK or EQUIPSLOTS.BODY
  65. inst.components.equippable.dapperness = -TUNING.DAPPERNESS_HUGE
  66. inst.components.equippable.walkspeedmult = 1.4
  67.  
  68. inst.components.equippable:SetOnEquip( onequip )
  69. inst.components.equippable:SetOnUnequip( onunequip )
  70.  
  71. MakeHauntableLaunch(inst)
  72.  
  73. return inst
  74. end
  75.  
  76. return Prefab( "skullamulet", fn, assets, prefabs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement