I dont remember tbh :P everything?
|
@ -0,0 +1,71 @@
|
|||
local nb_table = {
|
||||
[0] = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
|
||||
{-0.5, -0.4375, -0.5, -0.375, -0.3125, 0.5}, -- NodeBox2
|
||||
{0.375, -0.4375, -0.5, 0.5, -0.3125, 0.5}, -- NodeBox3
|
||||
},
|
||||
[1] = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
|
||||
{-0.5, -0.4375, -0.5, -0.375, -0.3125, 0.5}, -- NodeBox2
|
||||
{0.375, -0.4375, -0.5, 0.5, -0.3125, -0.375}, -- NodeBox3
|
||||
{0.375, -0.4375, 0.375, 0.5, -0.3125, 0.5}, -- NodeBox4}
|
||||
},
|
||||
[2] = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
|
||||
{0.5, -0.4375, -0.5, 0.375, -0.3125, 0.5}, -- NodeBox2
|
||||
{-0.375, -0.4375, -0.5, -0.5, -0.3125, -0.375}, -- NodeBox3
|
||||
{-0.375, -0.4375, 0.375, -0.5, -0.3125, 0.5}, -- NodeBox4}
|
||||
},
|
||||
[3] = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
|
||||
{0.375, -0.4375, -0.5, 0.5, -0.3125, -0.375}, -- NodeBox3
|
||||
{0.375, -0.4375, 0.375, 0.5, -0.3125, 0.5}, -- NodeBox4}
|
||||
{-0.375, -0.4375, -0.5, -0.5, -0.3125, -0.375}, -- NodeBox3
|
||||
{-0.375, -0.4375, 0.375, -0.5, -0.3125, 0.5}, -- NodeBox4}
|
||||
}
|
||||
}
|
||||
local names = {
|
||||
[0] = "",
|
||||
[1] = "_left",
|
||||
[2] = "_right",
|
||||
[3] = "_funnel"
|
||||
}
|
||||
|
||||
for i = 0, 3 do
|
||||
minetest.register_node("tech_reborn:conveyor" .. names[i], {
|
||||
description = "Conveyor Belt",
|
||||
groups = {oddly_breakable_by_hand = 3, cracky = 3, choppy = 3},
|
||||
tiles = {
|
||||
{
|
||||
name = "tech_reborn_conveyor_top" .. names[i] .. ".png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nb_table[i]
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}},
|
||||
}
|
||||
})
|
||||
end
|
|
@ -1,3 +1,25 @@
|
|||
function tech_reborn.setIO(pos, iotable)
|
||||
local io = minetest.deserialize(minetest.get_meta(pos):get_string("io")) or {}
|
||||
for k,v in pairs(iotable) do io[k] = v end
|
||||
minetest.get_meta(pos):set_string("io", minetest.serialize(io))
|
||||
end
|
||||
|
||||
function tech_reborn.getIO(pos)
|
||||
return minetest.deserialize(minetest.get_meta(pos):get_string("io")) or {}
|
||||
end
|
||||
|
||||
function tech_reborn.dir_from_adjacent(ind)
|
||||
local dt = {
|
||||
[1] = 'd',
|
||||
[2] = 'u',
|
||||
[3] = 'w',
|
||||
[4] = 'e',
|
||||
[5] = 's',
|
||||
[6] = 'n'
|
||||
}
|
||||
return dt[ind]
|
||||
end
|
||||
|
||||
function tech_reborn.getNodeCapacity(pos)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "wire") > 0 then
|
||||
local system = minetest.get_meta(pos):get_string("sys_id")
|
||||
|
@ -8,6 +30,16 @@ function tech_reborn.getNodeCapacity(pos)
|
|||
end
|
||||
end
|
||||
|
||||
function tech_reborn.getNodeMaxCapacity(pos)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "wire") > 0 then
|
||||
local system = minetest.get_meta(pos):get_string("sys_id")
|
||||
if not system or system == "" or not tech_reborn.wire.systems[system] then return false end
|
||||
|
||||
local capacity = tech_reborn.wire.systems[system].capacity
|
||||
return capacity
|
||||
end
|
||||
end
|
||||
|
||||
function tech_reborn.getNodeEnergy(pos)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "wire") > 0 then
|
||||
local system = minetest.get_meta(pos):get_string("sys_id")
|
||||
|
@ -42,32 +74,82 @@ function tech_reborn.getAdjacentEnergy(pos)
|
|||
return total_power
|
||||
end
|
||||
|
||||
function tech_reborn.pushNodeEnergy(pos, amount)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "wire") > 0 and
|
||||
minetest.get_item_group(minetest.get_node(pos).name, "import") > 0 then
|
||||
function tech_reborn.getAdjacentCapacity(pos)
|
||||
local adj_nodes = tech_reborn.getAdjacent(pos)
|
||||
local total_capacity = 0
|
||||
local systems = {}
|
||||
|
||||
for i = 1, #adj_nodes do
|
||||
if minetest.get_item_group(minetest.get_node(adj_nodes[i]).name, "wire") > 0 then
|
||||
local system = minetest.get_meta(adj_nodes[i]):get_string("sys_id")
|
||||
if not system or system == "" or not tech_reborn.wire.systems[system] then return false end
|
||||
|
||||
local found = false
|
||||
for i = 1, #systems do
|
||||
if system == systems[i] then found = true; break end
|
||||
end
|
||||
if not found then
|
||||
table.insert(systems, system)
|
||||
local capacity = tech_reborn.getNodeCapacity(adj_nodes[i])
|
||||
if capacity then total_capacity = total_capacity + capacity end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return total_capacity
|
||||
end
|
||||
|
||||
function tech_reborn.getAdjacentMaxCapacity(pos)
|
||||
local adj_nodes = tech_reborn.getAdjacent(pos)
|
||||
local total_capacity = 0
|
||||
local systems = {}
|
||||
|
||||
for i = 1, #adj_nodes do
|
||||
if minetest.get_item_group(minetest.get_node(adj_nodes[i]).name, "wire") > 0 then
|
||||
local system = minetest.get_meta(adj_nodes[i]):get_string("sys_id")
|
||||
if not system or system == "" or not tech_reborn.wire.systems[system] then return false end
|
||||
|
||||
local found = false
|
||||
for i = 1, #systems do
|
||||
if system == systems[i] then found = true; break end
|
||||
end
|
||||
if not found then
|
||||
table.insert(systems, system)
|
||||
local capacity = tech_reborn.getNodeMaxCapacity(adj_nodes[i])
|
||||
if capacity then total_capacity = total_capacity + capacity end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return total_capacity
|
||||
end
|
||||
|
||||
function tech_reborn.pushNodeEnergy(pos, amount, dir)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "wire") > 0 and tech_reborn.getIO(pos)[dir] == "import" then
|
||||
local system = minetest.get_meta(pos):get_string("sys_id")
|
||||
if not system or system == "" or not tech_reborn.wire.systems[system] then return false end
|
||||
|
||||
local capacity = tech_reborn.getNodeCapacity(pos)
|
||||
if (capacity > amount) then
|
||||
tech_reborn.wire.systems[system].power = tech_reborn.wire.systems[system].power + amount
|
||||
return 0
|
||||
return amount
|
||||
else
|
||||
local pushed = tech_reborn.wire.systems[system].capacity - tech_reborn.wire.systems[system].power
|
||||
tech_reborn.wire.systems[system].power = tech_reborn.wire.systems[system].capacity
|
||||
return amount - capacity
|
||||
return pushed
|
||||
end
|
||||
end
|
||||
return amount
|
||||
return 0
|
||||
end
|
||||
|
||||
function tech_reborn.pushAdjacentEnergy(pos, amount)
|
||||
local adj_nodes = tech_reborn.getAdjacent(pos)
|
||||
local systems = {}
|
||||
local count = 0
|
||||
local leftover = 0
|
||||
local pushed = 0
|
||||
|
||||
for i = 1, #adj_nodes do
|
||||
if not tech_reborn.getNodeCapacity(adj_nodes[i]) then
|
||||
if not tech_reborn.getIO(pos)[tech_reborn.dir_from_adjacent(i)] == "import" then
|
||||
adj_nodes[i] = false
|
||||
else
|
||||
count = count + 1
|
||||
|
@ -76,22 +158,21 @@ function tech_reborn.pushAdjacentEnergy(pos, amount)
|
|||
|
||||
for i = 1, #adj_nodes do
|
||||
if adj_nodes[i] then
|
||||
leftover = leftover + tech_reborn.pushNodeEnergy(adj_nodes[i], math.floor(amount/count))
|
||||
pushed = pushed + tech_reborn.pushNodeEnergy(adj_nodes[i], math.floor(amount/count), tech_reborn.dir_from_adjacent(i))
|
||||
end
|
||||
end
|
||||
if leftover > 0 then
|
||||
if pushed < amount then
|
||||
for i = 1, #adj_nodes do
|
||||
if adj_nodes[i] then
|
||||
leftover = tech_reborn.pushNodeEnergy(adj_nodes[i], leftover)
|
||||
pushed = pushed + tech_reborn.pushNodeEnergy(adj_nodes[i], amount - pushed, tech_reborn.dir_from_adjacent(i))
|
||||
end
|
||||
end
|
||||
end
|
||||
return leftover
|
||||
return pushed
|
||||
end
|
||||
|
||||
function tech_reborn.pullNodeEnergy(pos, amount)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "wire") > 0 and
|
||||
minetest.get_item_group(minetest.get_node(pos).name, "export") > 0 then
|
||||
function tech_reborn.pullNodeEnergy(pos, amount, dir)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "wire") > 0 and tech_reborn.getIO(pos)[dir] == "export" then
|
||||
local system = minetest.get_meta(pos):get_string("sys_id")
|
||||
if not system or system == "" or not tech_reborn.wire.systems[system] then return false end
|
||||
|
||||
|
@ -114,7 +195,7 @@ function tech_reborn.pullAdjacentEnergy(pos, amount)
|
|||
local got = 0
|
||||
|
||||
for i = 1, #adj_nodes do
|
||||
if not tech_reborn.getNodeCapacity(adj_nodes[i]) then
|
||||
if not tech_reborn.getIO(pos)[tech_reborn.dir_from_adjacent(i)] == "export" then
|
||||
adj_nodes[i] = false
|
||||
else
|
||||
count = count + 1
|
||||
|
@ -123,14 +204,14 @@ function tech_reborn.pullAdjacentEnergy(pos, amount)
|
|||
|
||||
for i = 1, #adj_nodes do
|
||||
if adj_nodes[i] then
|
||||
got = got + tech_reborn.pullNodeEnergy(adj_nodes[i], math.floor(amount/count))
|
||||
got = got + tech_reborn.pullNodeEnergy(adj_nodes[i], math.floor(amount/count), tech_reborn.dir_from_adjacent(i))
|
||||
end
|
||||
end
|
||||
|
||||
if got < amount then
|
||||
for i = 1, #adj_nodes do
|
||||
if adj_nodes[i] then
|
||||
got = got + tech_reborn.pullNodeEnergy(adj_nodes[i], amount - got)
|
||||
got = got + tech_reborn.pullNodeEnergy(adj_nodes[i], amount - got, tech_reborn.dir_from_adjacent(i))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,226 @@
|
|||
local scale = 0.25
|
||||
local punchtimes = 3
|
||||
local wmod = {
|
||||
[8] = 0.62,
|
||||
[6] = 0.69,
|
||||
[4] = 0.70,
|
||||
[2] = 1.00,
|
||||
}
|
||||
|
||||
local function activate_preview(self, staticdata)
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
local data = minetest.deserialize(staticdata)
|
||||
if not data then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
self.dir = data.dir
|
||||
self.basenode = data.basenode
|
||||
self.time = 0
|
||||
end
|
||||
|
||||
local function destroy_preview(self)
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
local function starts(String,Start)
|
||||
return string.sub(String,1,string.len(Start)) == Start
|
||||
end
|
||||
|
||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 1.3)) do
|
||||
if obj:get_luaentity() then
|
||||
if obj:get_luaentity().basenode == self.basenode then
|
||||
if starts(obj:get_luaentity().name, "tech_reborn:servo_preview") then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function rightclick_preview(self, clicker)
|
||||
destroy_preview(self)
|
||||
local def = minetest.registered_nodes[minetest.get_node(tech_reborn.deserializepos(self.basenode)).name]
|
||||
if not def then return false end
|
||||
local n = tonumber(def._wire_size)
|
||||
if not n then return false end
|
||||
tech_reborn.wire.spawnEntities("import", tech_reborn.deserializepos(self.basenode), {[self.dir] = true}, n + 2)
|
||||
end
|
||||
|
||||
local function step_preview(self, dtime)
|
||||
self.time = self.time + dtime
|
||||
if self.time > 4 then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local function activate_servo(self, staticdata)
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
local data = minetest.deserialize(staticdata)
|
||||
if not data then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
self.dir = data.dir
|
||||
self.basenode = data.basenode
|
||||
if not self.io then
|
||||
self.io = data.io
|
||||
end
|
||||
|
||||
tech_reborn.setIO(tech_reborn.deserializepos(self.basenode), {[self.dir] = self.io})
|
||||
end
|
||||
|
||||
local function destroy_servo(self, puncher, time_from_last_punch)
|
||||
if puncher:get_wielded_item():get_name() == "tech_reborn:wrench" then
|
||||
local hp = self.object:get_hp() - 1
|
||||
if time_from_last_punch > 1 then
|
||||
hp = punchtimes
|
||||
end
|
||||
if hp <= 0 then
|
||||
tech_reborn.setIO(tech_reborn.deserializepos(self.basenode), {[self.dir] = false})
|
||||
end
|
||||
self.object:set_hp(hp)
|
||||
end
|
||||
end
|
||||
|
||||
local function rightclick_servo(self, clicker)
|
||||
if clicker:get_wielded_item():get_name() == "tech_reborn:wrench" then
|
||||
self.object:remove()
|
||||
|
||||
local def = minetest.registered_nodes[minetest.get_node(tech_reborn.deserializepos(self.basenode)).name]
|
||||
if not def then return false end
|
||||
local n = tonumber(def._wire_size)
|
||||
if not n then return false end
|
||||
|
||||
local theoldswitcheroo = {
|
||||
import = "export",
|
||||
export = "import",
|
||||
}
|
||||
|
||||
tech_reborn.wire.spawnEntities(theoldswitcheroo[self.io], tech_reborn.deserializepos(self.basenode), {[self.dir] = true}, n+2)
|
||||
end
|
||||
end
|
||||
|
||||
local function static_servo(self)
|
||||
return minetest.serialize({
|
||||
dir = self.dir,
|
||||
basenode = self.basenode,
|
||||
io = self.io,
|
||||
})
|
||||
end
|
||||
|
||||
base_table = {
|
||||
physical = false,
|
||||
visual = "mesh",
|
||||
visual_size = {x=2.55, y=2.55},
|
||||
is_visible = true,
|
||||
makes_footstep_sound = false,
|
||||
automatic_rotate = false,
|
||||
}
|
||||
servo_table = {
|
||||
hp_max = punchtimes,
|
||||
on_rightclick = rightclick_servo,
|
||||
on_punch = destroy_servo,
|
||||
get_staticdata = static_servo
|
||||
}
|
||||
preview_table = {
|
||||
hp_max = 1,
|
||||
textures = {"tech_reborn_servo_preview.png"},
|
||||
on_rightclick = rightclick_preview,
|
||||
on_step = step_preview,
|
||||
on_punch = destroy_preview,
|
||||
}
|
||||
|
||||
for n = 4, 8, 2 do
|
||||
--
|
||||
-- Servo Initialization
|
||||
--
|
||||
local scale = 0.255 * (n / 8)
|
||||
local table
|
||||
|
||||
for i = 0, 1 do
|
||||
local s = "import"
|
||||
if i == 1 then s = "export" end
|
||||
|
||||
table = {
|
||||
collisionbox = {-scale, -(scale * wmod[n]), -scale, scale, (scale * wmod[n]), scale},
|
||||
mesh = "tech_reborn_servo_top_" .. n .. ".x",
|
||||
textures = {"tech_reborn_servo_" .. s .. "_" .. n .. ".png^tech_reborn_servo_overlay_" .. n .. ".png"},
|
||||
on_activate = function(self, staticdata)
|
||||
self.io = s
|
||||
activate_servo(self, staticdata)
|
||||
end,
|
||||
}
|
||||
for k,v in pairs(base_table) do table[k] = v end
|
||||
for k,v in pairs(servo_table) do table[k] = v end
|
||||
minetest.register_entity("tech_reborn:servo_" .. s .. "_" .. n .. "_y", table)
|
||||
|
||||
table = {
|
||||
collisionbox = {-(scale * wmod[n]), -scale, -scale, (scale * wmod[n]), scale, scale},
|
||||
mesh = "tech_reborn_servo_side_" .. n .. ".x",
|
||||
textures = {"tech_reborn_servo_" .. s .. "_" .. n .. ".png^tech_reborn_servo_overlay_" .. n .. ".png"},
|
||||
on_activate = function(self, staticdata)
|
||||
self.io = s
|
||||
activate_servo(self, staticdata)
|
||||
end,
|
||||
}
|
||||
for k,v in pairs(base_table) do table[k] = v end
|
||||
for k,v in pairs(servo_table) do table[k] = v end
|
||||
minetest.register_entity("tech_reborn:servo_" .. s .. "_" .. n .. "_x", table)
|
||||
|
||||
table = {
|
||||
collisionbox = {-scale, -scale, -(scale * wmod[n]), scale, scale, (scale * wmod[n])},
|
||||
mesh = "tech_reborn_servo_side_" .. n .. ".x",
|
||||
textures = {"tech_reborn_servo_" .. s .. "_" .. n .. ".png^tech_reborn_servo_overlay_" .. n .. ".png"},
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:set_yaw(90 * 0.0174533)
|
||||
self.io = s
|
||||
activate_servo(self, staticdata)
|
||||
end,
|
||||
}
|
||||
for k,v in pairs(base_table) do table[k] = v end
|
||||
for k,v in pairs(servo_table) do table[k] = v end
|
||||
minetest.register_entity("tech_reborn:servo_" .. s .. "_" .. n .. "_z", table)
|
||||
end
|
||||
|
||||
--
|
||||
-- Preview Initialization
|
||||
--
|
||||
n = n - 2
|
||||
local scale = 0.255 * (n / 8)
|
||||
|
||||
table = {
|
||||
collisionbox = {-scale, -(scale * wmod[n]), -scale, scale, (scale * wmod[n]), scale},
|
||||
mesh = "tech_reborn_servo_top_" .. n .. ".x",
|
||||
on_activate = function(self, staticdata)
|
||||
activate_preview(self, staticdata)
|
||||
end,
|
||||
}
|
||||
for k,v in pairs(base_table) do table[k] = v end
|
||||
for k,v in pairs(preview_table) do table[k] = v end
|
||||
minetest.register_entity("tech_reborn:servo_preview_" .. n .. "_y", table)
|
||||
|
||||
table = {
|
||||
collisionbox = {-(scale * wmod[n]), -scale, -scale, (scale * wmod[n]), scale, scale},
|
||||
mesh = "tech_reborn_servo_side_" .. n .. ".x",
|
||||
on_activate = function(self, staticdata)
|
||||
activate_preview(self, staticdata)
|
||||
end,
|
||||
}
|
||||
for k,v in pairs(base_table) do table[k] = v end
|
||||
for k,v in pairs(preview_table) do table[k] = v end
|
||||
minetest.register_entity("tech_reborn:servo_preview_" .. n .. "_x", table)
|
||||
|
||||
table = {
|
||||
collisionbox = {-scale, -scale, -(scale * wmod[n]), scale, scale, (scale * wmod[n])},
|
||||
mesh = "tech_reborn_servo_side_" .. n .. ".x",
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:set_yaw(90 * 0.0174533)
|
||||
activate_preview(self, staticdata)
|
||||
end,
|
||||
}
|
||||
for k,v in pairs(base_table) do table[k] = v end
|
||||
for k,v in pairs(preview_table) do table[k] = v end
|
||||
minetest.register_entity("tech_reborn:servo_preview_" .. n .. "_z", table)
|
||||
end
|
|
@ -1,15 +1,129 @@
|
|||
function tech_reborn.wire.changeState(pos, node, clicker, itemstack, pointed_thing)
|
||||
function tech_reborn.wire.wireConnectable(pos_a, pos_b)
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos_b).name]
|
||||
local base_node = def._base_node
|
||||
if minetest.get_item_group(minetest.get_node(pos_a).name, "wire") > 0 then
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos_a).name]
|
||||
if def._base_node == base_node then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function tech_reborn.wire.removeIO(pos)
|
||||
local function get_remove(pos)
|
||||
return (minetest.get_item_group(minetest.get_node(pos).name, "wire_connect") > 0)
|
||||
end
|
||||
local function starts(String,Start)
|
||||
return string.sub(String,1,string.len(Start)) == Start
|
||||
end
|
||||
|
||||
local adjacent = tech_reborn.getAdjacent(pos)
|
||||
local dirs = {
|
||||
u = get_remove(adjacent[1]),
|
||||
d = get_remove(adjacent[2]),
|
||||
e = get_remove(adjacent[3]),
|
||||
w = get_remove(adjacent[4]),
|
||||
n = get_remove(adjacent[5]),
|
||||
s = get_remove(adjacent[6]),
|
||||
}
|
||||
|
||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 1.3)) do
|
||||
if obj:get_luaentity() then
|
||||
if obj:get_luaentity().basenode == tech_reborn.serializepos(pos) then
|
||||
if starts(obj:get_luaentity().name, "tech_reborn:servo_") then
|
||||
if not dirs[obj:get_luaentity().dir] then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function tech_reborn.wire.spawnEntities(name, pos, dirs, size)
|
||||
local dmod = {
|
||||
[8] = 0.346,
|
||||
[6] = 0.374,
|
||||
[4] = 0.410,
|
||||
[2] = 0.454,
|
||||
}
|
||||
name = name .. "_"
|
||||
|
||||
if dirs.u then
|
||||
local object = minetest.add_entity(pos, "tech_reborn:servo_" .. name .. size .. "_y", minetest.serialize({
|
||||
basenode = tech_reborn.serializepos(pos),
|
||||
dir = "u"
|
||||
}))
|
||||
object:setpos({x=pos.x, y=pos.y+dmod[size], z=pos.z})
|
||||
end
|
||||
if dirs.d then
|
||||
local object = minetest.add_entity(pos, "tech_reborn:servo_" .. name .. size .. "_y", minetest.serialize({
|
||||
basenode = tech_reborn.serializepos(pos),
|
||||
dir = "d"
|
||||
}))
|
||||
object:setpos({x=pos.x, y=pos.y-dmod[size], z=pos.z})
|
||||
end
|
||||
if dirs.e then
|
||||
local object = minetest.add_entity(pos, "tech_reborn:servo_" .. name .. size .. "_x", minetest.serialize({
|
||||
basenode = tech_reborn.serializepos(pos),
|
||||
dir = "e"
|
||||
}))
|
||||
object:setpos({x=pos.x+dmod[size], y=pos.y, z=pos.z})
|
||||
end
|
||||
if dirs.w then
|
||||
local object = minetest.add_entity(pos, "tech_reborn:servo_" .. name .. size .. "_x", minetest.serialize({
|
||||
basenode = tech_reborn.serializepos(pos),
|
||||
dir = "w"
|
||||
}))
|
||||
object:setpos({x=pos.x-dmod[size], y=pos.y, z=pos.z})
|
||||
end
|
||||
if dirs.n then
|
||||
local object = minetest.add_entity(pos, "tech_reborn:servo_" .. name .. size .. "_z", minetest.serialize({
|
||||
basenode = tech_reborn.serializepos(pos),
|
||||
dir = "n"
|
||||
}))
|
||||
object:setpos({x=pos.x, y=pos.y, z=pos.z+dmod[size]})
|
||||
end
|
||||
if dirs.s then
|
||||
local object = minetest.add_entity(pos, "tech_reborn:servo_" .. name .. size .. "_z", minetest.serialize({
|
||||
basenode = tech_reborn.serializepos(pos),
|
||||
dir = "s"
|
||||
}))
|
||||
object:setpos({x=pos.x, y=pos.y, z=pos.z-dmod[size]})
|
||||
end
|
||||
end
|
||||
|
||||
function tech_reborn.wire.showOverlayOpts(pos, node, clicker, itemstack, pointed_thing)
|
||||
if clicker:get_wielded_item():get_name() == "tech_reborn:wrench" then
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
if not def then return false end
|
||||
local n = tonumber(def._wire_size)
|
||||
if not n then return false end
|
||||
|
||||
local estate = def._export_state
|
||||
if estate == "none" then mstring = "_import"
|
||||
elseif estate == "import" then mstring = "_export"
|
||||
elseif estate == "export" then mstring = "" end
|
||||
local function get_connect(pos_a, pos_b)
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos_b).name]
|
||||
local base_node = def._base_node
|
||||
if minetest.get_item_group(minetest.get_node(pos_a).name, "wire_connect") > 0 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.swap_node(pos, {name = def._base_node .. mstring})
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
local adjacent = tech_reborn.getAdjacent(pos)
|
||||
local dirs = {
|
||||
u = get_connect(adjacent[1], pos),
|
||||
d = get_connect(adjacent[2], pos),
|
||||
e = get_connect(adjacent[3], pos),
|
||||
w = get_connect(adjacent[4], pos),
|
||||
n = get_connect(adjacent[5], pos),
|
||||
s = get_connect(adjacent[6], pos),
|
||||
}
|
||||
|
||||
tech_reborn.wire.spawnEntities("preview", pos, dirs, n)
|
||||
else
|
||||
minetest.item_place_node(itemstack, clicker, pointed_thing)
|
||||
end
|
||||
|
@ -24,8 +138,11 @@ function tech_reborn.wire.consumeSystem(newSys, oldSys)
|
|||
if newSys and newSys ~= "" and oldSys and oldSys ~= "" and
|
||||
tech_reborn.wire.systems[newSys] ~= nil and tech_reborn.wire.systems[oldSys] ~= nil then
|
||||
local children = tech_reborn.wire.systems[oldSys].children
|
||||
local altChildcount = tech_reborn.wire.systems[oldSys].childcount
|
||||
local altPower = tech_reborn.wire.systems[oldSys].power
|
||||
tech_reborn.wire.systems[newSys].power = tech_reborn.wire.systems[newSys].power + altPower
|
||||
tech_reborn.wire.systems[newSys].childcount = tech_reborn.wire.systems[newSys].childcount + altChildcount
|
||||
tech_reborn.wire.systems[newSys].capacity = tech_reborn.wire.systems[newSys].childcount * 50
|
||||
|
||||
tech_reborn.wire.systems[oldSys] = nil
|
||||
|
||||
|
@ -47,12 +164,14 @@ function tech_reborn.wire.createWire(pos)
|
|||
local found = false
|
||||
for i = 1, #adjacent do
|
||||
local node = adjacent[i]
|
||||
if minetest.get_item_group(minetest.get_node(node).name, "wire") > 0 then
|
||||
if tech_reborn.wire.wireConnectable(pos, node) then
|
||||
local id = minetest.get_meta(node):get_string("sys_id")
|
||||
if id and id ~= "" then
|
||||
if not found then
|
||||
minetest.get_meta(pos):set_string("sys_id", id)
|
||||
tech_reborn.wire.systems[id].children[tech_reborn.serializepos(pos)] = true
|
||||
tech_reborn.wire.systems[id].childcount = tech_reborn.wire.systems[id].childcount + 1
|
||||
tech_reborn.wire.systems[id].capacity = tech_reborn.wire.systems[id].childcount * 50
|
||||
tech_reborn.wire.save_systems()
|
||||
found = id
|
||||
else
|
||||
|
@ -70,9 +189,10 @@ function tech_reborn.wire.createWire(pos)
|
|||
minetest.get_meta(pos):set_string("sys_id", id)
|
||||
tech_reborn.wire.systems[id] = {
|
||||
id = id,
|
||||
childcount = 1,
|
||||
children = {},
|
||||
power = 0,
|
||||
capacity = 1000
|
||||
capacity = 50
|
||||
}
|
||||
tech_reborn.wire.systems[id].children[tech_reborn.serializepos(pos)] = true
|
||||
tech_reborn.wire.save_systems()
|
||||
|
@ -80,6 +200,21 @@ function tech_reborn.wire.createWire(pos)
|
|||
end
|
||||
|
||||
function tech_reborn.wire.removeWire(pos)
|
||||
local function starts(String,Start)
|
||||
return string.sub(String,1,string.len(Start)) == Start
|
||||
end
|
||||
|
||||
--Remove Entities
|
||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 1.3)) do
|
||||
if obj:get_luaentity() then
|
||||
if obj:get_luaentity().basenode == tech_reborn.serializepos(pos) then
|
||||
if starts(obj:get_luaentity().name, "tech_reborn:servo_") then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local id = minetest.get_meta(pos):get_string("sys_id")
|
||||
|
||||
minetest.after(0, function(pos, id)
|
||||
|
|
|
@ -6,6 +6,7 @@ dofile(path .. "/file.lua")
|
|||
dofile(path .. "/functions.lua")
|
||||
dofile(path .. "/energy-transfer.lua")
|
||||
dofile(path .. "/nodes.lua")
|
||||
dofile(path .. "/entity.lua")
|
||||
|
||||
--DEBUG--
|
||||
--Disable in production
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
local function get_connect(pos_a, pos_b)
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos_b).name]
|
||||
local base_node = def._base_node
|
||||
if minetest.get_item_group(minetest.get_node(pos_a).name, "wire_connect") > 0 then
|
||||
return true
|
||||
end
|
||||
if minetest.get_item_group(minetest.get_node(pos_a).name, "wire") > 0 then
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos_a).name]
|
||||
if def._base_node == base_node then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function tech_reborn.wire.recalcModels(pos)
|
||||
local update = tech_reborn.getAdjacent(pos)
|
||||
table.insert(update, pos)
|
||||
|
@ -9,6 +26,8 @@ function tech_reborn.wire.recalcModels(pos)
|
|||
end
|
||||
|
||||
function tech_reborn.wire.setModel(pos)
|
||||
tech_reborn.wire.removeIO(pos)
|
||||
|
||||
local wires = {}
|
||||
local adjacent = tech_reborn.getAdjacent(pos)
|
||||
|
||||
|
@ -19,17 +38,17 @@ function tech_reborn.wire.setModel(pos)
|
|||
if not base then return false end
|
||||
|
||||
for i = 3, #adjacent do
|
||||
if minetest.get_item_group(minetest.get_node(adjacent[i]).name, "wired_node") > 0 then
|
||||
if get_connect(adjacent[i], pos) then
|
||||
wires[i - 2] = true
|
||||
else wires[i - 2] = false end
|
||||
end
|
||||
|
||||
local suffix = ""
|
||||
if minetest.get_item_group(minetest.get_node(adjacent[1]).name, "wired_node") > 0 then
|
||||
if minetest.get_item_group(minetest.get_node(adjacent[2]).name, "wired_node") > 0 then
|
||||
if get_connect(adjacent[1], pos) then
|
||||
if get_connect(adjacent[2], pos) then
|
||||
suffix = "_ud"
|
||||
else suffix = "_u" end
|
||||
elseif minetest.get_item_group(minetest.get_node(adjacent[2]).name, "wired_node") > 0 then
|
||||
elseif get_connect(adjacent[2], pos) then
|
||||
suffix = "_d"
|
||||
end
|
||||
|
||||
|
|
134
energy/nodes.lua
|
@ -20,21 +20,6 @@ local heights = {
|
|||
}
|
||||
|
||||
function tech_reborn.register_wires(name, data)
|
||||
|
||||
-- register_wire(name, data, nodebox, visible) -- Base Node
|
||||
|
||||
-- -- Add Nubs
|
||||
-- table.insert(nodebox, {-data.width-0.0625, -data.width-0.0625, -data.width-0.0625,
|
||||
-- data.width+0.0625, data.width+0.0625, data.width+0.0625})
|
||||
|
||||
-- local tex = data.texture
|
||||
-- data.tex_insulated = tex .. "^tech_reborn_import_6"
|
||||
-- register_wire(name .. "_import", data, nodebox, visible)
|
||||
|
||||
-- local tex = data.texture
|
||||
-- data.texture = tex .. "^tech_reborn_export_6"
|
||||
-- register_wire(name .. "_export", data, nodebox, visible)
|
||||
|
||||
for insulated = 0, 1 do
|
||||
|
||||
local tex = data.tex_base
|
||||
|
@ -46,79 +31,58 @@ function tech_reborn.register_wires(name, data)
|
|||
|
||||
for hname, hbox in pairs(heights) do
|
||||
for dname, dbox in pairs(directions) do
|
||||
for mode = 0, 2 do
|
||||
local mstring = ""
|
||||
local estate = "none"
|
||||
local inexoverlay = ""
|
||||
|
||||
local nodebox = table.copy(dbox)
|
||||
table.insert(nodebox, table.copy(hbox))
|
||||
if hname == "_" then hname = "" end
|
||||
if dname == "_" then dname = "" end
|
||||
|
||||
local groups = {oddly_breakable_by_hand = 1, wire = 1, snappy = 3, wired_node = 1}
|
||||
-- if not visible then
|
||||
-- groups.not_in_creative_inventory = 1
|
||||
-- end
|
||||
groups[data.voltage] = 1
|
||||
if hname == "_" then hname = "" end
|
||||
if dname == "_" then dname = "" end
|
||||
local nodebox = table.copy(dbox)
|
||||
table.insert(nodebox, table.copy(hbox))
|
||||
|
||||
if mode > 0 then
|
||||
table.insert(nodebox, {-(data.size+2)/16/2, -(data.size+2)/16/2, -(data.size+2)/16/2,
|
||||
(data.size+2)/16/2, (data.size+2)/16/2, (data.size+2)/16/2})
|
||||
end
|
||||
if mode == 1 then
|
||||
|
||||
mstring = "_import"
|
||||
estate = "import"
|
||||
groups.import = 1
|
||||
inexoverlay = "^tech_reborn_import_" .. (data.size+2) .. ".png"
|
||||
|
||||
elseif mode == 2 then
|
||||
local groups = {oddly_breakable_by_hand = 1, wire = 1, snappy = 3, wired_node = 1}
|
||||
|
||||
mstring = "_export"
|
||||
estate = "export"
|
||||
groups.export = 1
|
||||
inexoverlay = "^tech_reborn_export_" .. (data.size+2) .. ".png"
|
||||
|
||||
end
|
||||
if not (dname == "_line" and hname == "") then
|
||||
groups.not_in_creative_inventory = 1
|
||||
end
|
||||
|
||||
groups[data.voltage] = 1
|
||||
|
||||
local cname = name .. mstring .. dname .. hname
|
||||
local cname = name .. dname .. hname
|
||||
|
||||
--Replace 1 with width values
|
||||
for i = 1, #nodebox do
|
||||
for j = 1, #nodebox[i] do
|
||||
local val = nodebox[i][j]
|
||||
if val == 1 then val = data.size/16/2
|
||||
elseif val == -1 then val = -data.size/16/2 end
|
||||
nodebox[i][j] = val
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("tech_reborn:" .. cname, {
|
||||
description = data.description,
|
||||
tiles = {tex .. inexoverlay},
|
||||
groups = groups,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
on_construct = tech_reborn.wire.constructWire,
|
||||
on_destruct = tech_reborn.wire.removeWire,
|
||||
on_rightclick = tech_reborn.wire.changeState,
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodebox
|
||||
},
|
||||
_base_node = "tech_reborn:" .. name,
|
||||
_base_name = "tech_reborn:" .. name .. mstring,
|
||||
_export_state = estate,
|
||||
_voltage = data.voltage,
|
||||
drop = "tech_reborn:" .. name .. "_line",
|
||||
node_placement_prediction = "tech_reborn:" .. name,
|
||||
})
|
||||
--Replace 1 with width values
|
||||
for i = 1, #nodebox do
|
||||
for j = 1, #nodebox[i] do
|
||||
local val = nodebox[i][j]
|
||||
if val == 1 then val = data.size/16/2
|
||||
elseif val == -1 then val = -data.size/16/2 end
|
||||
nodebox[i][j] = val
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("tech_reborn:" .. cname, {
|
||||
description = data.description,
|
||||
tiles = {tex},
|
||||
groups = groups,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
on_construct = tech_reborn.wire.constructWire,
|
||||
on_destruct = tech_reborn.wire.removeWire,
|
||||
on_rightclick = tech_reborn.wire.showOverlayOpts,
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodebox
|
||||
},
|
||||
node_placement_prediction = "tech_reborn:" .. name,
|
||||
drop = "tech_reborn:" .. name .. "_line",
|
||||
|
||||
_base_node = "tech_reborn:" .. name,
|
||||
_base_name = "tech_reborn:" .. name,
|
||||
_voltage = data.voltage,
|
||||
_wire_size = data.size,
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -142,4 +106,14 @@ tech_reborn.register_wires("gold_wire", {
|
|||
tex_base = "tech_reborn_gold_wire.png",
|
||||
damage_for_second = 0,
|
||||
size = 4
|
||||
})
|
||||
})
|
||||
|
||||
-- tech_reborn.register_wires("item_pipe", {
|
||||
-- description = "Item Pipe",
|
||||
-- base_node = "tech_reborn:insulated_gold_wire",
|
||||
-- voltage = "mv",
|
||||
-- tex_insulated = "tech_reborn_pipe.png",
|
||||
-- tex_base = "tech_reborn_pipe.png",
|
||||
-- damage_for_second = 0,
|
||||
-- size = 8
|
||||
-- })
|
2
init.lua
|
@ -2,6 +2,8 @@ tech_reborn = {}
|
|||
|
||||
local path = minetest.get_modpath('tech_reborn')
|
||||
dofile(path .. "/energy/init.lua")
|
||||
dofile(path .. "/conveyor/init.lua")
|
||||
dofile(path .. "/helpers.lua")
|
||||
dofile(path .. "/item_entity.lua")
|
||||
dofile(path .. "/machines/init.lua")
|
||||
dofile(path .. "/tool/init.lua")
|
|
@ -0,0 +1,44 @@
|
|||
local builtin_item = minetest.registered_entities["__builtin:item"]
|
||||
|
||||
local item = {
|
||||
set_item = function(self, itemstring)
|
||||
builtin_item.set_item(self, itemstring)
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
builtin_item.on_step(self, dtime)
|
||||
|
||||
local node = minetest.get_node_or_nil(self.object:getpos())
|
||||
if not node then
|
||||
return
|
||||
end
|
||||
|
||||
if node.name == "tech_reborn:conveyor" then
|
||||
function round(x)
|
||||
return math.floor(x + 0.5)
|
||||
end
|
||||
|
||||
local spd = 0.03
|
||||
local ops = {
|
||||
[0] = {x = 0, y = 0, z = spd},
|
||||
[1] = {x = spd, y = 0, z = 0},
|
||||
[2] = {x = 0, y = 0, z = -spd},
|
||||
[3] = {x = -spd, y = 0, z = 0},
|
||||
}
|
||||
|
||||
local pos = self.object:getpos()
|
||||
|
||||
if node.param2 == 0 or node.param2 == 2 then
|
||||
pos.x = round(pos.x)
|
||||
end
|
||||
if node.param2 == 1 or node.param2 == 3 then
|
||||
pos.z = round(pos.z)
|
||||
end
|
||||
|
||||
pos = vector.add(pos, (ops[node.param2] or {x = 0, y = 0, z = 0}))
|
||||
|
||||
self.object:setpos(pos)
|
||||
end
|
||||
end
|
||||
}
|
||||
setmetatable(item, builtin_item)
|
||||
minetest.register_entity(":__builtin:item", item)
|
|
@ -1,23 +1,94 @@
|
|||
minetest.register_node("tech_reborn:tech_reborn_battery", {
|
||||
description = "Battery",
|
||||
tiles = {
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery.png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery.png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery.png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery.png",
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
on_construct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wired_node = 1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
machine_update = function(pos)
|
||||
tech_reborn.pushAdjacentEnergy(pos, 50)
|
||||
end,
|
||||
})
|
||||
--
|
||||
-- Battery Formspec
|
||||
--
|
||||
function make_battery_formspec(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
local power = meta:get_int("power")
|
||||
local capacity = meta:get_int("capacity")
|
||||
local n = math.floor(meta:get_int("power") / meta:get_int("capacity") * 10)
|
||||
|
||||
local fs = [[
|
||||
size[9,8;]
|
||||
bgcolor[#222222EE;false]
|
||||
listcolors[#cccccc55;#ffffff55;#888888;#33333399;#ffffff]
|
||||
label[3.2,0.5;Energy: ]] .. power .. [[ ME / ]] .. capacity .. [[ ME]
|
||||
|
||||
image[2.65,0.8;3,3;tech_reborn_battery_]] .. n .. [[.png]
|
||||
|
||||
label[0.5,3.5;Inventory]
|
||||
list[current_player;main;0.5,4;8,3;8]
|
||||
list[current_player;main;0.5,7.2;8,1;]
|
||||
|
||||
label[1,0.8;Charge]
|
||||
list[current_player;main;1,1.2;2,2;]
|
||||
|
||||
field[6.2,1;2.2,2;input; Input (Max: 50);50]
|
||||
field[6.2,2.1;2.2,2;output; Output (Max: 50);50]
|
||||
]]
|
||||
meta:set_string("formspec", fs)
|
||||
end
|
||||
|
||||
--
|
||||
-- Register The Battery and all of it's States
|
||||
--
|
||||
for n = 0, 10 do
|
||||
local groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wire_connect = 1}
|
||||
if n ~= 10 then
|
||||
groups.not_in_creative_inventory = 1
|
||||
end
|
||||
minetest.register_node("tech_reborn:battery_" .. n, {
|
||||
description = "Battery",
|
||||
tiles = {
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery_" .. n .. ".png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery_" .. n .. ".png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery_" .. n .. ".png",
|
||||
"tech_reborn_machine.png^tech_reborn_battery_" .. n .. ".png",
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if timer and not timer:is_started() then
|
||||
timer:start(0.1)
|
||||
end
|
||||
|
||||
-- Set Variables
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("power", 0)
|
||||
meta:set_int("capacity", 4000)
|
||||
|
||||
-- Create formspec
|
||||
make_battery_formspec(pos)
|
||||
|
||||
-- Prevent Stupid
|
||||
minetest.swap_node(pos, {name = "tech_reborn:battery_0"})
|
||||
end,
|
||||
groups = groups,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
drop = "tech_reborn:battery_10",
|
||||
node_placement_prediction = "tech_reborn:battery_0",
|
||||
on_timer = function(pos)
|
||||
-- Get Meta & Space
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- Attempt to share power
|
||||
local space = math.min(50, meta:get_int("capacity") - meta:get_int("power"))
|
||||
meta:set_int("power", meta:get_int("power") + tech_reborn.pullAdjacentEnergy(pos, space))
|
||||
local give = math.min(meta:get_int("power"), 50)
|
||||
meta:set_int("power", meta:get_int("power") - tech_reborn.pushAdjacentEnergy(pos, give))
|
||||
|
||||
-- Update formspec
|
||||
make_battery_formspec(pos)
|
||||
|
||||
-- Display Power Meta
|
||||
minetest.get_meta(pos):set_string("infotext", "Power Stored: " .. meta:get_int("power") .. " ME")
|
||||
|
||||
-- Change node textures
|
||||
local n = math.floor(meta:get_int("power") / meta:get_int("capacity") * 10)
|
||||
minetest.swap_node(pos, {name = "tech_reborn:battery_" .. n})
|
||||
|
||||
return true
|
||||
end
|
||||
})
|
||||
end
|
|
@ -3,16 +3,17 @@ minetest.register_node("tech_reborn:tech_reborn_creative_emitter", {
|
|||
tiles = {
|
||||
"tech_reborn_machine.png^tech_reborn_creative_emitter.png",
|
||||
},
|
||||
on_construct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wired_node = 1, dig_immediate = 3},
|
||||
groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wire_connect = 1, dig_immediate = 3},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
machine_update = function(pos)
|
||||
tech_reborn.pushAdjacentEnergy(pos, 50)
|
||||
on_timer = function(pos)
|
||||
tech_reborn.pushAdjacentEnergy(pos, 10)
|
||||
return true
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if timer and not timer:is_started() then
|
||||
timer:start(0.1)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -21,15 +22,16 @@ minetest.register_node("tech_reborn:tech_reborn_creative_consumer", {
|
|||
tiles = {
|
||||
"tech_reborn_machine.png^tech_reborn_creative_consumer.png",
|
||||
},
|
||||
on_construct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wired_node = 1, dig_immediate = 3},
|
||||
groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wire_connect = 1, dig_immediate = 3},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
machine_update = function(pos)
|
||||
on_timer = function(pos)
|
||||
tech_reborn.pullAdjacentEnergy(pos, 50)
|
||||
return true
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if timer and not timer:is_started() then
|
||||
timer:start(0.1)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -4,11 +4,27 @@ dofile(path .. "/monitor.lua")
|
|||
dofile(path .. "/battery.lua")
|
||||
dofile(path .. "/creative.lua")
|
||||
|
||||
minetest.register_abm({
|
||||
minetest.register_lbm({
|
||||
label = "Start Machine Timers",
|
||||
name = "tech_reborn:start_timers",
|
||||
nodenames = {"group:machine"},
|
||||
interval = 0.1,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
minetest.registered_nodes[minetest.get_node(pos).name].machine_update(pos)
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if timer and not timer:is_started() then
|
||||
timer:start(0.1)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, node)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "machine") > 0 then
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
if minetest.get_item_group(node.name, "machine") > 0 then
|
||||
minetest.after(0, function(pos) tech_reborn.wire.recalcModels(pos) end, pos)
|
||||
end
|
||||
end)
|
|
@ -9,17 +9,19 @@ minetest.register_node("tech_reborn:machine_monitor", {
|
|||
"tech_reborn_machine.png^tech_reborn_monitor.png",
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
on_construct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
tech_reborn.wire.recalcModels(pos)
|
||||
end,
|
||||
groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wired_node = 1},
|
||||
groups = {cracky = 1, oddly_breakable_by_hand = 1, machine = 1, wire_connect = 1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
machine_update = function(pos)
|
||||
on_timer = function(pos)
|
||||
local power = tech_reborn.getAdjacentEnergy(pos)
|
||||
local capacity = tech_reborn.getAdjacentMaxCapacity(pos)
|
||||
if power == false then power = 0 end
|
||||
minetest.get_meta(pos):set_string("infotext", "System Power: " .. power .. " ME")
|
||||
minetest.get_meta(pos):set_string("infotext", "System Power: " .. power .. " ME / " .. capacity .. " ME")
|
||||
return true
|
||||
end,
|
||||
})
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if timer and not timer:is_started() then
|
||||
timer:start(0.1)
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
0.400000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.250000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.250000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933;-1.000000; 1.000000;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000; 0.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.428343;,
|
||||
0.998489; 0.428343;,
|
||||
0.998489;-0.000865;,
|
||||
0.752021;-0.000865;,
|
||||
0.501532; 0.428370;,
|
||||
0.748390; 0.428370;,
|
||||
0.748390; 0.000446;,
|
||||
0.501532; 0.000446;,
|
||||
0.498917;-0.001106;,
|
||||
0.251491;-0.001106;,
|
||||
0.251491; 0.428051;,
|
||||
0.498917; 0.428051;,
|
||||
0.248894;-0.000986;,
|
||||
0.001044;-0.000986;,
|
||||
0.001044; 0.428880;,
|
||||
0.248894; 0.428880;,
|
||||
0.501286; 0.435655;,
|
||||
0.501286; 0.994849;,
|
||||
0.748836; 0.994849;,
|
||||
0.748836; 0.435655;,
|
||||
0.499388; 0.994456;,
|
||||
0.499388; 0.432462;,
|
||||
0.250599; 0.432462;,
|
||||
0.250599; 0.994456;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
0.600000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.500000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.500000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933;-1.000000; 1.000000;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000; 0.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.428343;,
|
||||
0.998489; 0.428343;,
|
||||
0.998489;-0.000865;,
|
||||
0.752021;-0.000865;,
|
||||
0.501532; 0.428370;,
|
||||
0.748390; 0.428370;,
|
||||
0.748390; 0.000446;,
|
||||
0.501532; 0.000446;,
|
||||
0.498917;-0.001106;,
|
||||
0.251491;-0.001106;,
|
||||
0.251491; 0.428051;,
|
||||
0.498917; 0.428051;,
|
||||
0.248894;-0.000986;,
|
||||
0.001044;-0.000986;,
|
||||
0.001044; 0.428880;,
|
||||
0.248894; 0.428880;,
|
||||
0.501286; 0.435655;,
|
||||
0.501286; 0.994849;,
|
||||
0.748836; 0.994849;,
|
||||
0.748836; 0.435655;,
|
||||
0.499388; 0.994456;,
|
||||
0.499388; 0.432462;,
|
||||
0.250599; 0.432462;,
|
||||
0.250599; 0.994456;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
0.600000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.750000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.750000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
0.855505;-1.000000; 1.000000;,
|
||||
0.855505; 1.000000; 1.000000;,
|
||||
-0.855505; 1.000000; 1.000000;,
|
||||
-0.855505;-1.000000; 1.000000;,
|
||||
0.855505; 1.000000; 1.000000;,
|
||||
0.855505; 1.000000;-1.000000;,
|
||||
-0.855505; 1.000000;-1.000000;,
|
||||
-0.855505; 1.000000; 1.000000;,
|
||||
0.855505; 1.000000;-1.000000;,
|
||||
0.855505;-1.000000;-1.000000;,
|
||||
-0.855505;-1.000000;-1.000000;,
|
||||
-0.855505; 1.000000;-1.000000;,
|
||||
0.855505;-1.000000;-1.000000;,
|
||||
0.855505;-1.000000; 1.000000;,
|
||||
-0.855505;-1.000000; 1.000000;,
|
||||
-0.855505;-1.000000;-1.000000;,
|
||||
-0.855505;-1.000000; 1.000000;,
|
||||
-0.855505; 1.000000; 1.000000;,
|
||||
-0.855505; 1.000000;-1.000000;,
|
||||
-0.855505;-1.000000;-1.000000;,
|
||||
0.855505;-1.000000;-1.000000;,
|
||||
0.855505; 1.000000;-1.000000;,
|
||||
0.855505; 1.000000; 1.000000;,
|
||||
0.855505;-1.000000; 1.000000;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000; 0.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.399050;,
|
||||
0.998490; 0.399050;,
|
||||
0.998490; 0.002553;,
|
||||
0.752021; 0.002553;,
|
||||
0.501532; 0.399075;,
|
||||
0.748390; 0.399076;,
|
||||
0.748390; 0.003764;,
|
||||
0.501532; 0.003764;,
|
||||
0.498917; 0.002330;,
|
||||
0.251491; 0.002330;,
|
||||
0.251491; 0.398781;,
|
||||
0.498917; 0.398781;,
|
||||
0.248894; 0.002441;,
|
||||
0.001044; 0.002441;,
|
||||
0.001044; 0.399547;,
|
||||
0.248894; 0.399547;,
|
||||
0.501286; 0.408662;,
|
||||
0.501286; 0.997163;,
|
||||
0.748836; 0.997162;,
|
||||
0.748836; 0.408662;,
|
||||
0.499388; 0.996748;,
|
||||
0.499388; 0.405301;,
|
||||
0.250599; 0.405301;,
|
||||
0.250599; 0.996748;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 1.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933;-1.000000; 1.000000;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000; 0.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.381437;,
|
||||
0.998489; 0.381437;,
|
||||
0.998489; 0.002102;,
|
||||
0.752021; 0.002102;,
|
||||
0.501532; 0.381462;,
|
||||
0.748390; 0.381462;,
|
||||
0.748390; 0.003260;,
|
||||
0.501532; 0.003260;,
|
||||
0.498917; 0.001888;,
|
||||
0.251491; 0.001888;,
|
||||
0.251491; 0.381180;,
|
||||
0.498917; 0.381180;,
|
||||
0.248894; 0.001995;,
|
||||
0.001044; 0.001995;,
|
||||
0.001044; 0.381913;,
|
||||
0.248894; 0.381912;,
|
||||
0.501286; 0.388647;,
|
||||
0.501286; 0.998001;,
|
||||
0.748836; 0.998000;,
|
||||
0.748836; 0.388647;,
|
||||
0.499388; 0.997572;,
|
||||
0.499388; 0.385166;,
|
||||
0.250599; 0.385167;,
|
||||
0.250599; 0.997572;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
0.400000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.250000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.250000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933;-1.000000; 1.000000;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000; 0.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.428343;,
|
||||
0.998489; 0.428343;,
|
||||
0.998489;-0.000865;,
|
||||
0.752021;-0.000865;,
|
||||
0.501532; 0.428370;,
|
||||
0.748390; 0.428370;,
|
||||
0.748390; 0.000446;,
|
||||
0.501532; 0.000446;,
|
||||
0.498917;-0.001106;,
|
||||
0.251491;-0.001106;,
|
||||
0.251491; 0.428051;,
|
||||
0.498917; 0.428051;,
|
||||
0.248894;-0.000986;,
|
||||
0.001044;-0.000986;,
|
||||
0.001044; 0.428880;,
|
||||
0.248894; 0.428880;,
|
||||
0.501286; 0.435655;,
|
||||
0.501286; 0.994849;,
|
||||
0.748836; 0.994849;,
|
||||
0.748836; 0.435655;,
|
||||
0.499388; 0.994456;,
|
||||
0.499388; 0.432462;,
|
||||
0.250599; 0.432462;,
|
||||
0.250599; 0.994456;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
0.000000, 0.000000, 0.600000, 0.000000,
|
||||
0.000000, 0.500000, 0.000000, 0.000000,
|
||||
-0.500000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
-0.614933;-1.000000; 1.000000;,
|
||||
-0.614933; 1.000000; 1.000000;,
|
||||
-0.614933; 1.000000;-1.000000;,
|
||||
-0.614933;-1.000000;-1.000000;,
|
||||
0.614933;-1.000000;-1.000000;,
|
||||
0.614933; 1.000000;-1.000000;,
|
||||
0.614933; 1.000000; 1.000000;,
|
||||
0.614933;-1.000000; 1.000000;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-0.000000; 1.000000; 0.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
1.000000; 0.000000; 0.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.428343;,
|
||||
0.998489; 0.428343;,
|
||||
0.998489;-0.000865;,
|
||||
0.752021;-0.000865;,
|
||||
0.501532; 0.428370;,
|
||||
0.748390; 0.428370;,
|
||||
0.748390; 0.000446;,
|
||||
0.501532; 0.000446;,
|
||||
0.498917;-0.001106;,
|
||||
0.251491;-0.001106;,
|
||||
0.251491; 0.428051;,
|
||||
0.498917; 0.428051;,
|
||||
0.248894;-0.000986;,
|
||||
0.001044;-0.000986;,
|
||||
0.001044; 0.428880;,
|
||||
0.248894; 0.428880;,
|
||||
0.501286; 0.435655;,
|
||||
0.501286; 0.994849;,
|
||||
0.748836; 0.994849;,
|
||||
0.748836; 0.435655;,
|
||||
0.499388; 0.994456;,
|
||||
0.499388; 0.432462;,
|
||||
0.250599; 0.432462;,
|
||||
0.250599; 0.994456;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
0.600000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.750000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.750000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
1.250000;-1.000000;-0.684404;,
|
||||
1.250000; 1.000000;-0.684404;,
|
||||
1.250000; 1.000000; 0.684404;,
|
||||
1.250000;-1.000000; 0.684404;,
|
||||
1.250000; 1.000000;-0.684404;,
|
||||
-1.250000; 1.000000;-0.684404;,
|
||||
-1.250000; 1.000000; 0.684404;,
|
||||
1.250000; 1.000000; 0.684404;,
|
||||
-1.250000; 1.000000;-0.684404;,
|
||||
-1.250000;-1.000000;-0.684404;,
|
||||
-1.250000;-1.000000; 0.684404;,
|
||||
-1.250000; 1.000000; 0.684404;,
|
||||
-1.250000;-1.000000;-0.684404;,
|
||||
1.250000;-1.000000;-0.684404;,
|
||||
1.250000;-1.000000; 0.684404;,
|
||||
-1.250000;-1.000000; 0.684404;,
|
||||
1.250000;-1.000000; 0.684404;,
|
||||
1.250000; 1.000000; 0.684404;,
|
||||
-1.250000; 1.000000; 0.684404;,
|
||||
-1.250000;-1.000000; 0.684404;,
|
||||
-1.250000;-1.000000;-0.684404;,
|
||||
-1.250000; 1.000000;-0.684404;,
|
||||
1.250000; 1.000000;-0.684404;,
|
||||
1.250000;-1.000000;-0.684404;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
1.000000; 0.000000; 0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
0.000000;-1.000000;-0.000000;,
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
0.000000; 0.000000;-1.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.399050;,
|
||||
0.998490; 0.399050;,
|
||||
0.998490; 0.002553;,
|
||||
0.752021; 0.002553;,
|
||||
0.501532; 0.399075;,
|
||||
0.748390; 0.399076;,
|
||||
0.748390; 0.003764;,
|
||||
0.501532; 0.003764;,
|
||||
0.498917; 0.002330;,
|
||||
0.251491; 0.002330;,
|
||||
0.251491; 0.398781;,
|
||||
0.498917; 0.398781;,
|
||||
0.248894; 0.002441;,
|
||||
0.001044; 0.002441;,
|
||||
0.001044; 0.399547;,
|
||||
0.248894; 0.399547;,
|
||||
0.501286; 0.408662;,
|
||||
0.501286; 0.997163;,
|
||||
0.748836; 0.997162;,
|
||||
0.748836; 0.408662;,
|
||||
0.499388; 0.996748;,
|
||||
0.499388; 0.405301;,
|
||||
0.250599; 0.405301;,
|
||||
0.250599; 0.996748;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
|
@ -0,0 +1,95 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 1.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
24;
|
||||
-1.000000;-1.000000; 0.614933;,
|
||||
-1.000000; 1.000000; 0.614933;,
|
||||
-1.000000; 1.000000;-0.614933;,
|
||||
-1.000000;-1.000000;-0.614933;,
|
||||
-1.000000; 1.000000; 0.614933;,
|
||||
1.000000; 1.000000; 0.614933;,
|
||||
1.000000; 1.000000;-0.614933;,
|
||||
-1.000000; 1.000000;-0.614933;,
|
||||
1.000000; 1.000000; 0.614933;,
|
||||
1.000000;-1.000000; 0.614933;,
|
||||
1.000000;-1.000000;-0.614933;,
|
||||
1.000000; 1.000000;-0.614933;,
|
||||
1.000000;-1.000000; 0.614933;,
|
||||
-1.000000;-1.000000; 0.614933;,
|
||||
-1.000000;-1.000000;-0.614933;,
|
||||
1.000000;-1.000000;-0.614933;,
|
||||
-1.000000;-1.000000;-0.614933;,
|
||||
-1.000000; 1.000000;-0.614933;,
|
||||
1.000000; 1.000000;-0.614933;,
|
||||
1.000000;-1.000000;-0.614933;,
|
||||
1.000000;-1.000000; 0.614933;,
|
||||
1.000000; 1.000000; 0.614933;,
|
||||
-1.000000; 1.000000; 0.614933;,
|
||||
-1.000000;-1.000000; 0.614933;;
|
||||
6;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;;
|
||||
MeshNormals { // Cube normals
|
||||
6;
|
||||
-1.000000; 0.000000; 0.000000;,
|
||||
0.000000; 1.000000;-0.000000;,
|
||||
1.000000; 0.000000;-0.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
-0.000000; 0.000000;-1.000000;,
|
||||
-0.000000; 0.000000; 1.000000;;
|
||||
6;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
24;
|
||||
0.752021; 0.381437;,
|
||||
0.998489; 0.381437;,
|
||||
0.998489; 0.002102;,
|
||||
0.752021; 0.002102;,
|
||||
0.501532; 0.381462;,
|
||||
0.748390; 0.381462;,
|
||||
0.748390; 0.003260;,
|
||||
0.501532; 0.003260;,
|
||||
0.498917; 0.001888;,
|
||||
0.251491; 0.001888;,
|
||||
0.251491; 0.381180;,
|
||||
0.498917; 0.381180;,
|
||||
0.248894; 0.001995;,
|
||||
0.001044; 0.001995;,
|
||||
0.001044; 0.381913;,
|
||||
0.248894; 0.381912;,
|
||||
0.501286; 0.388647;,
|
||||
0.501286; 0.998001;,
|
||||
0.748836; 0.998000;,
|
||||
0.748836; 0.388647;,
|
||||
0.499388; 0.997572;,
|
||||
0.499388; 0.385166;,
|
||||
0.250599; 0.385167;,
|
||||
0.250599; 0.997572;;
|
||||
} // End of Cube UV coordinates
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 436 B |
After Width: | Height: | Size: 456 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 453 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 290 B |
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 200 B |
After Width: | Height: | Size: 501 B |
After Width: | Height: | Size: 273 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 468 B |
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 469 B |
After Width: | Height: | Size: 204 B |
After Width: | Height: | Size: 197 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 259 B |
|
@ -1,15 +1,15 @@
|
|||
minetest.register_tool("tech_reborn:wrench", {
|
||||
inventory_image = "tech_reborn_wrench.png",
|
||||
tooel_capabilities = {
|
||||
full_punch_interval = 0.2,
|
||||
max_drop_level = 1,
|
||||
groupcaps = {
|
||||
snappy = {maxlevel = 1, uses = 250, times = {
|
||||
[0] = 0.1,
|
||||
[1] = 0.1,
|
||||
[2] = 0.1,
|
||||
[3] = 0.1
|
||||
}}
|
||||
}
|
||||
}
|
||||
-- tool_capabilities = {
|
||||
-- full_punch_interval = 0.2,
|
||||
-- max_drop_level = 1,
|
||||
-- groupcaps = {
|
||||
-- wire = {maxlevel = 1, uses = 250, times = {
|
||||
-- [0] = 0.1,
|
||||
-- [1] = 0.1,
|
||||
-- [2] = 0.1,
|
||||
-- [3] = 0.1
|
||||
-- }}
|
||||
-- }
|
||||
-- }
|
||||
})
|