summaryrefslogtreecommitdiff
path: root/computer/init.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-01-31 19:39:31 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-01-31 19:39:31 -0500
commit39f5cba27eef35877c91291f518974f34130fcb6 (patch)
tree117a9d1b7d4ee5f78f73e1216e982c366ed9ecc6 /computer/init.lua
parent2922421f4a88e56a0a1c819f62bf2bc287835388 (diff)
downloaddreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar
dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.gz
dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.bz2
dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.tar.xz
dreambuilder_modpack-39f5cba27eef35877c91291f518974f34130fcb6.zip
Huge update - lots of mods:
areas, biome_lib, blox, bobblocks, boost_cart, homedecor, mobs, coloredwood, ilights, inbox, item_tweaks, moreblocks, moreores, pipeworks, plasticbox, signs_lib, stainedglass, roads, unifieddyes, vines, worldedit, xban2, maybe some others I didn't think about ;-)
Diffstat (limited to 'computer/init.lua')
-rw-r--r--computer/init.lua37
1 files changed, 16 insertions, 21 deletions
diff --git a/computer/init.lua b/computer/init.lua
index bb690ed..534878d 100644
--- a/computer/init.lua
+++ b/computer/init.lua
@@ -2,19 +2,18 @@ computer = {}
screwdriver = screwdriver or {}
computer.register = function (name, def)
- local nodename = name
if (name:sub(1, 1) == ":") then name = name:sub(2) end
local modname, basename = name:match("^([^:]+):(.*)")
local TEXPFX = modname.."_"..basename.."_"
local ONSTATE = modname..":"..basename
local OFFSTATE = modname..":"..basename.."_off"
- local def = def
+ local cdef = table.copy(def)
minetest.register_node(ONSTATE, {
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
- description = def.description,
- inventory_image = def.inventory_image,
+ description = cdef.description,
+ inventory_image = cdef.inventory_image,
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
tiles = {
TEXPFX.."tp.png",
@@ -24,10 +23,10 @@ computer.register = function (name, def)
TEXPFX.."bk.png",
TEXPFX.."ft.png"
},
- node_box = def.node_box,
- selection_box = def.node_box,
+ node_box = cdef.node_box,
+ selection_box = cdef.node_box,
on_rightclick = function (pos, node, clicker, itemstack)
- if def.on_turn_off and def.on_turn_off(pos, node, clicker, itemstack) then
+ if cdef.on_turn_off and cdef.on_turn_off(pos, node, clicker, itemstack) then
return itemstack
end
node.name = OFFSTATE
@@ -41,17 +40,17 @@ computer.register = function (name, def)
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
tiles = {
- (TEXPFX.."tp"..(def.tiles_off.top and "_off" or "")..".png"),
- (TEXPFX.."bt"..(def.tiles_off.bottom and "_off" or "")..".png"),
- (TEXPFX.."rt"..(def.tiles_off.right and "_off" or "")..".png"),
- (TEXPFX.."lt"..(def.tiles_off.left and "_off" or "")..".png"),
- (TEXPFX.."bk"..(def.tiles_off.back and "_off" or "")..".png"),
- (TEXPFX.."ft"..(def.tiles_off.front and "_off" or "")..".png")
+ (TEXPFX.."tp"..(cdef.tiles_off.top and "_off" or "")..".png"),
+ (TEXPFX.."bt"..(cdef.tiles_off.bottom and "_off" or "")..".png"),
+ (TEXPFX.."rt"..(cdef.tiles_off.right and "_off" or "")..".png"),
+ (TEXPFX.."lt"..(cdef.tiles_off.left and "_off" or "")..".png"),
+ (TEXPFX.."bk"..(cdef.tiles_off.back and "_off" or "")..".png"),
+ (TEXPFX.."ft"..(cdef.tiles_off.front and "_off" or "")..".png")
},
- node_box = def.node_box_off or def.node_box,
- selection_box = def.node_box_off or def.node_box,
+ node_box = cdef.node_box_off or cdef.node_box,
+ selection_box = cdef.node_box_off or cdef.node_box,
on_rightclick = function (pos, node, clicker, itemstack)
- if def.on_turn_on and def.on_turn_on(pos, node, clicker, itemstack) then
+ if cdef.on_turn_on and cdef.on_turn_on(pos, node, clicker, itemstack) then
return itemstack
end
node.name = ONSTATE
@@ -63,13 +62,10 @@ computer.register = function (name, def)
end
computer.register_handheld = function (name, def)
- local nodename = name
if (name:sub(1, 1) == ":") then name = name:sub(2) end
local modname, basename = name:match("^([^:]+):(.*)")
local TEXPFX = modname.."_"..basename.."_inv"
local ONSTATE = modname..":"..basename
- local OFFSTATE = modname..":"..basename.."_off"
- local on_use = def.on_use
minetest.register_craftitem(ONSTATE, {
description = def.description,
inventory_image = TEXPFX..".png",
@@ -79,8 +75,7 @@ end
computer.pixelnodebox = function (size, boxes)
local fixed = { }
- local i, box
- for i, box in ipairs(boxes) do
+ for _, box in ipairs(boxes) do
local x, y, z, w, h, l = unpack(box)
fixed[#fixed + 1] = {
(x / size) - 0.5,