Use get_current_mod_name where applicable, fix damage groups

This commit is contained in:
Evert 2018-04-05 12:54:07 +03:00
parent 1ed78f83b7
commit a6f8bd52fd
No known key found for this signature in database
GPG Key ID: 1688DA83D222D0B5
5 changed files with 22 additions and 18 deletions

@ -16,9 +16,10 @@ end
function fluidity.register_molten_metal(metal) function fluidity.register_molten_metal(metal)
local description = firstToUpper(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", description = "Molten "..description.." Source",
drawtype = "liquid", drawtype = "liquid",
tiles = { tiles = {
@ -54,8 +55,8 @@ function fluidity.register_molten_metal(metal)
drop = "", drop = "",
drowning = 1, drowning = 1,
liquidtype = "source", liquidtype = "source",
liquid_alternative_flowing = "fluidity:"..metal.."_flowing", liquid_alternative_flowing = mod_name..":"..metal.."_flowing",
liquid_alternative_source = "fluidity:"..metal.."_source", liquid_alternative_source = mod_name..":"..metal.."_source",
liquid_viscosity = 7, liquid_viscosity = 7,
liquid_renewable = false, liquid_renewable = false,
damage_per_second = 4 * 2, 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}, 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, description = "Flowing Molten "..description,
drawtype = "flowingliquid", drawtype = "flowingliquid",
tiles = {"fluidity_"..metal..".png"}, tiles = {"fluidity_"..metal..".png"},
@ -100,8 +101,8 @@ function fluidity.register_molten_metal(metal)
drop = "", drop = "",
drowning = 1, drowning = 1,
liquidtype = "flowing", liquidtype = "flowing",
liquid_alternative_flowing = "fluidity:"..metal.."_flowing", liquid_alternative_flowing = mod_name..":"..metal.."_flowing",
liquid_alternative_source = "fluidity:"..metal.."_source", liquid_alternative_source = mod_name..":"..metal.."_source",
liquid_viscosity = 7, liquid_viscosity = 7,
liquid_renewable = false, liquid_renewable = false,
damage_per_second = 4 * 2, damage_per_second = 4 * 2,
@ -111,10 +112,10 @@ function fluidity.register_molten_metal(metal)
}) })
bucket.register_liquid( bucket.register_liquid(
"fluidity:"..metal.."_source", mod_name..":"..metal.."_source",
"fluidity:"..metal.."_flowing", mod_name..":"..metal.."_flowing",
"fluidity:bucket_"..metal, mod_name..":bucket_"..metal,
"fluidity_bucket_"..metal..".png", mod_name.."_bucket_"..metal..".png",
"Molten "..description.." Bucket" "Molten "..description.." Bucket"
) )
end end

@ -125,7 +125,7 @@ end
-- Register a new tank -- Register a new tank
function fluidity.register_fluid_tank(data) 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 tankname = data.tank_name or 'fluid_tank'
local tankdesc = data.tank_description or 'Fluid Tank' local tankdesc = data.tank_description or 'Fluid Tank'
local tiles = data.tiles or {"default_glass.png", "default_glass_detail.png"} local tiles = data.tiles or {"default_glass.png", "default_glass_detail.png"}

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

@ -2,7 +2,7 @@ tinkering.pattern = {}
-- Register a new pattern -- Register a new pattern
function tinkering.register_pattern(name, data) 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 local desc = data.description
tinkering.pattern[name] = data tinkering.pattern[name] = data

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