More cleanup.
parent
fe3463e3c9
commit
ff1a588e90
485
init.lua
485
init.lua
|
@ -11,142 +11,26 @@ mod.version = '20190720'
|
|||
mod.path = minetest.get_modpath(minetest.get_current_modname())
|
||||
mod.world = minetest.get_worldpath()
|
||||
mod.dat = {}
|
||||
mod.magic_ingredient = 'default:mese_crystal' -- Hmmm.... ?
|
||||
|
||||
|
||||
local sorted_items
|
||||
|
||||
|
||||
local ADD_SCROLL_TO_DEFAULT_CHEST = true
|
||||
local sorted_items
|
||||
local WORN_INV = 'worn'
|
||||
local FLIGHT_PRIV = false
|
||||
local GRAVITY_OFF = { gravity = 0.1 }
|
||||
local GRAVITY_ON = { gravity = 1 }
|
||||
local PROTECT_INVENTORY = false -- Prevent ANY inventory loss.
|
||||
local WORN_INV = 'worn'
|
||||
|
||||
|
||||
minetest.register_craftitem(mod_name..':bag_small', {
|
||||
inventory_image = 'bags_small.png',
|
||||
stack_max = 1,
|
||||
_dinv_storage_size = 8,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':bag_medium', {
|
||||
inventory_image = 'bags_medium.png',
|
||||
stack_max = 1,
|
||||
_dinv_storage_size = 16,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':bag_large', {
|
||||
inventory_image = 'bags_large.png',
|
||||
stack_max = 1,
|
||||
_dinv_storage_size = 24,
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':leather_armor', {
|
||||
inventory_image = 'leather_armour1.png',
|
||||
description = 'Leather Armor',
|
||||
_dinv_armor = 0.9,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_leather_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':boots', {
|
||||
inventory_image = 'boots1_brown.png',
|
||||
description = 'Sturdy Boots',
|
||||
_dinv_armor = 0.95,
|
||||
_dinv_location = 'feet',
|
||||
_dinv_texture = 'dinv_char_boots.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':leather_cap', {
|
||||
inventory_image = 'elven_leather_helm.png',
|
||||
description = 'Leather Cap',
|
||||
_dinv_armor = 0.9,
|
||||
_dinv_location = 'head',
|
||||
_dinv_texture = 'dinv_char_leather_helm.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':steel_helmet', {
|
||||
inventory_image = 'helmet1.png',
|
||||
description = 'Steel Helmet',
|
||||
_dinv_armor = 0.8,
|
||||
_dinv_location = 'head',
|
||||
_dinv_texture = 'dinv_char_steel_helm.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':ring_protection_9', {
|
||||
inventory_image = 'anvil.png',
|
||||
description = 'Ring of Protection',
|
||||
_dinv_armor = 0.9,
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':ring_flight', {
|
||||
inventory_image = 'glass.png',
|
||||
description = 'Ring of Flight',
|
||||
_dinv_wears_out = 1000,
|
||||
_dinv_on_wear = function(player)
|
||||
mod.modify_privs(player, { fly = true, noclip = 0 })
|
||||
end,
|
||||
_dinv_on_remove = function(player)
|
||||
mod.modify_privs(player, { fly = 0, noclip = 0 })
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':wood_shield', {
|
||||
inventory_image = 'buckler1.png',
|
||||
description = 'Wooden Shield',
|
||||
_dinv_armor = 0.8,
|
||||
_dinv_location = 'arm',
|
||||
_dinv_texture = 'dinv_char_wood_shield.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':steel_shield', {
|
||||
inventory_image = 'lshield_dd_dk.png',
|
||||
description = 'Steel Shield',
|
||||
_dinv_armor = 0.7,
|
||||
_dinv_location = 'arm',
|
||||
_dinv_texture = 'dinv_char_steel_shield.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':chain_armor', {
|
||||
inventory_image = 'chain_mail1.png',
|
||||
description = 'Chain Mail',
|
||||
_dinv_armor = 0.75,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_chain_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':plate_armor', {
|
||||
inventory_image = 'plate1.png',
|
||||
description = 'Plate Mail',
|
||||
_dinv_armor = 0.6,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_plate_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':diamond_plate_armor', {
|
||||
inventory_image = 'crystal_plate2.png',
|
||||
description = 'Diamond Plate Mail',
|
||||
_dinv_armor = 0.45,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_diamond_plate_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':fur_cloak', {
|
||||
inventory_image = 'dinv_fur_cloak.png',
|
||||
description = 'Fur Cloak',
|
||||
_dinv_armor = 0.98,
|
||||
_dinv_warmth = 2,
|
||||
_dinv_location = 'back',
|
||||
_dinv_texture = 'dinv_char_fur_cloak.png',
|
||||
})
|
||||
|
||||
--print(dump(minetest.registered_tools[mod_name..':plate_armor']))
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':bag_small',
|
||||
recipe = {
|
||||
{'', 'farming:string', ''},
|
||||
{'group:wool', 'group:wool', 'group:wool'},
|
||||
{'group:wool', 'group:wool', 'group:wool'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':bag_medium',
|
||||
recipe = {
|
||||
|
@ -156,6 +40,12 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':bag_large', {
|
||||
inventory_image = 'bags_large.png',
|
||||
stack_max = 1,
|
||||
_dinv_storage_size = 24,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':bag_large',
|
||||
recipe = {
|
||||
|
@ -165,40 +55,28 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':leather_armor',
|
||||
recipe = {
|
||||
{'', 'mobs:leather', 'mobs:wax'},
|
||||
{'mobs:leather', 'farming:string', 'mobs:leather'},
|
||||
{'mobs:leather', 'farming:string', 'mobs:leather'},
|
||||
},
|
||||
minetest.register_craftitem(mod_name..':bag_small', {
|
||||
inventory_image = 'bags_small.png',
|
||||
stack_max = 1,
|
||||
_dinv_storage_size = 8,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':fur_cloak',
|
||||
output = mod_name..':bag_small',
|
||||
recipe = {
|
||||
{'', 'mobs:fur', ''},
|
||||
{'mobs:fur', 'farming:string', 'mobs:fur'},
|
||||
{'mobs:fur', '', 'mobs:fur'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':leather_cap',
|
||||
recipe = {
|
||||
{'', 'mobs:leather', ''},
|
||||
{'', 'mobs:leather', 'mobs:wax'},
|
||||
{'', 'farming:string', ''},
|
||||
{'group:wool', 'group:wool', 'group:wool'},
|
||||
{'group:wool', 'group:wool', 'group:wool'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':steel_helmet',
|
||||
recipe = {
|
||||
{'', 'default:steel_ingot', ''},
|
||||
{'default:steel_ingot', 'mobs:leather', 'default:steel_ingot'},
|
||||
{'', 'mobs:fur', ''},
|
||||
},
|
||||
|
||||
minetest.register_tool(mod_name..':boots', {
|
||||
inventory_image = 'boots1_brown.png',
|
||||
description = 'Sturdy Boots',
|
||||
_dinv_armor = 0.95,
|
||||
_dinv_location = 'feet',
|
||||
_dinv_texture = 'dinv_char_boots.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -210,61 +88,12 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':wood_shield',
|
||||
recipe = {
|
||||
{'', 'group:wood', ''},
|
||||
{'group:wood', 'mobs:leather', 'group:wood'},
|
||||
{'', 'group:wood', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':steel_shield',
|
||||
recipe = {
|
||||
{'', mod_name..':steel_plate', ''},
|
||||
{ mod_name..':steel_plate', 'mobs:leather', mod_name..':steel_plate'},
|
||||
{'', mod_name..':steel_plate', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':steel_rings', {
|
||||
inventory_image = 'dinv_steel_rings.png',
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':steel_plate', {
|
||||
inventory_image = 'dinv_steel_plate.png',
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':diamond_plate', {
|
||||
inventory_image = 'dinv_diamond_plate.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':steel_rings',
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:steel_ingot', 'default:coal_lump', 'default:steel_ingot'},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':steel_plate',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:coal_lump', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':diamond_plate',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond', 'default:diamond'},
|
||||
{'default:diamond', 'default:mese_crystal', 'default:diamond'},
|
||||
{'default:diamond', 'default:diamond', 'default:diamond'},
|
||||
},
|
||||
minetest.register_tool(mod_name..':chain_armor', {
|
||||
inventory_image = 'chain_mail1.png',
|
||||
description = 'Chain Mail',
|
||||
_dinv_armor = 0.75,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_chain_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -276,6 +105,96 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':diamond_plate', {
|
||||
inventory_image = 'dinv_diamond_plate.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':diamond_plate',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond', 'default:diamond'},
|
||||
{'default:diamond', 'default:mese_crystal', 'default:diamond'},
|
||||
{'default:diamond', 'default:diamond', 'default:diamond'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':diamond_plate_armor', {
|
||||
inventory_image = 'crystal_plate2.png',
|
||||
description = 'Diamond Plate Mail',
|
||||
_dinv_armor = 0.45,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_diamond_plate_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':diamond_plate_armor',
|
||||
recipe = {
|
||||
{'', mod_name..':diamond_plate', ''},
|
||||
{mod_name..':diamond_plate', mod_name..':chain_armor', mod_name..':diamond_plate'},
|
||||
{mod_name..':diamond_plate', 'default:mese', mod_name..':diamond_plate'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':fur_cloak', {
|
||||
inventory_image = 'dinv_fur_cloak.png',
|
||||
description = 'Fur Cloak',
|
||||
_dinv_armor = 0.98,
|
||||
_dinv_warmth = 2,
|
||||
_dinv_location = 'back',
|
||||
_dinv_texture = 'dinv_char_fur_cloak.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':fur_cloak',
|
||||
recipe = {
|
||||
{'', 'mobs:fur', ''},
|
||||
{'mobs:fur', 'farming:string', 'mobs:fur'},
|
||||
{'mobs:fur', '', 'mobs:fur'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':leather_armor', {
|
||||
inventory_image = 'leather_armour1.png',
|
||||
description = 'Leather Armor',
|
||||
_dinv_armor = 0.9,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_leather_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':leather_armor',
|
||||
recipe = {
|
||||
{'', 'mobs:leather', 'mobs:wax'},
|
||||
{'mobs:leather', 'farming:string', 'mobs:leather'},
|
||||
{'mobs:leather', 'farming:string', 'mobs:leather'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':leather_cap', {
|
||||
inventory_image = 'elven_leather_helm.png',
|
||||
description = 'Leather Cap',
|
||||
_dinv_armor = 0.9,
|
||||
_dinv_location = 'head',
|
||||
_dinv_texture = 'dinv_char_leather_helm.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':leather_cap',
|
||||
recipe = {
|
||||
{'', 'mobs:leather', ''},
|
||||
{'', 'mobs:leather', 'mobs:wax'},
|
||||
{'', 'farming:string', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':plate_armor', {
|
||||
inventory_image = 'plate1.png',
|
||||
description = 'Plate Mail',
|
||||
_dinv_armor = 0.6,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_plate_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':plate_armor',
|
||||
recipe = {
|
||||
|
@ -285,12 +204,153 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':steel_helmet', {
|
||||
inventory_image = 'helmet1.png',
|
||||
description = 'Steel Helmet',
|
||||
_dinv_armor = 0.8,
|
||||
_dinv_location = 'head',
|
||||
_dinv_texture = 'dinv_char_steel_helm.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':diamond_plate_armor',
|
||||
output = mod_name..':steel_helmet',
|
||||
recipe = {
|
||||
{'', mod_name..':diamond_plate', ''},
|
||||
{mod_name..':diamond_plate', mod_name..':chain_armor', mod_name..':diamond_plate'},
|
||||
{mod_name..':diamond_plate', 'default:mese', mod_name..':diamond_plate'},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
{'default:steel_ingot', 'mobs:leather', 'default:steel_ingot'},
|
||||
{'', 'mobs:fur', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':steel_plate', {
|
||||
inventory_image = 'dinv_steel_plate.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':steel_plate',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:coal_lump', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem(mod_name..':steel_rings', {
|
||||
inventory_image = 'dinv_steel_rings.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':steel_rings',
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:steel_ingot', 'default:coal_lump', 'default:steel_ingot'},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':steel_shield', {
|
||||
inventory_image = 'lshield_dd_dk.png',
|
||||
description = 'Steel Shield',
|
||||
_dinv_armor = 0.7,
|
||||
_dinv_location = 'arm',
|
||||
_dinv_texture = 'dinv_char_steel_shield.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':steel_shield',
|
||||
recipe = {
|
||||
{'', mod_name..':steel_plate', ''},
|
||||
{ mod_name..':steel_plate', 'mobs:leather', mod_name..':steel_plate'},
|
||||
{'', mod_name..':steel_plate', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':wood_shield', {
|
||||
inventory_image = 'buckler1.png',
|
||||
description = 'Wooden Shield',
|
||||
_dinv_armor = 0.8,
|
||||
_dinv_location = 'arm',
|
||||
_dinv_texture = 'dinv_char_wood_shield.png',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_name..':wood_shield',
|
||||
recipe = {
|
||||
{'', 'group:wood', ''},
|
||||
{'group:wood', 'mobs:leather', 'group:wood'},
|
||||
{'', 'group:wood', ''},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_tool(mod_name..':ring_breath', {
|
||||
inventory_image = 'coral.png',
|
||||
description = 'Ring of Breath',
|
||||
_dinv_wears_out = 91, -- 1 hour
|
||||
_dinv_while_worn = function(player)
|
||||
player:set_breath(11)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = mod_name..':ring_breath',
|
||||
recipe = {
|
||||
mod.magic_ingredient,
|
||||
'default:coral_skeleton',
|
||||
'default:gold_ingot',
|
||||
},
|
||||
})
|
||||
|
||||
if FLIGHT_PRIV then
|
||||
minetest.register_tool(mod_name..':ring_flight', {
|
||||
inventory_image = 'glass.png',
|
||||
description = 'Ring of Flight',
|
||||
_dinv_wears_out = 546, -- 10 minutes
|
||||
_dinv_on_wear = function(player)
|
||||
mod.modify_privs(player, { fly = true, noclip = 0 })
|
||||
end,
|
||||
_dinv_on_remove = function(player)
|
||||
mod.modify_privs(player, { fly = 0, noclip = 0 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_tool(mod_name..':ring_leap', {
|
||||
inventory_image = 'tiger_eye.png',
|
||||
description = 'Ring of Leaping',
|
||||
_dinv_wears_out = 273, -- 20 minutes
|
||||
_dinv_on_wear = function(player)
|
||||
player:set_physics_override(GRAVITY_OFF)
|
||||
end,
|
||||
_dinv_on_remove = function(player)
|
||||
player:set_physics_override(GRAVITY_ON)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = mod_name..':ring_leap',
|
||||
recipe = {
|
||||
mod.magic_ingredient,
|
||||
'flowers:mushroom_red',
|
||||
'default:gold_ingot',
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':ring_protection_9', {
|
||||
inventory_image = 'anvil.png',
|
||||
description = 'Ring of Protection',
|
||||
_dinv_location = 'protection_finger', -- Only one per person!
|
||||
_dinv_armor = 0.9,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = mod_name..':ring_protection_9',
|
||||
recipe = {
|
||||
mod.magic_ingredient,
|
||||
'default:diamond',
|
||||
'default:gold_ingot',
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -586,7 +646,8 @@ mod.wearable = { }
|
|||
function mod.populate_wearable_table()
|
||||
for k, v in pairs(minetest.registered_items) do
|
||||
if v._dinv_armor or v._dinv_storage_size
|
||||
or v._dinv_on_wear or v._dinv_on_remove then
|
||||
or v._dinv_on_wear or v._dinv_on_remove
|
||||
or v._dinv_while_worn then
|
||||
mod.wearable[k] = true
|
||||
end
|
||||
end
|
||||
|
@ -984,6 +1045,10 @@ minetest.register_globalstep(function(dtime)
|
|||
mod.set_armor_textures(player)
|
||||
--]]
|
||||
end
|
||||
|
||||
if it._dinv_while_worn then
|
||||
it._dinv_while_worn(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 464 B |
Binary file not shown.
After Width: | Height: | Size: 486 B |
Loading…
Reference in New Issue