Advertisement
Starly124

Untitled

Feb 23rd, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. local assets=
  2. {
  3. Asset("ANIM", "anim/frog_legs.zip"),
  4. }
  5.  
  6.  
  7. local prefabs =
  8. {
  9. "froglegs_cooked",
  10. }
  11.  
  12. local function commonfn()
  13. local inst = CreateEntity()
  14. inst.entity:AddTransform()
  15. inst.entity:AddAnimState()
  16. inst.AnimState:SetBank("frog_legs")
  17. inst.AnimState:SetBuild("frog_legs")
  18.  
  19. MakeInventoryPhysics(inst)
  20.  
  21. inst:AddTag("smallmeat")
  22. inst:AddComponent("edible")
  23. inst.components.edible.foodtype = "MEAT"
  24.  
  25.  
  26. inst:AddComponent("perishable")
  27. inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
  28. inst.components.perishable:StartPerishing()
  29. inst.components.perishable.onperishreplacement = "spoiled_food"
  30.  
  31. inst:AddComponent("stackable")
  32. inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM
  33.  
  34. inst:AddComponent("bait")
  35.  
  36. inst:AddComponent("inspectable")
  37.  
  38. inst:AddComponent("inventoryitem")
  39.  
  40. inst:AddComponent("tradable")
  41. inst.components.tradable.goldvalue = 0
  42.  
  43.  
  44. return inst
  45. end
  46.  
  47. local function defaultfn()
  48. local inst = commonfn()
  49. inst.AnimState:PlayAnimation("idle")
  50.  
  51. inst.components.edible.healthvalue = 0
  52. inst.components.edible.hungervalue = TUNING.CALORIES_SMALL
  53. inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
  54. inst.components.edible.sanityvalue = -TUNING.SANITY_SMALL
  55.  
  56.  
  57. inst:AddComponent("cookable")
  58. inst.components.cookable.product = "froglegs_cooked"
  59. inst:AddComponent("dryable")
  60. inst.components.dryable:SetProduct("smallmeat_dried")
  61. inst.components.dryable:SetDryTime(TUNING.DRY_FAST)
  62. return inst
  63. end
  64.  
  65. local function cookedfn()
  66. local inst = commonfn()
  67. inst.AnimState:PlayAnimation("cooked")
  68.  
  69. inst.components.edible.healthvalue = TUNING.HEALING_TINY
  70. inst.components.edible.hungervalue = TUNING.CALORIES_SMALL
  71. inst.components.perishable:SetPerishTime(TUNING.PERISH_MED)
  72.  
  73. return inst
  74. end
  75.  
  76. return Prefab("common/inventory/froglegs", defaultfn, assets, prefabs),
  77. Prefab("common/inventory/froglegs_cooked", cookedfn, assets)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement