Use get_current_mod_name where applicable, fix damage groups

This commit is contained in:
Evert Prants 2018-04-05 12:54:07 +03:00
parent 1ed78f83b7
commit a6f8bd52fd
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
5 changed files with 22 additions and 18 deletions

View File

@ -16,9 +16,10 @@ end
function fluidity.register_molten_metal(metal)
local description = firstToUpper(metal)
fluidity.molten_metals[metal] = "fluidity:"..metal.."_source"
local mod_name = minetest.get_current_modname()
fluidity.molten_metals[metal] = mod_name..":"..metal.."_source"
minetest.register_node("fluidity:"..metal.."_source", {
minetest.register_node(mod_name..":"..metal.."_source", {
description = "Molten "..description.." Source",
drawtype = "liquid",
tiles = {
@ -54,8 +55,8 @@ function fluidity.register_molten_metal(metal)
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "fluidity:"..metal.."_flowing",
liquid_alternative_source = "fluidity:"..metal.."_source",
liquid_alternative_flowing = mod_name..":"..metal.."_flowing",
liquid_alternative_source = mod_name..":"..metal.."_source",
liquid_viscosity = 7,
liquid_renewable = false,
damage_per_second = 4 * 2,
@ -63,7 +64,7 @@ function fluidity.register_molten_metal(metal)
groups = {molten_metal = 1, lava = 1, liquid = 2, igniter = 1},
})
minetest.register_node("fluidity:"..metal.."_flowing", {
minetest.register_node(mod_name..":"..metal.."_flowing", {
description = "Flowing Molten "..description,
drawtype = "flowingliquid",
tiles = {"fluidity_"..metal..".png"},
@ -100,8 +101,8 @@ function fluidity.register_molten_metal(metal)
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "fluidity:"..metal.."_flowing",
liquid_alternative_source = "fluidity:"..metal.."_source",
liquid_alternative_flowing = mod_name..":"..metal.."_flowing",
liquid_alternative_source = mod_name..":"..metal.."_source",
liquid_viscosity = 7,
liquid_renewable = false,
damage_per_second = 4 * 2,
@ -111,10 +112,10 @@ function fluidity.register_molten_metal(metal)
})
bucket.register_liquid(
"fluidity:"..metal.."_source",
"fluidity:"..metal.."_flowing",
"fluidity:bucket_"..metal,
"fluidity_bucket_"..metal..".png",
mod_name..":"..metal.."_source",
mod_name..":"..metal.."_flowing",
mod_name..":bucket_"..metal,
mod_name.."_bucket_"..metal..".png",
"Molten "..description.." Bucket"
)
end

View File

@ -125,7 +125,7 @@ end
-- Register a new tank
function fluidity.register_fluid_tank(data)
local modname = data.mod_name or 'fluidity'
local modname = data.mod_name or minetest.get_current_modname()
local tankname = data.tank_name or 'fluid_tank'
local tankdesc = data.tank_description or 'Fluid Tank'
local tiles = data.tiles or {"default_glass.png", "default_glass_detail.png"}

View File

@ -345,7 +345,7 @@ local function caster_node_timer(pos, elapsed)
local mtype, ctype = get_cast_for(caststack)
if mtype and ctype then
local cmod = metal_caster.casts[ctype].mod_name or "metal_melter"
local stack = ItemStack(cmod..":"..ctype)
local stack = ItemStack(cmod..":"..ctype.."_cast")
local output_stack = inv:get_stack("output", 1)
local cast_stack = inv:get_stack("cast", 1)
if output_stack:item_fits(stack) then
@ -414,7 +414,7 @@ end
-- Register a new cast
function metal_caster.register_cast(name, data)
local mod = data.mod_name or "metal_melter"
local mod = data.mod_name or minetest.get_current_modname()
local castname = mod..":"..name.."_cast"
minetest.register_craftitem(castname, {
@ -425,6 +425,7 @@ function metal_caster.register_cast(name, data)
})
if not metal_caster.casts[name] then
data.mod_name = mod
metal_caster.casts[name] = data
end

View File

@ -2,7 +2,7 @@ tinkering.pattern = {}
-- Register a new pattern
function tinkering.register_pattern(name, data)
local mod = data.mod_name or "tinkering"
local mod = data.mod_name or minetest.get_current_modname()
local desc = data.description
tinkering.pattern[name] = data

View File

@ -89,7 +89,7 @@ end
-- Register a new tool component
function tinkering.register_component(name, data)
local mod = data.mod_name or "tinkering"
local mod = data.mod_name or minetest.get_current_modname()
if not tinkering.components[name] then
tinkering.components[name] = data
@ -282,7 +282,7 @@ function tinkering.get_tool_capabilities(tool_type, materials)
full_punch_interval = 1.0,
max_drop_level = 0,
groupcaps = fg,
damagegroups = fd,
damage_groups = fd,
}
-- Construct the name
@ -309,12 +309,14 @@ function tinkering.tool_definition(tool_type, materials)
-- Store materials to use in metadata
local tink_mats = ""
for i, m in pairs(materials) do
local i = 1
for _, m in pairs(materials) do
if i == 1 then
tink_mats = m
else
tink_mats = tink_mats..","..m
end
i = i + 1
end
return tool_tree, tink_mats, tags