diff options
| -rw-r--r-- | COPYING | 24 | ||||
| -rw-r--r-- | init.lua | 100 | ||||
| -rw-r--r-- | mod.conf | 4 | ||||
| -rw-r--r-- | textures/technic_adminnodes_cable_overlay.png | bin | 0 -> 1499 bytes | |||
| -rw-r--r-- | textures/technic_adminnodes_generator_overlay.png | bin | 0 -> 1342 bytes | 
5 files changed, 128 insertions, 0 deletions
@@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..7dff2c6 --- /dev/null +++ b/init.lua @@ -0,0 +1,100 @@ +local old_itc = technic.is_tier_cable + +local old_gct = technic.get_cable_tier + +technic.is_tier_cable = function(name,tier) +	local itcresult = old_itc(name,tier) +	if itcresult then +		return itcresult +	elseif minetest.registered_nodes[name] and minetest.registered_nodes[name]._origcable then +		return old_itc(minetest.registered_nodes[name]._origcable,tier) +	end +end + +technic.get_cable_tier = function(name) +	local gctresult = old_gct(name) +	if gctresult then +		return gctresult +	elseif minetest.registered_nodes[name] and minetest.registered_nodes[name]._origcable then +		return old_gct(minetest.registered_nodes[name]._origcable) +	end +end + +local cables = { +	["technic:lv_cable"] = "technic_adminnodes:lv_cable_admin", +	["technic:mv_cable"] = "technic_adminnodes:mv_cable_admin", +	["technic:hv_cable"] = "technic_adminnodes:hv_cable_admin", +} + +for oldname,newname in pairs(cables) do +	local def = table.copy(minetest.registered_nodes[oldname]) +	for group in pairs(def.groups) do +		if not string.find(group,"technic") then def.groups[group] = nil end +	end +	for face,img in ipairs(def.tiles) do +		def.tiles[face] = img.."^[resize:64x64^(technic_adminnodes_cable_overlay.png^[opacity:128)" +	end +	def.groups.not_in_creative_inventory = 1 +	def.drop = "" +	def.mod_origin = nil +	def.description = "Unbreakable "..def.description +	def.name = nil +	def._origcable = oldname +	def.inventory_image = "[combine:32x32:0,0="..def.inventory_image..":15,15=(basic_materials_padlock.png\\^[resize\\:16x16)" +	minetest.register_node(newname,def) +end + +for _,tier in ipairs({"lv","mv","hv",}) do +	local metafieldname = string.upper(tier).."_EU_supply" +	minetest.register_node("technic_adminnodes:generator_"..tier,{ +		description = "Magical "..string.upper(tier).." Power Supply", +		paramtype2 = "facedir", +		on_rotate = minetest.global_exists("screwdriver") and screwdriver.rotate_simple, +		groups = { +			not_in_creative_inventory = 1, +			technic_machine = 1, +			["technic_"..tier] = 1, +		}, +		tiles = { +			"technic_"..tier.."_generator_top.png", +			"technic_machine_bottom.png", +			"technic_"..tier.."_generator_side.png", +			"technic_"..tier.."_generator_side.png", +			"technic_"..tier.."_generator_side.png", +			"technic_"..tier.."_generator_front.png^technic_adminnodes_generator_overlay.png", +		}, +		on_construct = function(pos) +			local meta = minetest.get_meta(pos) +			local default = 1000 +			meta:set_int("amount",default) +			meta:set_string("infotext","Magical "..string.upper(tier).." Power Supply Has No Network") +			meta:set_string("formspec","field[amount;EU to generate;${amount}") +		end, +		technic_run = function(pos) +			local meta = minetest.get_meta(pos) +			local amount = meta:get_int("amount") +			meta:set_int(string.upper(tier).."_EU_supply",amount) +			meta:set_string("infotext","Magical "..string.upper(tier).." Power Supply, producing "..technic.EU_string(amount)) +		end, +		connect_sides = { +			"bottom", +			"back", +			"left", +			"right", +		}, +		on_receive_fields = function(pos,formname,fields,sender) +			local name = sender:get_player_name() +			if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then +				minetest.record_protection_violation(pos,name) +				return +			end +			local meta = minetest.get_meta(pos) +			if tonumber(fields.amount) then +				local newamount = math.min(10^9,math.max(0,math.floor(tonumber(fields.amount)))) +				meta:set_int("amount",newamount) +				meta:set_string("infotext","Magical "..string.upper(tier).." Power Supply, producing "..technic.EU_string(newamount)) +			end +		end, +	}) +	technic.register_machine(string.upper(tier),"technic_adminnodes:generator_"..tier,technic.producer) +end diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..7164447 --- /dev/null +++ b/mod.conf @@ -0,0 +1,4 @@ +name = technic_adminnodes +description = Special nodes for Minetest's technic mod, for admin use +depends = technic,basic_materials +optional_depends = screwdriver diff --git a/textures/technic_adminnodes_cable_overlay.png b/textures/technic_adminnodes_cable_overlay.png Binary files differnew file mode 100644 index 0000000..d5836f9 --- /dev/null +++ b/textures/technic_adminnodes_cable_overlay.png diff --git a/textures/technic_adminnodes_generator_overlay.png b/textures/technic_adminnodes_generator_overlay.png Binary files differnew file mode 100644 index 0000000..d9ec628 --- /dev/null +++ b/textures/technic_adminnodes_generator_overlay.png  | 
