trader_moretrees.lua 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. -------------------------------------------
  2. -- Traders for moretrees (and normal trees)
  3. --------------------------------------------
  4. -- without moretrees, you get only one lumberjack that sells default trees
  5. -- with moretrees, traders for all tree types are added as well: normal trees, birch, spruce, jungletree, fir, beech, apple_tree, oak, sequoia, palm, pine, willow, rubber_tree
  6. -- sell normal wood - rather expensive...
  7. mobf_trader.add_trader( mobf_trader.npc_trader_prototype,
  8. "Trader of common wood",
  9. "common_wood",
  10. {
  11. {"default:wood 4", "default:dirt 24", "default:cobble 24"},
  12. {"default:tree 4", "default:apple 2", "default:coal_lump 4"},
  13. {"default:tree 8", "default:pick_stone 1", "default:axe_stone 1"},
  14. {"default:tree 12", "default:cobble 80", "default:steel_ingot 1"},
  15. {"default:tree 36", "bucket:bucket_empty 1", "bucket:bucket_water 1"},
  16. {"default:tree 42", "default:axe_steel 1", "default:mese_crystal 4"},
  17. {"default:sapling 1", "default:dirt 10", "default:cobble 10"},
  18. {"default:leaves 10", "default:dirt 10", "default:cobble 10"}
  19. },
  20. { "lumberjack" },
  21. {"holzfaeller.png"}
  22. );
  23. -- not everyone has moretrees (though selling wood is one of the main purposes of this mod)
  24. if( minetest.get_modpath("moretrees") ~= nil ) then
  25. mobf_trader.add_trader( mobf_trader.npc_trader_prototype,
  26. "Trader of wood",
  27. "wood",
  28. {
  29. {"moretrees:birch_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  30. {"moretrees:spruce_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  31. {"moretrees:jungletree_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  32. {"moretrees:fir_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  33. {"moretrees:beech_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  34. {"moretrees:apple_tree_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  35. {"moretrees:oak_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  36. {"moretrees:sequoia_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  37. {"moretrees:palm_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  38. {"moretrees:pine_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  39. {"moretrees:willow_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  40. {"moretrees:rubber_tree_trunk 8", "default:cobble 80", "default:steel_ingot 1"},
  41. },
  42. { "Woody" },
  43. {"holzfaeller.png"}
  44. );
  45. -- add traders for the diffrent versions of wood
  46. for i,v in ipairs( {'birch', 'spruce', 'jungletree', 'fir', 'beech', 'apple_tree', 'oak', 'sequoia', 'palm', 'pine', 'willow', 'rubber_tree' }) do
  47. -- all trunk types cost equally much
  48. local goods = {
  49. {"moretrees:"..v.."_planks 4", "default:dirt 24", "default:cobble 24"},
  50. {"moretrees:"..v.."_trunk 4", "default:apple 2", "default:coal_lump 4"},
  51. {"moretrees:"..v.."_trunk 8", "default:pick_stone 1", "default:axe_stone 1"},
  52. {"moretrees:"..v.."_trunk 12", "default:cobble 80", "default:steel_ingot 1"},
  53. {"moretrees:"..v.."_trunk 36", "bucket:bucket_empty 1", "bucket:bucket_water 1"},
  54. {"moretrees:"..v.."_trunk 42", "default:axe_steel 1", "default:mese_crystal 4"},
  55. {"moretrees:"..v.."_sapling 1", "default:mese 10", "default:steel_ingot 48"},
  56. {"moretrees:"..v.."_leaves 10", "default:cobble 1", "default:dirt 2"}
  57. };
  58. -- sell the fruits of the trees (apples and coconuts have a slightly higher value than the rest)
  59. if( v=='oak' ) then
  60. table.insert( goods, { "moretrees:acorn 10", "default:cobble 10", "default:dirt 10"} );
  61. elseif( v=='palm' ) then
  62. table.insert( goods, { "moretrees:coconut 1", "default:cobble 10", "default:dirt 10"} );
  63. elseif( v=='spruce' ) then
  64. table.insert( goods, { "moretrees:spruce_cone 10", "default:cobble 10", "default:dirt 10"} );
  65. elseif( v=='pine' ) then
  66. table.insert( goods, { "moretrees:pine_cone 10", "default:cobble 10", "default:dirt 10"} );
  67. elseif( v=='fir' ) then
  68. table.insert( goods, { "moretrees:fir_cone 10", "default:cobble 10", "default:dirt 10"} );
  69. elseif( v=='apple_tree' ) then
  70. table.insert( goods, { "default:apple 1", "default:cobble 10", "default:dirt 10"} );
  71. end
  72. -- TODO: rubber_tree: sell rubber? (or rather do so in the farmingplus-trader?)
  73. mobf_trader.add_trader( mobf_trader.npc_trader_prototype,
  74. "Trader of "..( v or "unknown" ).." wood",
  75. v.."_wood",
  76. goods,
  77. { "lumberjack" },
  78. {"holzfaeller.png"}
  79. );
  80. end
  81. end