mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-06-29 23:00:49 +02:00
make pipeworks Game agnostic (#16)
* make it boot in non mtg * make water flow * fix water texture warnings * fix missing steel texture issues * remove depreciated/unnessary default function calls * make sounds work * fix default formspec crashes * fix wierd tab spacing * additionally game dig group support * move crafts to crafts.lua * make crafts support various games
This commit is contained in:
110
devices.lua
110
devices.lua
@ -133,9 +133,9 @@ for s in ipairs(states) do
|
||||
|
||||
local dgroups
|
||||
if states[s] == "off" then
|
||||
dgroups = {snappy=3, pipe=1}
|
||||
dgroups = {snappy=3, pipe=1, dig_generic = 4}
|
||||
else
|
||||
dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
|
||||
dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4}
|
||||
end
|
||||
|
||||
local pumpname = "pipeworks:pump_"..states[s]
|
||||
@ -148,7 +148,9 @@ for s in ipairs(states) do
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = dgroups,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
pipe_connections = { top = 1 },
|
||||
after_place_node = function(pos)
|
||||
@ -170,7 +172,7 @@ for s in ipairs(states) do
|
||||
local fdir = node.param2
|
||||
minetest.swap_node(pos, { name = "pipeworks:pump_"..states[3-s], param2 = fdir })
|
||||
end,
|
||||
on_rotate = screwdriver.rotate_simple
|
||||
on_rotate = screwdriver and screwdriver.rotate_simple or nil
|
||||
})
|
||||
|
||||
-- FIXME: this currently assumes that pumps can only rotate around the fixed axis pointing Y+.
|
||||
@ -200,7 +202,9 @@ for s in ipairs(states) do
|
||||
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
||||
},
|
||||
groups = dgroups,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
@ -247,8 +251,10 @@ minetest.register_node(nodename_valve_loaded, {
|
||||
type = "fixed",
|
||||
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
||||
},
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
@ -297,8 +303,10 @@ minetest.register_node("pipeworks:grating", {
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, pipe=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
pipe_connections = { top = 1 },
|
||||
after_place_node = function(pos)
|
||||
@ -322,8 +330,10 @@ minetest.register_node(nodename_spigot_empty, {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
pipe_connections = { left=1, right=1, front=1, back=1,
|
||||
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
||||
@ -350,23 +360,17 @@ minetest.register_node(nodename_spigot_loaded, {
|
||||
drawtype = "mesh",
|
||||
mesh = "pipeworks_spigot_pouring"..polys..".obj",
|
||||
tiles = {
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
minetest.registered_nodes[pipeworks.liquids.water.source].tiles[1],
|
||||
{ name = "pipeworks_spigot.png" }
|
||||
},
|
||||
use_texture_alpha = texture_alpha_mode and "blend" or true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
pipe_connections = { left=1, right=1, front=1, back=1,
|
||||
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
||||
@ -421,8 +425,10 @@ minetest.register_node(nodename_panel_empty, {
|
||||
tiles = { "pipeworks_entry_panel.png" },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
@ -441,8 +447,10 @@ minetest.register_node(nodename_panel_loaded, {
|
||||
tiles = { "pipeworks_entry_panel.png" },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
@ -471,8 +479,10 @@ minetest.register_node(nodename_sensor_empty, {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
@ -510,8 +520,10 @@ minetest.register_node(nodename_sensor_loaded, {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
@ -555,12 +567,12 @@ new_flow_logic_register.transition_simple_set(sensor_pressure_set, { mesecons=pi
|
||||
-- TODO flow-logic-stub: these don't currently do anything under the new flow logic.
|
||||
for fill = 0, 10 do
|
||||
local filldesc=S("empty")
|
||||
local sgroups = {snappy=3, pipe=1, tankfill=fill+1}
|
||||
local sgroups = {snappy=3, pipe=1, tankfill=fill+1, dig_generic = 4}
|
||||
local image = nil
|
||||
|
||||
if fill ~= 0 then
|
||||
filldesc=S("@1% full", 10*fill)
|
||||
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
|
||||
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1, dig_generic = 4}
|
||||
image = "pipeworks_storage_tank_fittings.png"
|
||||
end
|
||||
|
||||
@ -577,8 +589,10 @@ for fill = 0, 10 do
|
||||
inventory_image = image,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
drop = "pipeworks:storage_tank_0",
|
||||
pipe_connections = { top = 1, bottom = 1},
|
||||
@ -606,7 +620,9 @@ for fill = 0, 10 do
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = sgroups,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
drop = "pipeworks:storage_tank_0",
|
||||
pipe_connections = { top = 1, bottom = 1},
|
||||
@ -632,8 +648,10 @@ minetest.register_node(nodename_fountain_empty, {
|
||||
tiles = { "pipeworks_fountainhead.png" },
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, pipe=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
pipe_connections = { bottom = 1 },
|
||||
after_place_node = function(pos)
|
||||
@ -667,8 +685,10 @@ minetest.register_node(nodename_fountain_loaded, {
|
||||
tiles = { "pipeworks_fountainhead.png" },
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
pipe_connections = { bottom = 1 },
|
||||
after_place_node = function(pos)
|
||||
@ -717,8 +737,10 @@ minetest.register_node(nodename_sp_empty, {
|
||||
tiles = { "pipeworks_straight_pipe_empty.png" },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
@ -739,8 +761,10 @@ minetest.register_node(nodename_sp_loaded, {
|
||||
tiles = { "pipeworks_straight_pipe_loaded.png" },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4},
|
||||
_sound_def = {
|
||||
key = "node_sound_metal_defaults",
|
||||
},
|
||||
walkable = true,
|
||||
on_place = pipeworks.rotate_on_place,
|
||||
after_dig_node = function(pos)
|
||||
|
Reference in New Issue
Block a user