mirror of
https://github.com/minetest-mods/ropes.git
synced 2024-11-28 10:23:44 +01:00
Add loot mod support
This commit is contained in:
parent
e5c8f2048c
commit
21df7de34a
@ -2,4 +2,5 @@ default
|
||||
farming?
|
||||
vines?
|
||||
doc?
|
||||
intllib?
|
||||
intllib?
|
||||
loot?
|
32
init.lua
32
init.lua
@ -6,39 +6,19 @@ ropes = {
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
ropes.ropeLength = tonumber(minetest.setting_get("ropes_rope_length"))
|
||||
if not ropes.ropeLength then
|
||||
ropes.ropeLength = 50
|
||||
end
|
||||
|
||||
ropes.ropeLadderLength = tonumber(minetest.setting_get("ropes_rope_ladder_length"))
|
||||
if not ropes.ropeLadderLength then
|
||||
ropes.ropeLadderLength = 50
|
||||
end
|
||||
|
||||
ropes.woodRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_wood_rope_box_max_multiple"))
|
||||
if not ropes.woodRopeBoxMaxMultiple then
|
||||
ropes.woodRopeBoxMaxMultiple = 2
|
||||
end
|
||||
|
||||
ropes.copperRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_copper_rope_box_max_multiple"))
|
||||
if not ropes.copperRopeBoxMaxMultiple then
|
||||
ropes.copperRopeBoxMaxMultiple = 5
|
||||
end
|
||||
|
||||
ropes.steelRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_steel_rope_box_max_multiple"))
|
||||
if not ropes.steelRopeBoxMaxMultiple then
|
||||
ropes.steelRopeBoxMaxMultiple = 9
|
||||
end
|
||||
|
||||
ropes.ropeLength = tonumber(minetest.setting_get("ropes_rope_length")) or 50
|
||||
ropes.ropeLadderLength = tonumber(minetest.setting_get("ropes_rope_ladder_length")) or 50
|
||||
ropes.woodRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_wood_rope_box_max_multiple")) or 2
|
||||
ropes.copperRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_copper_rope_box_max_multiple")) or 5
|
||||
ropes.steelRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_steel_rope_box_max_multiple")) or 9
|
||||
ropes.create_all_definitions = minetest.setting_getbool("ropes_create_all_definitions")
|
||||
|
||||
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/doc.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/functions.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/crafts.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/ropeboxes.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/ladder.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/loot.lua" )
|
||||
|
||||
local upgrade_counter = 1
|
||||
-- For players who used to use the combined vine/rope mod fork I split this out of
|
||||
|
56
loot.lua
Normal file
56
loot.lua
Normal file
@ -0,0 +1,56 @@
|
||||
if not minetest.get_modpath("loot") then
|
||||
return
|
||||
end
|
||||
|
||||
loot.register_loot({
|
||||
weights = { generic = 200 },
|
||||
payload = {
|
||||
stack = ItemStack("ropes:ropesegment"),
|
||||
min_size = 1,
|
||||
max_size = 99,
|
||||
},
|
||||
})
|
||||
|
||||
if ropes.ropeLadderLength > 0 then
|
||||
loot.register_loot({
|
||||
weights = { generic = 100 },
|
||||
payload = {
|
||||
stack = ItemStack("ropes:ropeladder_top"),
|
||||
min_size = 1,
|
||||
max_size = 30,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
if ropes.woodRopeBoxMaxMultiple > 0 then
|
||||
loot.register_loot({
|
||||
weights = { generic = 200 },
|
||||
payload = {
|
||||
stack = ItemStack("ropes:wood1rope_block"),
|
||||
min_size = 1,
|
||||
max_size = 30,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
if ropes.copperRopeBoxMaxMultiple > 0 then
|
||||
loot.register_loot({
|
||||
weights = { generic = 100 },
|
||||
payload = {
|
||||
stack = ItemStack("ropes:copper1rope_block"),
|
||||
min_size = 1,
|
||||
max_size = 25,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
if ropes.steelRopeBoxMaxMultiple > 0 then
|
||||
loot.register_loot({
|
||||
weights = { generic = 50 },
|
||||
payload = {
|
||||
stack = ItemStack("ropes:steel1rope_block"),
|
||||
min_size = 1,
|
||||
max_size = 20,
|
||||
},
|
||||
})
|
||||
end
|
Loading…
Reference in New Issue
Block a user