mirror of
https://github.com/minetest-mods/digtron.git
synced 2024-12-23 04:42:23 +01:00
combatibility with Carbone (and presumably other games that use older versions of the default mod)
This commit is contained in:
parent
f43e64caba
commit
d545593f27
2
init.lua
2
init.lua
@ -9,7 +9,7 @@ dofile( minetest.get_modpath( "digtron" ) .. "/node_controllers.lua" ) -- contro
|
|||||||
|
|
||||||
dofile( minetest.get_modpath( "digtron" ) .."/recipes.lua" )
|
dofile( minetest.get_modpath( "digtron" ) .."/recipes.lua" )
|
||||||
|
|
||||||
digtron.cycle_time = 1.0 -- How long a digtron waits between cycles.
|
digtron.cycle_time = 1 -- How many seconds a digtron waits between cycles. Auto-controllers can make this wait longer, but cannot make it shorter.
|
||||||
digtron.traction_factor = 3.0 -- How many digtron nodes can be moved for each adjacent solid node that the digtron has traction against
|
digtron.traction_factor = 3.0 -- How many digtron nodes can be moved for each adjacent solid node that the digtron has traction against
|
||||||
|
|
||||||
-- fuel costs. For comparison, in the default game:
|
-- fuel costs. For comparison, in the default game:
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_node("digtron:builder", {
|
|||||||
description = "Builder Unit",
|
description = "Builder Unit",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 4},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 4},
|
||||||
drop = "digtron:builder",
|
drop = "digtron:builder",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
tiles = {
|
tiles = {
|
||||||
"digtron_plate.png^[transformR90",
|
"digtron_plate.png^[transformR90",
|
||||||
|
@ -238,7 +238,7 @@ minetest.register_node("digtron:controller", {
|
|||||||
description = "Digtron Control Unit",
|
description = "Digtron Control Unit",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
|
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
|
||||||
drop = "digtron:controller",
|
drop = "digtron:controller",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
-- Aims in the +Z direction by default
|
-- Aims in the +Z direction by default
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -328,7 +328,7 @@ digtron.auto_cycle = function(pos)
|
|||||||
meta:set_string("infotext", status)
|
meta:set_string("infotext", status)
|
||||||
|
|
||||||
if cycle > 0 then
|
if cycle > 0 then
|
||||||
minetest.after(math.max(digtron.cycle_time, meta:get_int("period")), digtron.auto_cycle, newpos)
|
minetest.after(meta:get_int("period"), digtron.auto_cycle, newpos)
|
||||||
else
|
else
|
||||||
meta:set_string("formspec", auto_formspec)
|
meta:set_string("formspec", auto_formspec)
|
||||||
end
|
end
|
||||||
@ -339,7 +339,7 @@ minetest.register_node("digtron:auto_controller", {
|
|||||||
description = "Digtron Automatic Control Unit",
|
description = "Digtron Automatic Control Unit",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
|
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
|
||||||
drop = "digtron:auto_controller",
|
drop = "digtron:auto_controller",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
-- Aims in the +Z direction by default
|
-- Aims in the +Z direction by default
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -364,7 +364,7 @@ minetest.register_node("digtron:auto_controller", {
|
|||||||
meta:set_string("infotext", "Heat remaining in controller furnace: 0")
|
meta:set_string("infotext", "Heat remaining in controller furnace: 0")
|
||||||
meta:set_string("formspec", auto_formspec)
|
meta:set_string("formspec", auto_formspec)
|
||||||
-- Reusing offset and period to keep the digtron node-moving code simple, and the names still fit well
|
-- Reusing offset and period to keep the digtron node-moving code simple, and the names still fit well
|
||||||
meta:set_int("period", 1)
|
meta:set_int("period", digtron.cycle_time)
|
||||||
meta:set_int("offset", 0)
|
meta:set_int("offset", 0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ minetest.register_node("digtron:auto_controller", {
|
|||||||
local period = tonumber(fields.period)
|
local period = tonumber(fields.period)
|
||||||
|
|
||||||
if period and period > 0 then
|
if period and period > 0 then
|
||||||
meta:set_int("period", math.floor(period))
|
meta:set_int("period", math.max(digtron.cycle_time, math.floor(period)))
|
||||||
end
|
end
|
||||||
|
|
||||||
if offset and offset >= 0 then
|
if offset and offset >= 0 then
|
||||||
@ -406,7 +406,7 @@ minetest.register_node("digtron:pusher", {
|
|||||||
description = "Digtron Pusher Unit",
|
description = "Digtron Pusher Unit",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
|
||||||
drop = "digtron:pusher",
|
drop = "digtron:pusher",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
-- Aims in the +Z direction by default
|
-- Aims in the +Z direction by default
|
||||||
tiles = {
|
tiles = {
|
||||||
|
@ -44,7 +44,7 @@ minetest.register_node("digtron:digger", {
|
|||||||
description = "Digger Head",
|
description = "Digger Head",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
||||||
drop = "digtron:digger",
|
drop = "digtron:digger",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ minetest.register_node("digtron:intermittent_digger", {
|
|||||||
description = "Intermittent Digger Head",
|
description = "Intermittent Digger Head",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
||||||
drop = "digtron:intermittent_digger",
|
drop = "digtron:intermittent_digger",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ minetest.register_node("digtron:soft_digger", {
|
|||||||
description = "Soft Material Digger Head",
|
description = "Soft Material Digger Head",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
||||||
drop = "digtron:soft_digger",
|
drop = "digtron:soft_digger",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ minetest.register_node("digtron:intermittent_soft_digger", {
|
|||||||
description = "Intermittent Soft Material Digger Head",
|
description = "Intermittent Soft Material Digger Head",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
||||||
drop = "digtron:intermittent_soft_digger",
|
drop = "digtron:intermittent_soft_digger",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_node("digtron:structure", {
|
|||||||
drop = "digtron:structure",
|
drop = "digtron:structure",
|
||||||
tiles = {"digtron_plate.png"},
|
tiles = {"digtron_plate.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
climbable = true,
|
climbable = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -54,7 +54,7 @@ minetest.register_node("digtron:inventory",
|
|||||||
description = "Digtron Inventory Hopper",
|
description = "Digtron Inventory Hopper",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 2},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 2},
|
||||||
drop = "digtron:inventory",
|
drop = "digtron:inventory",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
tiles = {"digtron_inventory.png"},
|
tiles = {"digtron_inventory.png"},
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ minetest.register_node("digtron:fuelstore",
|
|||||||
description = "Digtron Fuel Hopper",
|
description = "Digtron Fuel Hopper",
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 5},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 5},
|
||||||
drop = "digtron:fuelstore",
|
drop = "digtron:fuelstore",
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = digtron.metal_sounds,
|
||||||
paramtype2= "facedir",
|
paramtype2= "facedir",
|
||||||
tiles = {"digtron_fuelstore.png"},
|
tiles = {"digtron_fuelstore.png"},
|
||||||
|
|
||||||
|
8
util.lua
8
util.lua
@ -4,6 +4,14 @@ digtron = {}
|
|||||||
|
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/util_item_place_node.lua" ) -- separated out to avoid potential for license complexity
|
dofile( minetest.get_modpath( "digtron" ) .. "/util_item_place_node.lua" ) -- separated out to avoid potential for license complexity
|
||||||
|
|
||||||
|
-- Apparently node_sound_metal_defaults is a newer thing, I ran into games using an older version of the default mod without it.
|
||||||
|
if default.node_sound_metal_defaults ~= nil then
|
||||||
|
digtron.metal_sounds = default.node_sound_metal_defaults()
|
||||||
|
else
|
||||||
|
digtron.metal_sounds = default.node_sound_stone_defaults()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
digtron.find_new_pos = function(pos, facing)
|
digtron.find_new_pos = function(pos, facing)
|
||||||
-- finds the point one node "forward", based on facing
|
-- finds the point one node "forward", based on facing
|
||||||
local dir = minetest.facedir_to_dir(facing)
|
local dir = minetest.facedir_to_dir(facing)
|
||||||
|
Loading…
Reference in New Issue
Block a user