Compare commits
	
		
			130 Commits
		
	
	
		
			frames-exp
			...
			recipes_re
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 9004ab3322 | ||
|  | 01b475c7cc | ||
|  | 63ab5ef5d4 | ||
|  | 74d54eb0b4 | ||
|  | d9fc156960 | ||
|  | c26f45c962 | ||
|  | 775cb9d132 | ||
|  | fb15df52e2 | ||
|  | 43295b5b7f | ||
|  | 0e6b3ce86b | ||
|  | 5727a84bd8 | ||
|  | 8f1c202eaa | ||
|  | d55ecc39f9 | ||
|  | 95fcc435f1 | ||
|  | 5f2d09b8a9 | ||
|  | 2d6f34df15 | ||
|  | c0a17396bf | ||
|  | aa8af0c871 | ||
|  | 88cbc6c2a7 | ||
|  | 2a23587445 | ||
|  | 4ea213c1e0 | ||
|  | 96ad67b9ef | ||
|  | 51c02e9c8a | ||
|  | 9019ebe496 | ||
|  | c636582707 | ||
|  | c394984ae5 | ||
|  | 7c4b7046cc | ||
|  | f7d103cd96 | ||
|  | 23603e7f41 | ||
|  | c2bc4e9d56 | ||
|  | 9181666cdc | ||
|  | 799c1b3409 | ||
|  | ebc122fb35 | ||
|  | 7c2f2d9630 | ||
|  | b74c2d38b9 | ||
|  | 4d20e4473e | ||
|  | 623fcae4a4 | ||
|  | 29429f636e | ||
|  | a5fc7ac41e | ||
|  | 6a08071d86 | ||
|  | 68b7bcc28e | ||
|  | ecb53e9717 | ||
|  | b204090acc | ||
|  | c7a4c05860 | ||
|  | 45e1f05ffc | ||
|  | 30adc3b651 | ||
|  | 67b709744f | ||
|  | 5c689acc22 | ||
|  | 00d7c9bdea | ||
|  | 0294fc8f3a | ||
|  | 9b64ffea8c | ||
|  | c9bf799e32 | ||
|  | 03a5375e55 | ||
|  | 99fd5dfee5 | ||
|  | ca69473664 | ||
|  | 1a94fdc601 | ||
|  | 70fb21ef36 | ||
|  | 5c59d97070 | ||
|  | db79675570 | ||
|  | 60c75bce74 | ||
|  | e10335e952 | ||
|  | f504178421 | ||
|  | e748af927a | ||
|  | 04c6f5bea3 | ||
|  | 18cae761af | ||
|  | 593972b156 | ||
|  | 628a18977b | ||
|  | 39c41a06f4 | ||
|  | db20250371 | ||
|  | 44dbc75b61 | ||
|  | 061d1a3ab4 | ||
|  | 7dc21cec40 | ||
|  | 179364ff8f | ||
|  | 5dd09aeff4 | ||
|  | 9ab5846d56 | ||
|  | 1b7fa38082 | ||
|  | a6dae893d6 | ||
|  | 49052d6f4a | ||
|  | 252156d653 | ||
|  | 8684fa1733 | ||
|  | 8a88812b8b | ||
|  | 0201135231 | ||
|  | 8bdbe1e451 | ||
|  | 821fba9b02 | ||
|  | 187fd90a7c | ||
|  | 2db9121bdb | ||
|  | b28001e36f | ||
|  | e1c995f654 | ||
|  | 52e7014b7c | ||
|  | 8c1be3b48e | ||
|  | 8fba5e1140 | ||
|  | 68f7d34e1b | ||
|  | ebc114df71 | ||
|  | dc324816db | ||
|  | 749df3b581 | ||
|  | 93b0d25cbc | ||
|  | 8e2cb0121b | ||
|  | 2df417feb7 | ||
|  | 018b248d51 | ||
|  | c5a2f0facc | ||
|  | 731a82169b | ||
|  | 0d32e05b52 | ||
|  | 82f4862e73 | ||
|  | f3bba0aaac | ||
|  | 92db8e1f76 | ||
|  | dd2962aba6 | ||
|  | d8437faebc | ||
|  | 78cacdcbc6 | ||
|  | c5d287f5f5 | ||
|  | 64db3d14d8 | ||
|  | bab8517b2a | ||
|  | 5cf765b2f1 | ||
|  | 0ea1bd1fa2 | ||
|  | ae235ee8f3 | ||
|  | 8ef3f20c3c | ||
|  | f3d8b47b20 | ||
|  | 818a0e5ff0 | ||
|  | 47b0b59884 | ||
|  | 7a3cd49597 | ||
|  | ef70cbfbf2 | ||
|  | 37acdc77f7 | ||
|  | 163457ed9a | ||
|  | 05b28f553e | ||
|  | a35db449b3 | ||
|  | 354ee6f313 | ||
|  | 0809dd747e | ||
|  | 76a8acbe5b | ||
|  | 08db41ee4d | ||
|  | bde49aca61 | ||
|  | 2d8ff45d9a | 
							
								
								
									
										30
									
								
								README.md
									
									
									
									
									
								
							
							
						
						| @@ -1,14 +1,22 @@ | |||||||
| technic 0.4.7 | Technic | ||||||
|  | ======= | ||||||
|  |  | ||||||
| Technic mod for Minetest 0.4.7 | Credits for contributing to the project (in alphabetical order): | ||||||
|  |   * kpoppel | ||||||
|  |   * Nekogloop | ||||||
|  |   * Nore/Novatux | ||||||
|  |   * ShadowNinja | ||||||
|  |   * VanessaE | ||||||
|  |   * And many others... | ||||||
|  |  | ||||||
| Credits for contributing to the project: | FAQ | ||||||
| Nekogloop | --- | ||||||
| ShadowNinja |  | ||||||
| VanessaE | 1. My technic circuit doesn't work.  No power is distrubuted. | ||||||
| Nore/Novatux |   * A: Make sure you have a switching station connected. | ||||||
| kpoppel |  | ||||||
| And many others for ideas/inspiring  | License | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | See mod folders for their licences | ||||||
|  |  | ||||||
| License: |  | ||||||
| LGPLv2+ |  | ||||||
|   | |||||||
| @@ -1 +1,3 @@ | |||||||
| default | default | ||||||
|  | intllib? | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,18 +4,33 @@ | |||||||
| local technic = technic or {} | local technic = technic or {} | ||||||
| technic.concrete_posts = {} | technic.concrete_posts = {} | ||||||
|  |  | ||||||
|  | -- Boilerplate to support localized strings if intllib mod is installed. | ||||||
|  | local S | ||||||
|  | if intllib then | ||||||
|  | 	S = intllib.Getter() | ||||||
|  | else | ||||||
|  | 	S = function(s) return s end | ||||||
|  | end | ||||||
|  |  | ||||||
| minetest.register_alias("technic:concrete_post",   "technic:concrete_post0") | minetest.register_alias("technic:concrete_post",   "technic:concrete_post0") | ||||||
| minetest.register_alias("technic:concrete_post32", "technic:concrete_post12") | minetest.register_alias("technic:concrete_post32", "technic:concrete_post12") | ||||||
| minetest.register_alias("technic:concrete_post33", "technic:concrete_post3") | minetest.register_alias("technic:concrete_post33", "technic:concrete_post3") | ||||||
| minetest.register_alias("technic:concrete_post34", "technic:concrete_post28") | minetest.register_alias("technic:concrete_post34", "technic:concrete_post28") | ||||||
| minetest.register_alias("technic:concrete_post35", "technic:concrete_post19") | minetest.register_alias("technic:concrete_post35", "technic:concrete_post19") | ||||||
|  |  | ||||||
|  | local steel_ingot | ||||||
|  | if minetest.get_modpath("technic_worldgen") then | ||||||
|  | 	steel_ingot = "technic:carbon_steel_ingot" | ||||||
|  | else | ||||||
|  | 	steel_ingot = "default:steel_ingot" | ||||||
|  | end | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:rebar 6', | 	output = 'technic:rebar 6', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'','', 'default:steel_ingot'}, | 		{'','', steel_ingot}, | ||||||
| 		{'','default:steel_ingot',''}, | 		{'',steel_ingot,''}, | ||||||
| 		{'default:steel_ingot', '', ''}, | 		{steel_ingot, '', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -61,12 +76,12 @@ local box_x2       = {0,     -0.3, -0.1,  -0.5, 0.3, 0.1} | |||||||
| local box_z2       = {-0.1,  -0.3, 0,     0.1,  0.3, -0.5} | local box_z2       = {-0.1,  -0.3, 0,     0.1,  0.3, -0.5} | ||||||
|  |  | ||||||
| minetest.register_craftitem(":technic:rebar", { | minetest.register_craftitem(":technic:rebar", { | ||||||
| 	description = "Rebar", | 	description = S("Rebar"), | ||||||
| 	inventory_image = "technic_rebar.png", | 	inventory_image = "technic_rebar.png", | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node(":technic:concrete", { | minetest.register_node(":technic:concrete", { | ||||||
| 	description = "Concrete Block", | 	description = S("Concrete Block"), | ||||||
| 	tile_images = {"technic_concrete_block.png",}, | 	tile_images = {"technic_concrete_block.png",}, | ||||||
| 	groups = {cracky=1, level=2, concrete=1}, | 	groups = {cracky=1, level=2, concrete=1}, | ||||||
| 	sounds = default.node_sound_stone_defaults(), | 	sounds = default.node_sound_stone_defaults(), | ||||||
| @@ -79,7 +94,7 @@ minetest.register_node(":technic:concrete", { | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node(":technic:blast_resistant_concrete", { | minetest.register_node(":technic:blast_resistant_concrete", { | ||||||
| 	description = "Blast-resistant Concrete Block", | 	description = S("Blast-resistant Concrete Block"), | ||||||
| 	tile_images = {"technic_blast_resistant_concrete_block.png",}, | 	tile_images = {"technic_blast_resistant_concrete_block.png",}, | ||||||
| 	groups={cracky=1, level=3, concrete=1}, | 	groups={cracky=1, level=3, concrete=1}, | ||||||
| 	sounds = default.node_sound_stone_defaults(), | 	sounds = default.node_sound_stone_defaults(), | ||||||
| @@ -92,7 +107,7 @@ minetest.register_node(":technic:blast_resistant_concrete", { | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node(":technic:concrete_post_platform", { | minetest.register_node(":technic:concrete_post_platform", { | ||||||
| 	description = "Concrete Post Platform", | 	description = S("Concrete Post Platform"), | ||||||
| 	tile_images = {"technic_concrete_block.png",}, | 	tile_images = {"technic_concrete_block.png",}, | ||||||
| 	groups={cracky=1, level=2}, | 	groups={cracky=1, level=2}, | ||||||
| 	sounds = default.node_sound_stone_defaults(), | 	sounds = default.node_sound_stone_defaults(), | ||||||
| @@ -222,7 +237,7 @@ for platform = 0, 1 do | |||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	minetest.register_node(":technic:concrete_post"..id, { | 	minetest.register_node(":technic:concrete_post"..id, { | ||||||
| 		description = "Concrete Post", | 		description = S("Concrete Post"), | ||||||
| 		tiles = {"technic_concrete_block.png"}, | 		tiles = {"technic_concrete_block.png"}, | ||||||
| 		groups = groups, | 		groups = groups, | ||||||
| 		sounds = default.node_sound_stone_defaults(), | 		sounds = default.node_sound_stone_defaults(), | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								concrete/locale/de.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,10 @@ | |||||||
|  | # German Translation for technic_concrete | ||||||
|  | # Deutsche Übersetzung von technic_concrete | ||||||
|  | # by Xanthin | ||||||
|  |  | ||||||
|  | Rebar = Bewehrungsstab | ||||||
|  | Concrete Block = Betonblock | ||||||
|  | Blast-resistant Concrete Block = Explosionsbestaendiger Betonblock | ||||||
|  | Concrete Post Platform = Betonpfostenplattform | ||||||
|  | Concrete Post = Betonpfosten | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								concrete/locale/template.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,8 @@ | |||||||
|  | # technic_concrete translation template | ||||||
|  |  | ||||||
|  | Rebar = | ||||||
|  | Concrete Block = | ||||||
|  | Blast-resistant Concrete Block = | ||||||
|  | Concrete Post Platform = | ||||||
|  | Concrete Post = | ||||||
|  |  | ||||||
| @@ -2,3 +2,5 @@ default | |||||||
| moreblocks | moreblocks | ||||||
| technic_worldgen | technic_worldgen | ||||||
| concrete | concrete | ||||||
|  | intllib? | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,11 +1,17 @@ | |||||||
| -- Minetest 0.4.6 mod: extranodes | -- Minetest 0.4.6 mod: extranodes | ||||||
| -- namespace: technic | -- namespace: technic | ||||||
|  | -- Boilerplate to support localized strings if intllib mod is installed. | ||||||
|  | local S | ||||||
|  | if intllib then | ||||||
|  | 	S = intllib.Getter() | ||||||
|  | else | ||||||
|  | 	S = function(s) return s end | ||||||
|  | end | ||||||
| --register stairslike nodes  | --register stairslike nodes  | ||||||
| register_stair_slab_panel_micro("technic", "marble", "technic:marble", | register_stair_slab_panel_micro("technic", "marble", "technic:marble", | ||||||
| 	{cracky=2, not_in_creative_inventory=1}, | 	{cracky=2, not_in_creative_inventory=1}, | ||||||
| 	{"technic_marble.png"}, | 	{"technic_marble.png"}, | ||||||
| 	"Marble", | 	S("Marble"), | ||||||
| 	"marble", | 	"marble", | ||||||
| 	"facedir", | 	"facedir", | ||||||
| 	0) | 	0) | ||||||
| @@ -13,7 +19,7 @@ register_stair_slab_panel_micro("technic", "marble", "technic:marble", | |||||||
| register_stair_slab_panel_micro("technic", "marble_bricks", "technic:marble_bricks", | register_stair_slab_panel_micro("technic", "marble_bricks", "technic:marble_bricks", | ||||||
| 	{cracky=2, not_in_creative_inventory=1}, | 	{cracky=2, not_in_creative_inventory=1}, | ||||||
| 	{"technic_marble_bricks.png"}, | 	{"technic_marble_bricks.png"}, | ||||||
| 	"Marble Bricks", | 	S("Marble Bricks"), | ||||||
| 	"marble_bricks", | 	"marble_bricks", | ||||||
| 	"facedir", | 	"facedir", | ||||||
| 	0) | 	0) | ||||||
| @@ -21,7 +27,7 @@ register_stair_slab_panel_micro("technic", "marble_bricks", "technic:marble_bric | |||||||
| register_stair_slab_panel_micro("technic", "granite", "technic:granite", | register_stair_slab_panel_micro("technic", "granite", "technic:granite", | ||||||
| 	{cracky=3, not_in_creative_inventory=1}, | 	{cracky=3, not_in_creative_inventory=1}, | ||||||
| 	{"technic_granite.png"}, | 	{"technic_granite.png"}, | ||||||
| 	"Granite", | 	S("Granite"), | ||||||
| 	"granite", | 	"granite", | ||||||
| 	"facedir", | 	"facedir", | ||||||
| 	0) | 	0) | ||||||
| @@ -29,7 +35,7 @@ register_stair_slab_panel_micro("technic", "granite", "technic:granite", | |||||||
| register_stair_slab_panel_micro("technic", "concrete", "technic:concrete", | register_stair_slab_panel_micro("technic", "concrete", "technic:concrete", | ||||||
| 	{cracky=3, not_in_creative_inventory=1}, | 	{cracky=3, not_in_creative_inventory=1}, | ||||||
| 	{"technic_concrete_block.png"}, | 	{"technic_concrete_block.png"}, | ||||||
| 	"Concrete", | 	S("Concrete"), | ||||||
| 	"concrete", | 	"concrete", | ||||||
| 	"facedir", | 	"facedir", | ||||||
| 	0) | 	0) | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								extranodes/locale/de.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,9 @@ | |||||||
|  | # German Translation for technic_extranodes | ||||||
|  | # Deutsche Übersetzung von technic_extranodes | ||||||
|  | # by Xanthin | ||||||
|  |  | ||||||
|  | Marble = Marmor | ||||||
|  | Marble Bricks = Marmorziegel | ||||||
|  | Granite = Granit | ||||||
|  | Concrete = Beton | ||||||
|  |  | ||||||
							
								
								
									
										7
									
								
								extranodes/locale/template.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,7 @@ | |||||||
|  | # technic_extranodes translation template | ||||||
|  |  | ||||||
|  | Marble = | ||||||
|  | Marble Bricks = | ||||||
|  | Granite = | ||||||
|  | Concrete = | ||||||
|  |  | ||||||
							
								
								
									
										68
									
								
								notes_on_iron
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,68 @@ | |||||||
|  | Notes on iron and steel | ||||||
|  | ======================= | ||||||
|  |  | ||||||
|  | Alloying iron with carbon is of huge importance, but in some processes | ||||||
|  | the alloying is an implicit side effect rather than the product of | ||||||
|  | explicit mixing, so it is a complex area.  In the real world, there is | ||||||
|  | a huge variety of kinds of iron and steel, differing in the proportion | ||||||
|  | of carbon included and in other elements added to the mix. | ||||||
|  |  | ||||||
|  | The Minetest default mod doesn't distinguish between types of iron and | ||||||
|  | steel at all.  This mod introduces multiple types in order to get a bit | ||||||
|  | of complexity and flavour. | ||||||
|  |  | ||||||
|  | Leaving aside explicit addition of other elements, the iron/carbon | ||||||
|  | spectrum is here represented by three substances: wrought iron, | ||||||
|  | carbon steel, and cast iron.  Wrought iron has low carbon content | ||||||
|  | (less than 0.25%), resists shattering, and is easily welded, but is | ||||||
|  | relatively soft and susceptible to rusting.  It was used for rails, | ||||||
|  | gates, chains, wire, pipes, fasteners, and other purposes.  Cast iron | ||||||
|  | has high carbon content (2.1% to 4%), is especially hard, and resists | ||||||
|  | corrosion, but is relatively brittle, and difficult to work.  It was used | ||||||
|  | to build large structures such as bridges, and for cannons, cookware, | ||||||
|  | and engine cylinders.  Carbon steel has medium carbon content (0.25% | ||||||
|  | to 2.1%), and intermediate properties: moderately hard and also tough, | ||||||
|  | somewhat resistant to corrosion.  It is now used for most of the purposes | ||||||
|  | previously satisfied by wrought iron and many of those of cast iron, | ||||||
|  | but has historically been especially important for its use in swords, | ||||||
|  | armour, skyscrapers, large bridges, and machines. | ||||||
|  |  | ||||||
|  | Historically, the first form of iron to be refined was wrought iron, | ||||||
|  | produced from ore by a low-temperature furnace process in which the | ||||||
|  | ore/iron remains solid and impurities (slag) are progressively removed. | ||||||
|  | Cast iron, by contrast, was produced somewhat later by a high-temperature | ||||||
|  | process in a blast furnace, in which the metal is melted, and carbon is | ||||||
|  | unavoidably incorporated from the furnace's fuel.  (In fact, it's done | ||||||
|  | in two stages, first producing pig iron from ore, and then remelting the | ||||||
|  | pig iron to cast as cast iron.)  Carbon steel requires a more advanced | ||||||
|  | process, in which molten pig iron is processed to remove the carbon, | ||||||
|  | and then a controlled amount of carbon is explicitly mixed back in. | ||||||
|  | Other processes are possible to refine iron ore and to adjust its | ||||||
|  | carbon content. | ||||||
|  |  | ||||||
|  | Unfortunately, Minetest doesn't let us readily distinguish between | ||||||
|  | low-temperature and high-temperature processes: in the default game, the | ||||||
|  | same furnace is used both to cook food (low temperature) and to cast metal | ||||||
|  | ingots (varying high temperatures).  So we can't sensibly have wrought | ||||||
|  | iron and cast iron produced by different types of furnace.  Nor can | ||||||
|  | furnace recipes discriminate by which kind of fuel is used (and thus | ||||||
|  | by the availability of carbon).  The alloy furnace allows for explicit | ||||||
|  | alloying, which appropriately represents how carbon steel is made, but | ||||||
|  | is not sensible for the other two, and is a relatively advanced process. | ||||||
|  | About the only option to make a second iron-processing furnace process | ||||||
|  | readily available is to cook multiple times; happily, this bears a slight | ||||||
|  | resemblance to the real process with pig iron as an intermediate product. | ||||||
|  |  | ||||||
|  | The default mod's refined iron, which it calls "steel", is identified | ||||||
|  | with this mod's wrought iron.  Cooking an iron lump (representing ore) | ||||||
|  | initially produces wrought iron; the cooking process here represents a | ||||||
|  | low-temperature bloomery process.  Cooking wrought iron then produces | ||||||
|  | cast iron; this time the cooking process represents a blast furnace. | ||||||
|  | Alloy cooking wrought iron with coal dust (carbon) produces carbon steel; | ||||||
|  | this represents the explicit mixing stage of carbon steel production. | ||||||
|  | Additionally, alloy cooking carbon steel with coal dust produces cast | ||||||
|  | iron, which is logical but not very useful.  Furthermore, to make it | ||||||
|  | possible to turn any of the forms of iron into any other, cooking carbon | ||||||
|  | steel or cast iron produces wrought iron, in an abbreviated form of the | ||||||
|  | bloomery process.  As usual for metals, the same cooking and alloying | ||||||
|  | processes can be performed in parallel forms on ingots or dust. | ||||||
							
								
								
									
										15
									
								
								technic/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,15 @@ | |||||||
|  | Technic | ||||||
|  | ======= | ||||||
|  |  | ||||||
|  | License | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Copyright (C) 2012-2014 Maciej Kasatkin (RealBadAngel) | ||||||
|  |  | ||||||
|  | Technic chests code is licensed under the GNU LGPLv2+. | ||||||
|  |  | ||||||
|  | Texture licenses: | ||||||
|  |  | ||||||
|  | RealBadAngel: (WTFPL) | ||||||
|  |   * Everything. | ||||||
|  |  | ||||||
| @@ -21,6 +21,3 @@ for k, v in pairs(defaults) do | |||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Create the config file if it doesn't exist |  | ||||||
| technic.config:write() |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,53 +1,17 @@ | |||||||
| -- tubes crafting recipes | -- tubes crafting recipes | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'pipeworks:tube_000000 9', |     output = 'pipeworks:accelerator_tube_1', | ||||||
|     recipe = { |     recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, |         {'technic:copper_coil', 'pipeworks:tube_1', 'technic:copper_coil'}, | ||||||
| 		{'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, |  | ||||||
| 		{'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, |  | ||||||
| 	} |  | ||||||
| }) |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	output = 'pipeworks:mese_tube_000000', |  | ||||||
| 	recipe = { |  | ||||||
| 		{'default:mese_crystal_fragment', 'pipeworks:tube_000000', 'default:mese_crystal_fragment'}, |  | ||||||
|         } |         } | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
|     output = 'pipeworks:accelerator_tube_000000', |     output = 'pipeworks:teleport_tube_1', | ||||||
|     recipe = { |  | ||||||
|         {'technic:copper_coil', 'pipeworks:tube_000000', 'technic:copper_coil'}, |  | ||||||
|         } |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ |  | ||||||
|     output = 'pipeworks:detector_tube_off_000000', |  | ||||||
|     recipe = { |  | ||||||
|         {'mesecons:mesecon', 'pipeworks:tube_000000', 'mesecons:mesecon'}, |  | ||||||
|         } |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ |  | ||||||
|     output = 'pipeworks:sand_tube_000000', |  | ||||||
|     recipe = { |  | ||||||
|         {'default:sand', 'pipeworks:tube_000000', 'default:sand'}, |  | ||||||
|         } |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ |  | ||||||
|     output = 'pipeworks:mese_sand_tube_000000', |  | ||||||
|     recipe = { |  | ||||||
|         {'default:mese_crystal_fragment', 'pipeworks:sand_tube_000000', 'default:mese_crystal_fragment'}, |  | ||||||
|         } |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ |  | ||||||
|     output = 'pipeworks:teleport_tube_000000', |  | ||||||
|     recipe = { |     recipe = { | ||||||
|         {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, |         {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, | ||||||
|         {'pipeworks:tube_000000', 'technic:control_logic_unit', 'pipeworks:tube_000000'}, |         {'pipeworks:tube_1', 'technic:control_logic_unit', 'pipeworks:tube_1'}, | ||||||
|         {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, |         {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, | ||||||
|         } |         } | ||||||
| }) | }) | ||||||
| @@ -97,39 +61,57 @@ minetest.register_craft({ | |||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'technic:fine_gold_wire 2', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'', 'default:gold_ingot', ''}, | ||||||
|  | 		{'', 'default:gold_ingot', ''}, | ||||||
|  | 		{'', 'default:gold_ingot', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'technic:fine_silver_wire 2', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'', 'moreores:silver_ingot', ''}, | ||||||
|  | 		{'', 'moreores:silver_ingot', ''}, | ||||||
|  | 		{'', 'moreores:silver_ingot', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:copper_coil 1', | 	output = 'technic:copper_coil 1', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'}, | 		{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'}, | ||||||
| 		{'default:steel_ingot', '', 'default:steel_ingot'}, | 		{'technic:wrought_iron_ingot', '', 'technic:wrought_iron_ingot'}, | ||||||
| 		{'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'}, | 		{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:motor', | 	output = 'technic:motor', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'}, | ||||||
| 		{'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'}, | ||||||
| 		{'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'default:copper_ingot', 'technic:carbon_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:lv_transformer', | 	output = 'technic:lv_transformer', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:iron_lump',   'default:iron_lump', 'default:iron_lump'}, | 		{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'}, | ||||||
| 		{'technic:copper_coil', 'default:iron_lump', 'technic:copper_coil'}, | 		{'technic:copper_coil',        'technic:wrought_iron_ingot', 'technic:copper_coil'}, | ||||||
| 		{'default:iron_lump',   'default:iron_lump', 'default:iron_lump'}, | 		{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:mv_transformer', | 	output = 'technic:mv_transformer', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'}, | ||||||
| 		{'technic:copper_coil', 'default:steel_ingot', 'technic:copper_coil'}, | 		{'technic:copper_coil',        'technic:carbon_steel_ingot', 'technic:copper_coil'}, | ||||||
| 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -167,17 +149,21 @@ minetest.register_craft({ | |||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = "technic:machine_casing", | ||||||
|  | 	recipe = { | ||||||
|  | 		{ "technic:cast_iron_ingot", "technic:cast_iron_ingot", "technic:cast_iron_ingot" }, | ||||||
|  | 		{ "technic:cast_iron_ingot", "technic:brass_ingot", "technic:cast_iron_ingot" }, | ||||||
|  | 		{ "technic:cast_iron_ingot", "technic:cast_iron_ingot", "technic:cast_iron_ingot" }, | ||||||
|  | 	}, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- Remove some recipes | ||||||
| minetest.register_craftitem("technic:nothing", { | minetest.register_craftitem("technic:nothing", { | ||||||
| 	description = "", | 	description = "", | ||||||
| 	inventory_image = "blank.png", | 	inventory_image = "blank.png", | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	type = "shapeless", |  | ||||||
| 	output = "technic:nothing", |  | ||||||
| 	recipe = {"default:copper_ingot", "default:steel_ingot"} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| if minetest.register_craft_predict then | if minetest.register_craft_predict then | ||||||
| 	minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv) | 	minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv) | ||||||
| 		if itemstack:get_name() == "technic:nothing" then | 		if itemstack:get_name() == "technic:nothing" then | ||||||
| @@ -186,3 +172,30 @@ if minetest.register_craft_predict then | |||||||
| 	end) | 	end) | ||||||
| end | end | ||||||
|  |  | ||||||
|  | -- Bronze | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "shapeless", | ||||||
|  | 	output = "technic:nothing", | ||||||
|  | 	recipe = {"default:copper_ingot", "default:steel_ingot"} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- Accelerator tube | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = "technic:nothing", | ||||||
|  | 	recipe = { | ||||||
|  | 	        { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, | ||||||
|  | 	        { "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" }, | ||||||
|  | 	        { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } | ||||||
|  | 	}, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- Teleport tube | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = "technic:nothing", | ||||||
|  | 	recipe = { | ||||||
|  | 	        { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, | ||||||
|  | 	        { "default:desert_stone", "default:mese_block", "default:desert_stone" }, | ||||||
|  | 	        { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } | ||||||
|  | 	}, | ||||||
|  | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,3 +4,4 @@ pipeworks | |||||||
| mesecons | mesecons | ||||||
| mesecons_mvps? | mesecons_mvps? | ||||||
| intllib? | intllib? | ||||||
|  | unified_inventory? | ||||||
|   | |||||||
| @@ -1,10 +1,45 @@ | |||||||
| function get_item_meta (string) | minetest.swap_node = minetest.swap_node or function(pos, node) | ||||||
| 	if string.find(string, "return {") then | 	local oldmeta = minetest.get_meta(pos):to_table() | ||||||
| 		return minetest.deserialize(string) | 	minetest.set_node(pos, node) | ||||||
| 	else return nil | 	minetest.get_meta(pos):from_table(oldmeta) | ||||||
| 	end |  | ||||||
| end | end | ||||||
|  |  | ||||||
| function set_item_meta (table) | -- Only changes name, keeps other params | ||||||
| 	return minetest.serialize(table) | function technic.swap_node(pos, name) | ||||||
|  | 	local node = minetest.get_node(pos) | ||||||
|  | 	if node.name ~= name then | ||||||
|  | 		node.name = name | ||||||
|  | 		minetest.swap_node(pos, node) | ||||||
| 	end | 	end | ||||||
|  | 	return node.name | ||||||
|  | end | ||||||
|  |  | ||||||
|  | -- Fully charge RE chargeable item. | ||||||
|  | -- Must be defined early to reference in item definitions. | ||||||
|  | function technic.refill_RE_charge(stack) | ||||||
|  | 	local max_charge = technic.power_tools[stack:get_name()] | ||||||
|  | 	if not max_charge then return stack end | ||||||
|  | 	technic.set_RE_wear(stack, max_charge, max_charge) | ||||||
|  | 	local meta = minetest.deserialize(stack:get_metadata()) or {} | ||||||
|  | 	meta.charge = max_charge | ||||||
|  | 	stack:set_metadata(minetest.serialize(meta)) | ||||||
|  | 	return stack | ||||||
|  | end | ||||||
|  |  | ||||||
|  |  -------------------------------------------------------------------------------- | ||||||
|  | local function resolve_name(function_name) | ||||||
|  | 	local a = _G | ||||||
|  | 	for key in string.gmatch(function_name, "([^%.]+)(%.?)") do | ||||||
|  | 		if a[key] then | ||||||
|  | 			a = a[key] | ||||||
|  | 		else | ||||||
|  | 			return nil | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	return a | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function technic.function_exists(function_name) | ||||||
|  | 	return type(resolve_name(function_name)) == 'function' | ||||||
|  | end | ||||||
|  | -------------------------------------------------------------------------------- | ||||||
|   | |||||||
| @@ -40,27 +40,6 @@ dofile(modpath.."/tools/init.lua") | |||||||
| -- Aliases for legacy node/item names | -- Aliases for legacy node/item names | ||||||
| dofile(modpath.."/legacy.lua") | dofile(modpath.."/legacy.lua") | ||||||
|  |  | ||||||
| function has_locked_chest_privilege(meta, player) |  | ||||||
| 	if player:get_player_name() ~= meta:get_string("owner") then |  | ||||||
| 		return false |  | ||||||
| 	end |  | ||||||
| 	return true |  | ||||||
| end |  | ||||||
|  |  | ||||||
| -- Swap nodes out. Return the node name. |  | ||||||
| function hacky_swap_node(pos, name) |  | ||||||
| 	local node = minetest.get_node(pos) |  | ||||||
| 	if node.name ~= name then |  | ||||||
| 		local meta = minetest.get_meta(pos) |  | ||||||
| 		local meta_table = meta:to_table() |  | ||||||
| 		node.name = name |  | ||||||
| 		minetest.set_node(pos, node) |  | ||||||
| 		meta = minetest.get_meta(pos) |  | ||||||
| 		meta:from_table(meta_table) |  | ||||||
| 	end |  | ||||||
| 	return node.name |  | ||||||
| end |  | ||||||
|  |  | ||||||
| if minetest.setting_get("log_mod") then | if minetest.setting_get("log_mod") then | ||||||
| 	print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start)) | 	print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start)) | ||||||
| end | end | ||||||
|   | |||||||
| @@ -32,6 +32,8 @@ minetest.register_tool("technic:blue_energy_crystal", { | |||||||
| 		"technic_diamond_block_blue.png", | 		"technic_diamond_block_blue.png", | ||||||
| 		"technic_diamond_block_blue.png", | 		"technic_diamond_block_blue.png", | ||||||
| 		"technic_diamond_block_blue.png"), | 		"technic_diamond_block_blue.png"), | ||||||
|  | 	wear_represents = "technic_RE_charge", | ||||||
|  | 	on_refill = technic.refill_RE_charge, | ||||||
| 	tool_capabilities = { | 	tool_capabilities = { | ||||||
| 		max_drop_level = 0, | 		max_drop_level = 0, | ||||||
| 		groupcaps = { | 		groupcaps = { | ||||||
| @@ -46,6 +48,8 @@ minetest.register_tool("technic:green_energy_crystal", { | |||||||
| 		"technic_diamond_block_green.png", | 		"technic_diamond_block_green.png", | ||||||
| 		"technic_diamond_block_green.png", | 		"technic_diamond_block_green.png", | ||||||
| 		"technic_diamond_block_green.png"), | 		"technic_diamond_block_green.png"), | ||||||
|  | 	wear_represents = "technic_RE_charge", | ||||||
|  | 	on_refill = technic.refill_RE_charge, | ||||||
| 	tool_capabilities = { | 	tool_capabilities = { | ||||||
| 		max_drop_level = 0, | 		max_drop_level = 0, | ||||||
| 		groupcaps = { | 		groupcaps = { | ||||||
| @@ -60,6 +64,8 @@ minetest.register_tool("technic:red_energy_crystal", { | |||||||
| 		"technic_diamond_block_red.png", | 		"technic_diamond_block_red.png", | ||||||
| 		"technic_diamond_block_red.png", | 		"technic_diamond_block_red.png", | ||||||
| 		"technic_diamond_block_red.png"), | 		"technic_diamond_block_red.png"), | ||||||
|  | 	wear_represents = "technic_RE_charge", | ||||||
|  | 	on_refill = technic.refill_RE_charge, | ||||||
| 	tool_capabilities = { | 	tool_capabilities = { | ||||||
| 		max_drop_level = 0, | 		max_drop_level = 0, | ||||||
| 		groupcaps = { | 		groupcaps = { | ||||||
| @@ -74,6 +80,16 @@ minetest.register_craftitem("technic:fine_copper_wire", { | |||||||
| 	inventory_image = "technic_fine_copper_wire.png", | 	inventory_image = "technic_fine_copper_wire.png", | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("technic:fine_gold_wire", { | ||||||
|  | 	description = S("Fine Gold Wire"), | ||||||
|  | 	inventory_image = "technic_fine_gold_wire.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("technic:fine_silver_wire", { | ||||||
|  | 	description = S("Fine Silver Wire"), | ||||||
|  | 	inventory_image = "technic_fine_silver_wire.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
| minetest.register_craftitem("technic:copper_coil", { | minetest.register_craftitem("technic:copper_coil", { | ||||||
| 	description = S("Copper Coil"), | 	description = S("Copper Coil"), | ||||||
| 	inventory_image = "technic_copper_coil.png", | 	inventory_image = "technic_copper_coil.png", | ||||||
| @@ -138,3 +154,12 @@ minetest.register_craftitem("technic:carbon_cloth", { | |||||||
| 	inventory_image = "technic_carbon_cloth.png", | 	inventory_image = "technic_carbon_cloth.png", | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:machine_casing", { | ||||||
|  | 	description = S("Machine Casing"), | ||||||
|  | 	groups = {cracky=2}, | ||||||
|  | 	sunlight_propagates = true, | ||||||
|  | 	paramtype = "light", | ||||||
|  | 	drawtype = "allfaces", | ||||||
|  | 	tiles = {"technic_machine_casing.png"}, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | }) | ||||||
|   | |||||||
| @@ -17,6 +17,10 @@ technic.legacy_nodenames = { | |||||||
| 	["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active", | 	["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active", | ||||||
| 	["technic:grinder"]        = "technic:lv_grinder", | 	["technic:grinder"]        = "technic:lv_grinder", | ||||||
| 	["technic:grinder_active"] = "technic:lv_grinder_active", | 	["technic:grinder_active"] = "technic:lv_grinder_active", | ||||||
|  | 	["technic:extractor"]        = "technic:lv_extractor", | ||||||
|  | 	["technic:extractor_active"] = "technic:lv_extractor_active", | ||||||
|  | 	["technic:compressor"]        = "technic:lv_compressor", | ||||||
|  | 	["technic:compressor_active"] = "technic:lv_compressor_active", | ||||||
| 	["technic:hv_battery_box"] = "technic:hv_battery_box0", | 	["technic:hv_battery_box"] = "technic:hv_battery_box0", | ||||||
| 	["technic:hv_cable"] = "technic:hv_cable0", | 	["technic:hv_cable"] = "technic:hv_cable0", | ||||||
| 	["technic:lv_cable"] = "technic:lv_cable0", | 	["technic:lv_cable"] = "technic:lv_cable0", | ||||||
| @@ -24,6 +28,7 @@ technic.legacy_nodenames = { | |||||||
| 	["technic:mv_battery_box"] = "technic:mv_battery_box0", | 	["technic:mv_battery_box"] = "technic:mv_battery_box0", | ||||||
| 	["technic:generator"]        = "technic:lv_generator", | 	["technic:generator"]        = "technic:lv_generator", | ||||||
| 	["technic:generator_active"] = "technic:lv_generator_active", | 	["technic:generator_active"] = "technic:lv_generator_active", | ||||||
|  | 	["technic:iron_dust"] = "technic:wrought_iron_dust", | ||||||
| } | } | ||||||
|  |  | ||||||
| for old, new in pairs(technic.legacy_nodenames) do | for old, new in pairs(technic.legacy_nodenames) do | ||||||
|   | |||||||
							
								
								
									
										188
									
								
								technic/locale/de.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,188 @@ | |||||||
|  | # German Translation for Technic Mod | ||||||
|  | # Deutsche Uebersetzung des Technic Mods | ||||||
|  | # by Xanthin | ||||||
|  |  | ||||||
|  | ## Misc | ||||||
|  | [Technic] Loaded in %f seconds = [Technic] ist in %f Sekunden geladen | ||||||
|  |  | ||||||
|  | ## Items | ||||||
|  | Silicon Wafer = Siliziumscheibe | ||||||
|  | Doped Silicon Wafer = Dotierte Siliziumscheibe | ||||||
|  | Enriched Uranium = Angereichertes Uran | ||||||
|  | Uranium Fuel = Uranbrennstoff | ||||||
|  | Diamond Drill Head = Diamantbohrkopf | ||||||
|  | Blue Energy Crystal = Blauer Energiekristall | ||||||
|  | Green Energy Crystal = Gruener Energiekristall | ||||||
|  | Red Energy Crystal = Roter Energiekristall | ||||||
|  | Fine Copper Wire = Feinkupferdraht | ||||||
|  | Copper Coil = Kupferspule | ||||||
|  | Electric Motor = Elektromotor | ||||||
|  | Low Voltage Transformer = Niederspannungstransformator | ||||||
|  | Medium Voltage Transformer = Mittelspannungstransformator | ||||||
|  | High Voltage Transformer = Hochspannungstransformator | ||||||
|  | Control Logic Unit = Steuer- und Regelungseinheit | ||||||
|  | Mixed Metal Ingot = Mischmetallbarren | ||||||
|  | Composite Plate = Verbundplatte | ||||||
|  | Copper Plate = Kupferplatte | ||||||
|  | Carbon Plate = Kohlefaserplatte | ||||||
|  | Graphite = Graphit  | ||||||
|  | Carbon Cloth = Kohlefasergewebe | ||||||
|  | Raw Latex = Rohlatex | ||||||
|  | Rubber Fiber = Gummifaser | ||||||
|  |  | ||||||
|  | ## Machine misc | ||||||
|  | Machine cannot be removed because it is not empty = Die Maschine kann nicht entfernt werden, weil sie noch nicht leer ist. | ||||||
|  | Inventory move disallowed due to protection = Das Inventar ist geschuetzt, Zugriff verweigert. | ||||||
|  | # $1: Machine name (Includes tier) | ||||||
|  | %s Active = %s ist eingeschaltet | ||||||
|  | %s Disabled = %s ist ausgeschaltet | ||||||
|  | %s Enabled = | ||||||
|  | %s Idle = %s ist bereit | ||||||
|  | %s Improperly Placed = %s ist falsch plaziert | ||||||
|  | %s Unpowered = %s hat keine Stromversorgung  | ||||||
|  | %s Out Of Fuel = %s hat keinen Brennstoff | ||||||
|  | %s Has Bad Cabling = %s ist falsch verkabelt | ||||||
|  | %s Has No Network = %s hat kein Netzwerk | ||||||
|  | %s Finished = %s ist fertig | ||||||
|  | Enable/Disable = Einschalten/Ausschalten | ||||||
|  | Range = Reichweite | ||||||
|  | Upgrade Slots = Verbesserungsfaecher | ||||||
|  | In: = Rein: | ||||||
|  | Out: = Raus: | ||||||
|  | Slot %d = Fach %d | ||||||
|  | Mode: %s = Methode: %s | ||||||
|  | single items = Einzelstuecke | ||||||
|  | whole stacks = Ganzer Stapel | ||||||
|  |  | ||||||
|  | ## Machine names | ||||||
|  | # $1: Tier | ||||||
|  | %s Alloy Furnace = %s Legierungsofen | ||||||
|  | %s Battery Box = %s Batteriebox | ||||||
|  | %s Cable = %s Kabel | ||||||
|  | %s CNC Machine = %s CNC-Maschine | ||||||
|  | %s Compressor = %s Kompressor | ||||||
|  | %s Extractor = %s Extraktor | ||||||
|  | %s Forcefield Emitter = %s Kraftfeld-Emitter  | ||||||
|  | %s Furnace = %s Ofen | ||||||
|  | %s Grinder = %s Schleifmaschine | ||||||
|  | %s Music Player = %s Musikspieler | ||||||
|  | %s Quarry = %s Steinbruch | ||||||
|  | %s Tool Workshop = %s Werkzeugwerkstatt | ||||||
|  | Arrayed Solar %s Generator = %s Solaranlage | ||||||
|  | Fuel-Fired %s Generator = %s Kohle-Generator | ||||||
|  | Geothermal %s Generator = %s Geothermie-Generator | ||||||
|  | Hydro %s Generator = %s Wassermuehle | ||||||
|  | Nuclear %s Generator Core = %s Reaktorkern | ||||||
|  | Small Solar %s Generator = %s Solarmodul | ||||||
|  | Wind %s Generator = %s Windmuehle | ||||||
|  | Injector = Injektor | ||||||
|  | Constructor Mk%d = Konstruktor Modell %d | ||||||
|  | Frame = Rahmen | ||||||
|  | Frame Motor = Rahmenmotor | ||||||
|  | Template = Schablone | ||||||
|  | Template (replacing) = Schablone (ersetzend) | ||||||
|  | Template motor = Schablonenmotor | ||||||
|  | Template tool = Schablonenwerkzeug | ||||||
|  | Battery Box = Batteriebox | ||||||
|  | Supply Converter = Stromumwandler | ||||||
|  | Switching Station = Schaltanlage | ||||||
|  | Fuel-Fired Alloy Furnace = Kohle-Legierungsofen | ||||||
|  | Fuel-Fired Furnace = Kohle-Ofen | ||||||
|  | Wind Mill Frame = Windmuehlengeruest | ||||||
|  | Forcefield = Kraftfeld | ||||||
|  | Nuclear Reactor Rod Compartment = Brennstabfaecher | ||||||
|  |  | ||||||
|  | ## Machine-specific | ||||||
|  | # $1: Pruduced EU | ||||||
|  | Charge = Aufladen | ||||||
|  | Discharge = Entladen | ||||||
|  | Power level = Energiestufe | ||||||
|  | # $1: Tier $2: current_charge $3: max_charge  | ||||||
|  | %s Battery Box: %d/%d = %s Batteriebox: %d/%d | ||||||
|  | # $1: Machine name $2: Supply $3: Demand | ||||||
|  | %s. Supply: %d Demand: %d = %s. Versorgung: %d Bedarf: %d | ||||||
|  | Production at %d%% = Produktion bei %d%% | ||||||
|  | Choose Milling Program: = Waehle ein Fraesprogramm: | ||||||
|  | Slim Elements half / normal height: = Schmale Elemente von halber / normaler Hoehe: | ||||||
|  | Current track %s = Aktueller Titel %s | ||||||
|  |  | ||||||
|  | ## CNC | ||||||
|  | Cylinder = Zylinder | ||||||
|  | Element Cross = Halbes Kreuzelement | ||||||
|  | Element Cross Double = Kreuzelement | ||||||
|  | Element Edge = Halbes Eckelement | ||||||
|  | Element Edge Double = Eckelement | ||||||
|  | Element End = Halbes Endelement | ||||||
|  | Element End Double = Endelement | ||||||
|  | Element Straight = Halbes aufrechtes Element | ||||||
|  | Element Straight Double = Aufrechtes Element | ||||||
|  | Element T = Halbes T-Element | ||||||
|  | Element T Double = T-Element | ||||||
|  | Horizontal Cylinder = Liegender Zylinder | ||||||
|  | One Curved Edge Block = Block mit einer abgerundeten Kante | ||||||
|  | Pyramid = Pyramide | ||||||
|  | Slope = Schraege | ||||||
|  | Slope Edge = Schraege mit Ecke | ||||||
|  | Slope Inner Edge = Schraege mit Innenecke | ||||||
|  | Slope Lying = Liegende Schraege | ||||||
|  | Slope Upside Down = Umgedrehte Schraege | ||||||
|  | Slope Upside Down Edge = Umgedrehte Schraege mit Ecke | ||||||
|  | Slope Upside Down Inner Edge = Umgedrehte Schraege mit Innenecke | ||||||
|  | Sphere = Kugel | ||||||
|  | Spike = Spitze | ||||||
|  | Stick = Stange | ||||||
|  | Two Curved Edge Block = Block mit zwei abgerundeten Kanten | ||||||
|  | Brick = Ziegel: | ||||||
|  | Cobble = Pflasterstein: | ||||||
|  | Dirt = Erde: | ||||||
|  | Leaves = Laub: | ||||||
|  | Sandstone = Sandstein: | ||||||
|  | Stone = Stein: | ||||||
|  | Tree = Baumstamm: | ||||||
|  | Wooden = Holz: | ||||||
|  |  | ||||||
|  | ## Grinder Recipes | ||||||
|  | # $1: Name | ||||||
|  | %s Dust = %sstaub | ||||||
|  | Akalin = Akalin | ||||||
|  | Alatro = Alatro | ||||||
|  | Arol = Arol | ||||||
|  | Brass = Messing | ||||||
|  | Bronze = Bronze | ||||||
|  | Carbon Steel = Kohlenstoffstahl | ||||||
|  | Cast Iron = Gusseisen | ||||||
|  | Chromium = Chrom | ||||||
|  | Coal = Kohle | ||||||
|  | Copper = Kupfer | ||||||
|  | Gold = Gold | ||||||
|  | Mithril = Mithril | ||||||
|  | Silver = Silber | ||||||
|  | Stainless Steel = Edelstahl | ||||||
|  | Talinite = Talinite | ||||||
|  | Tin = Zinn | ||||||
|  | Wrought Iron = Schmiedeeisen | ||||||
|  | Zinc = Zink | ||||||
|  |  | ||||||
|  | ## Tools | ||||||
|  | RE Battery = Akkubatterie | ||||||
|  | Water Can = Wasserkanister | ||||||
|  | Lava Can = Lavakanister | ||||||
|  | Chainsaw = Kettensaege | ||||||
|  | Flashlight = Taschenlampe | ||||||
|  | 3 nodes deep. = 3 Bloecke tief. | ||||||
|  | 3 nodes tall. = 3 Bloecke hoch. | ||||||
|  | 3 nodes wide. = 3 Bloecke breit. | ||||||
|  | 3x3 nodes. = 3x3 Bloecke. | ||||||
|  | Use while sneaking to change Mining Drill Mk%d modes. = Halte die Shift-Taste beim Benutzen gedrueckt, um die Funktion des Bergbaubohrers Modell %d zu aendern. | ||||||
|  | Mining Drill Mk%d Mode %d = Bergbaubohrer Modell %d Funktion %d | ||||||
|  | Mining Drill Mk%d = Bergbaubohrer Modell %d | ||||||
|  | Mining Laser Mk%d = Bergbaulaser Modell %d | ||||||
|  | Single node. = Einzelblock | ||||||
|  | Sonic Screwdriver = Schallschraubendreher | ||||||
|  | Tree Tap = Baumzapfhahn | ||||||
|  |  | ||||||
|  | ## Craft descriptions | ||||||
|  | Alloy cooking = | ||||||
|  | Grinding = | ||||||
|  | Compressing = | ||||||
|  | Extracting = | ||||||
| @@ -1,4 +1,3 @@ | |||||||
| # es.txt |  | ||||||
| # Spanish Translation for Technic Mod | # Spanish Translation for Technic Mod | ||||||
| # Traduccion al Español del Mod Technic | # Traduccion al Español del Mod Technic | ||||||
| # Autor: Diego Martínez <kaeza> | # Autor: Diego Martínez <kaeza> | ||||||
| @@ -33,8 +32,10 @@ Rubber Fiber = Fibra de Hule | |||||||
|  |  | ||||||
| ## Machine misc | ## Machine misc | ||||||
| Machine cannot be removed because it is not empty = La maquina no puede removerse porque no esta vacia | Machine cannot be removed because it is not empty = La maquina no puede removerse porque no esta vacia | ||||||
|  | Inventory move disallowed due to protection = | ||||||
| # $1: Machine name (Includes tier) | # $1: Machine name (Includes tier) | ||||||
| %s Active = %s Activo | %s Active = %s Activo | ||||||
|  | %s Enabled = | ||||||
| %s Idle = %s Quieto | %s Idle = %s Quieto | ||||||
| %s Unpowered = %s Sin Energia | %s Unpowered = %s Sin Energia | ||||||
| %s Out Of Fuel = %s Sin Combustible | %s Out Of Fuel = %s Sin Combustible | ||||||
| @@ -51,29 +52,38 @@ Enable/Disable = Habilitar/Deshabilitar | |||||||
| %s Alloy Furnace = Horno de Aleacion %s | %s Alloy Furnace = Horno de Aleacion %s | ||||||
| %s Battery Box = Caja de Bateria %s | %s Battery Box = Caja de Bateria %s | ||||||
| %s Cable = Cable %s | %s Cable = Cable %s | ||||||
| %s Electric Furnace = Horno Electrico %s | %s CNC Machine = Maquina CNC %s | ||||||
|  | %s Compressor = Compresor %s | ||||||
|  | %s Extractor = Extractor %s | ||||||
|  | %s Forcefield Emitter = Emisor de Campo de Fuerza %s | ||||||
|  | %s Furnace = Horno %s | ||||||
| %s Grinder = Amoladora %s | %s Grinder = Amoladora %s | ||||||
| %s Generator = Generador %s | %s Music Player = Reproductor de Musica %s | ||||||
| %s Solar Array = Panel Solar %s | %s Quarry = Cantera %s | ||||||
|  | %s Tool Workshop = Taller de Herramientas %s | ||||||
|  | Arrayed Solar %s Generator = Panel Solar %s | ||||||
|  | Fuel-Fired %s Generator = Generador a Carbon %s | ||||||
|  | Geothermal %s Generator = Generador Geotermico %s | ||||||
|  | Hydro %s Generator = Molino de Agua %s | ||||||
|  | Nuclear %s Generator Core = Nucleo de Reactor Nuclear %s | ||||||
|  | Small Solar %s Generator = Panel Solar %s | ||||||
|  | Wind %s Generator = Molino de Viento %s | ||||||
|  | Injector = | ||||||
|  | Constructor Mk%d = | ||||||
|  | Frame = | ||||||
|  | Frame Motor = | ||||||
|  | Template = | ||||||
|  | Template (replacing) = | ||||||
|  | Template Motor = | ||||||
|  | Template Tool = | ||||||
| Supply Converter = Convertidor de Alimentacion | Supply Converter = Convertidor de Alimentacion | ||||||
| Switching Station = Estacion de Conmutacion | Switching Station = Estacion de Conmutacion | ||||||
| Battery Box = Caja de Baterias | Battery Box = Caja de Baterias | ||||||
| Quarry = Cantera | Fuel-Fired Alloy Furnace = Horno de Aleacion a Carbon | ||||||
| CNC Machine = Maquina CNC | Fuel-Fired Furnace = Horno a Carbon | ||||||
| Music Player = Reproductor de Musica |  | ||||||
| Extractor = Extractor |  | ||||||
| Coal Alloy Furnace = Horno de Aleacion a Carbon |  | ||||||
| Tool WorkShop = Taller de Herramientas |  | ||||||
| Forcefield = Campo de Fuerza | Forcefield = Campo de Fuerza | ||||||
| Forcefield Emitter = Emisor de Campo de Fuerza |  | ||||||
| Compressor = Compresor |  | ||||||
| Geothermal Generator = Generador Geotermico |  | ||||||
| Water Mill = Molino de Agua |  | ||||||
| Nuclear Reactor Rod Compartment = Compartimiento para Vara de Reactor Nuclear | Nuclear Reactor Rod Compartment = Compartimiento para Vara de Reactor Nuclear | ||||||
| Nuclear Reactor Core = Nucleo de Reactor Nuclear |  | ||||||
| Wind Mill = Molino de Viento |  | ||||||
| Wind Mill Frame = Armazon de Molino de Viento | Wind Mill Frame = Armazon de Molino de Viento | ||||||
| Solar Panel = Panel Solar |  | ||||||
|  |  | ||||||
| ## Machine-specific | ## Machine-specific | ||||||
| # $1: Pruduced EU | # $1: Pruduced EU | ||||||
| @@ -113,7 +123,6 @@ Slope Edge = Borde de Rampa | |||||||
| Slope = Rampa | Slope = Rampa | ||||||
| Element T = Elemento T | Element T = Elemento T | ||||||
| Cylinder = Cilindro | Cylinder = Cilindro | ||||||
| Steel = Acero |  | ||||||
| Cobble = Adoquines | Cobble = Adoquines | ||||||
| Stone = Piedra | Stone = Piedra | ||||||
| Brick = Ladrillo | Brick = Ladrillo | ||||||
| @@ -130,19 +139,22 @@ Alatro = Alatro | |||||||
| Arol = Arol | Arol = Arol | ||||||
| Brass = Laton | Brass = Laton | ||||||
| Bronze = Bronce | Bronze = Bronce | ||||||
|  | Carbon Steel = Acero al Carbono | ||||||
|  | Cast Iron = Hierro Fundido | ||||||
| Chromium = Cromo | Chromium = Cromo | ||||||
| Coal = Carbon | Coal = Carbon | ||||||
| Copper = Cobre | Copper = Cobre | ||||||
| Gold = Oro | Gold = Oro | ||||||
| Iron = Hierro |  | ||||||
| Mithril = Mitrilo | Mithril = Mitrilo | ||||||
| Silver = Plata | Silver = Plata | ||||||
| Stainless Steel = Acero Inoxidable | Stainless Steel = Acero Inoxidable | ||||||
| Talinite = Talinita | Talinite = Talinita | ||||||
| Tin = Estanio | Tin = Estanio | ||||||
|  | Wrought Iron = Hierro Forjado | ||||||
| Zinc = Zinc | Zinc = Zinc | ||||||
|  |  | ||||||
| ## Tools | ## Tools | ||||||
|  | RE Battery = | ||||||
| Water Can = Bidon de Agua | Water Can = Bidon de Agua | ||||||
| Lava Can = Bidon de Lava | Lava Can = Bidon de Lava | ||||||
| Chainsaw = Motosierra | Chainsaw = Motosierra | ||||||
| @@ -151,7 +163,7 @@ Flashlight = Linterna | |||||||
| 3 nodes tall. = 3 nodos de alto. | 3 nodes tall. = 3 nodos de alto. | ||||||
| 3 nodes wide. = 3 nodos de ancho. | 3 nodes wide. = 3 nodos de ancho. | ||||||
| 3x3 nodes. = 3x3 nodos. | 3x3 nodes. = 3x3 nodos. | ||||||
| Hold shift and use to change Mining Drill Mk%d modes. = Manten pulsado Mayus y Usar para cambiar el modo del Taladro de Mineria Mk%d. | Use while sneaking to change Mining Drill Mk%d modes. = Manten pulsado Mayus y Usar para cambiar el modo del Taladro de Mineria Mk%d. | ||||||
| Mining Drill Mk%d Mode %d = Taladro de Mineria Mk%d Modo %d | Mining Drill Mk%d Mode %d = Taladro de Mineria Mk%d Modo %d | ||||||
| Mining Drill Mk%d = Taladro de Mineria Mk%d | Mining Drill Mk%d = Taladro de Mineria Mk%d | ||||||
| Mining Laser Mk%d = Laser de Mineria Mk%d | Mining Laser Mk%d = Laser de Mineria Mk%d | ||||||
| @@ -159,3 +171,8 @@ Single node. = Nodo simple. | |||||||
| Sonic Screwdriver = Destonillador Sonico | Sonic Screwdriver = Destonillador Sonico | ||||||
| Tree Tap = Grifo de Arbol | Tree Tap = Grifo de Arbol | ||||||
|  |  | ||||||
|  | ## Craft descriptions | ||||||
|  | Alloy cooking = | ||||||
|  | Grinding = | ||||||
|  | Compressing = | ||||||
|  | Extracting = | ||||||
|   | |||||||
| @@ -29,9 +29,11 @@ Rubber Fiber = Fibra di gomma | |||||||
|  |  | ||||||
| ## Machine misc | ## Machine misc | ||||||
| Machine cannot be removed because it is not empty = La macchina non può essere rimossa perchè non è vuota | Machine cannot be removed because it is not empty = La macchina non può essere rimossa perchè non è vuota | ||||||
|  | Inventory move disallowed due to protection = Impossibile muovere l'inventario a causa della protezione | ||||||
| # $1: Machine name (Includes tier) | # $1: Machine name (Includes tier) | ||||||
| %s Active = %s Attivo | %s Active = %s Attivo | ||||||
| %s Disabled = %s Disabilitato | %s Disabled = %s Disabilitato | ||||||
|  | %s Enabled = | ||||||
| %s Idle = %s Inattivo | %s Idle = %s Inattivo | ||||||
| %s Improperly Placed = %s Piazzato impropiamente | %s Improperly Placed = %s Piazzato impropiamente | ||||||
| %s Unpowered = %s Non alimentato | %s Unpowered = %s Non alimentato | ||||||
| @@ -41,36 +43,51 @@ Machine cannot be removed because it is not empty = La macchina non può essere | |||||||
| %s Finished = %s Finito | %s Finished = %s Finito | ||||||
| Enable/Disable = Abilita/Disabilita | Enable/Disable = Abilita/Disabilita | ||||||
| Range = Raggio | Range = Raggio | ||||||
|  | Upgrade Slots = | ||||||
|  | In: = Ingresso: | ||||||
|  | Out: = Uscita: | ||||||
|  | Slot %d = | ||||||
|  | Mode: %s = Modalità: %s | ||||||
|  | single items = Singolo elemento | ||||||
|  | whole stacks = pila completa | ||||||
|  |  | ||||||
| ## Machine names | ## Machine names | ||||||
| # $1: Tier | # $1: Tier | ||||||
| %s Alloy Furnace = %s Fornace per leghe | %s Alloy Furnace = %s Fornace per leghe | ||||||
| %s Battery Box =  %s Box batterie | %s Battery Box =  %s Box batterie | ||||||
| %s Cable = Cavo %s | %s Cable = Cavo %s | ||||||
| %s Electric Furnace = %s Fornace elettrica | %s CNC Machine = Tornio CNC %s | ||||||
|  | %s Compressor = Compressore %s | ||||||
|  | %s Extractor = Estrattore %s | ||||||
|  | %s Forcefield Emitter = Emettitore di campo di forza %s | ||||||
|  | %s Furnace = %s Fornace | ||||||
| %s Grinder = %s Tritatutto | %s Grinder = %s Tritatutto | ||||||
| %s Generator = %s Generatore | %s Music Player = Music Player %s | ||||||
| %s Solar Array = %s Pannello Solare | %s Quarry = Cava %s | ||||||
|  | %s Tool Workshop = Officina per attrezzi %s | ||||||
|  | Arrayed Solar %s Generator = %s Pannello Solare | ||||||
|  | Fuel-Fired %s Generator = %s Generatore a carbone | ||||||
|  | Geothermal %s Generator = %s Generatore Geotermico | ||||||
|  | Hydro %s Generator = Turbina Elettrica %s | ||||||
|  | Nuclear %s Generator Core = Reattore nucleare %s | ||||||
|  | Small Solar %s Generator = %s Pannello solare | ||||||
|  | Wind %s Generator = %s Generatore eolico | ||||||
|  | Injector = Ignettore | ||||||
|  | Constructor Mk%d = Costruttore Mk%d | ||||||
|  | Frame = Cornice | ||||||
|  | Frame Motor = Cornice del motore | ||||||
|  | Template = | ||||||
|  | Template (replacing) = Template (rimpiazzato) | ||||||
|  | Template Motor = | ||||||
|  | Template Tool = | ||||||
| Battery Box = Box batterie | Battery Box = Box batterie | ||||||
| Supply Converter = Trasformatore | Supply Converter = Trasformatore | ||||||
| Switching Station = Stazione di controllo | Switching Station = Stazione di controllo | ||||||
| CNC Machine = Tornio CNC | Fuel-Fired Alloy Furnace = Fornace per leghe a carbone | ||||||
| Coal Alloy Furnace = Fornace per leghe a carbone | Fuel-Fired Furnace = Fornace a carbone | ||||||
| Extractor = Estrattore |  | ||||||
| Compressor = Compressore |  | ||||||
| Solar Panel = Pannello solare |  | ||||||
| Geothermal Generator = Generatore Geotermico |  | ||||||
| Music Player = Music Player |  | ||||||
| Water Mill = Turbina Elettrica |  | ||||||
| Tool WorkShop = Officina per attrezzi |  | ||||||
| Wind Mill = Generatore eolico |  | ||||||
| Wind Mill Frame = Pala eolica | Wind Mill Frame = Pala eolica | ||||||
| Forcefield Emitter = Emettitore di campo di forza |  | ||||||
| Forcefield = Campo di forza | Forcefield = Campo di forza | ||||||
| Nuclear Reactor Core = Reattore nucleare |  | ||||||
| Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare | Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare | ||||||
| Quarry = Cava |  | ||||||
|  |  | ||||||
| ## Machine-specific | ## Machine-specific | ||||||
| # $1: Pruduced EU | # $1: Pruduced EU | ||||||
| @@ -82,39 +99,41 @@ Power level = Livello di potenza | |||||||
| # $1: Machine name $2: Supply $3: Demand | # $1: Machine name $2: Supply $3: Demand | ||||||
| %s. Supply: %d Demand: %d = %s. Prodotto: %d Consumato: %d | %s. Supply: %d Demand: %d = %s. Prodotto: %d Consumato: %d | ||||||
| Production at %d%% = Produzione a %d%% | Production at %d%% = Produzione a %d%% | ||||||
|  | Choose Milling Program: = Scegliere un programma di Fresatura | ||||||
|  | Slim Elements half / normal height: = Metà elementi sottili / altezza normale: | ||||||
|  | Current track %s = Traccia corrente %s | ||||||
|  |  | ||||||
| ## CNC | ## CNC | ||||||
| Cylinder = Cilindro | Cylinder = Cilindro | ||||||
| Element Cross = Elemento a croce | Element Cross = Elemento a croce | ||||||
| Element Cross Double = Elemento a croce doppio | Element Cross Double = Elemento a croce doppio | ||||||
| Element Edge = | Element Edge = Elemento bordo | ||||||
| Element Edge Double = | Element Edge Double = Elemento bordo doppio | ||||||
| Element End = Elemento finale | Element End = Elemento finale | ||||||
| Element End Double = Elemento finale doppio | Element End Double = Elemento finale doppio | ||||||
| Element Straight = | Element Straight = Elemento dritto | ||||||
| Element Straight Double = | Element Straight Double = Elemento dritto doppio | ||||||
| Element T = Elemento a T | Element T = Elemento a T | ||||||
| Element T Double = Elemento a T doppio | Element T Double = Elemento a T doppio | ||||||
| Horizontal Cylinder = Cilindro orizzontale | Horizontal Cylinder = Cilindro orizzontale | ||||||
| One Curved Edge Block = | One Curved Edge Block = Blocco con bordo curvo | ||||||
| Pyramid = Piramide | Pyramid = Piramide | ||||||
| Slope = | Slope = Inclinato | ||||||
| Slope Edge = | Slope Edge = Bordo inclinato | ||||||
| Slope Inner Edge = | Slope Inner Edge = Bordo interno inclinato | ||||||
| Slope Lying = | Slope Lying = Pendenza bugiarda | ||||||
| Slope Upside Down = | Slope Upside Down = Pendenza capovolta | ||||||
| Slope Upside Down Edge = | Slope Upside Down Edge = Bordo inclinato capovolto | ||||||
| Slope Upside Down Inner Edge = | Slope Upside Down Inner Edge = Bordo interno inclinato capovolto | ||||||
| Sphere = Sfera | Sphere = Sfera | ||||||
| Spike = | Spike = Spuntone | ||||||
| Stick = Bastone | Stick = Bastone | ||||||
| Two Curved Edge Block = | Two Curved Edge Block = Blocco con bordo a doppia curva | ||||||
| Brick = Mattone | Brick = Mattone | ||||||
| Cobble = Ciottolato | Cobble = Ciottolato | ||||||
| Dirt = Terra | Dirt = Terra | ||||||
| Leaves = Foglie | Leaves = Foglie | ||||||
| Sandstone = Arenaria | Sandstone = Arenaria | ||||||
| Steel = Acciaio |  | ||||||
| Stone = Pietra | Stone = Pietra | ||||||
| Tree = Albero | Tree = Albero | ||||||
| Wooden = Legno | Wooden = Legno | ||||||
| @@ -127,19 +146,22 @@ Alatro = Alatro | |||||||
| Arol = Arol | Arol = Arol | ||||||
| Brass = Ottone | Brass = Ottone | ||||||
| Bronze = Bronzo | Bronze = Bronzo | ||||||
|  | Carbon Steel = Acciaio al Carbonio | ||||||
|  | Cast Iron = Ghisa | ||||||
| Chromium = Cromo | Chromium = Cromo | ||||||
| Coal = Carbone | Coal = Carbone | ||||||
| Copper = Rame | Copper = Rame | ||||||
| Gold = Oro | Gold = Oro | ||||||
| Iron = Ferro |  | ||||||
| Mithril = Mithril | Mithril = Mithril | ||||||
| Silver = Argento | Silver = Argento | ||||||
| Stainless Steel = Acciaio Inossidabile | Stainless Steel = Acciaio Inossidabile | ||||||
| Talinite = Talinite | Talinite = Talinite | ||||||
| Tin = Stagno | Tin = Stagno | ||||||
|  | Wrought Iron = Ferro Battuto | ||||||
| Zinc = Zinco | Zinc = Zinco | ||||||
|  |  | ||||||
| ## Tools | ## Tools | ||||||
|  | RE Battery = | ||||||
| Water Can = Serbatoio d'acqua | Water Can = Serbatoio d'acqua | ||||||
| Lava Can = Serbatoio di lava | Lava Can = Serbatoio di lava | ||||||
| Chainsaw = Motosega | Chainsaw = Motosega | ||||||
| @@ -148,10 +170,16 @@ Flashlight = Torcia | |||||||
| 3 nodes tall. = 3 nodi in altezza. | 3 nodes tall. = 3 nodi in altezza. | ||||||
| 3 nodes wide. = 3 nodi in larghezza. | 3 nodes wide. = 3 nodi in larghezza. | ||||||
| 3x3 nodes. = 3x3 nodi. | 3x3 nodes. = 3x3 nodi. | ||||||
| Hold shift and use to change Mining Drill Mk%d modes. = Premi shift (freccia grossa) e usa per cambiare modalità nella trivella da miniera Mk%d. | Use while sneaking to change Mining Drill Mk%d modes. = Premi shift (freccia grossa) e usa per cambiare modalità nella trivella da miniera Mk%d. | ||||||
| Mining Drill Mk%d Mode %d = Trivella mk%d in modalità %d | Mining Drill Mk%d Mode %d = Trivella mk%d in modalità %d | ||||||
| Mining Drill Mk%d = Trivella da miniera mk%d | Mining Drill Mk%d = Trivella da miniera mk%d | ||||||
| Mining Laser Mk%d = Laser da miniera mk%d | Mining Laser Mk%d = Laser da miniera mk%d | ||||||
| Single node. = Nodo singolo. | Single node. = Nodo singolo. | ||||||
| Sonic Screwdriver = Cacciavite sonico | Sonic Screwdriver = Cacciavite sonico | ||||||
| Tree Tap = Batti albero | Tree Tap = Batti albero | ||||||
|  |  | ||||||
|  | ## Craft descriptions | ||||||
|  | Alloy cooking = Cottura lege | ||||||
|  | Grinding = Macinazione | ||||||
|  | Compressing = Compressione | ||||||
|  | Extracting = Estrazione | ||||||
|   | |||||||
| @@ -32,11 +32,14 @@ Rubber Fiber = | |||||||
|  |  | ||||||
| ## Machine misc | ## Machine misc | ||||||
| Machine cannot be removed because it is not empty = | Machine cannot be removed because it is not empty = | ||||||
|  | Inventory move disallowed due to protection = | ||||||
| # $1: Machine name (Includes tier) | # $1: Machine name (Includes tier) | ||||||
| %s Active = | %s Active = | ||||||
| %s Disabled = | %s Disabled = | ||||||
|  | %s Enabled = | ||||||
| %s Idle = | %s Idle = | ||||||
| %s Improperly Placed = | %s Improperly Placed = | ||||||
|  | %s is empty = | ||||||
| %s Unpowered = | %s Unpowered = | ||||||
| %s Out Of Fuel = | %s Out Of Fuel = | ||||||
| %s Has Bad Cabling = | %s Has Bad Cabling = | ||||||
| @@ -44,36 +47,51 @@ Machine cannot be removed because it is not empty = | |||||||
| %s Finished = | %s Finished = | ||||||
| Enable/Disable = | Enable/Disable = | ||||||
| Range = | Range = | ||||||
|  | Upgrade Slots = | ||||||
|  | In: = | ||||||
|  | Out: = | ||||||
|  | Slot %d = | ||||||
|  | Mode: %s = | ||||||
|  | single items = | ||||||
|  | whole stacks = | ||||||
|  |  | ||||||
| ## Machine names | ## Machine names | ||||||
| # $1: Tier | # $1: Tier | ||||||
| %s Alloy Furnace = | %s Alloy Furnace = | ||||||
| %s Battery Box =  | %s Battery Box =  | ||||||
| %s Cable = | %s Cable = | ||||||
| %s Electric Furnace = | %s CNC Machine = | ||||||
|  | %s Compressor = | ||||||
|  | %s Extractor = | ||||||
|  | %s Forcefield Emitter = | ||||||
|  | %s Furnace = | ||||||
| %s Grinder = | %s Grinder = | ||||||
| %s Generator = | %s Music Player = | ||||||
| %s Solar Array = | %s Quarry = | ||||||
|  | %s Tool Workshop = | ||||||
|  | Arrayed Solar %s Generator = | ||||||
|  | Fuel-Fired %s Generator = | ||||||
|  | Geothermal %s Generator = | ||||||
|  | Hydro %s Generator = | ||||||
|  | Nuclear %s Generator Core = | ||||||
|  | Small Solar %s Generator = | ||||||
|  | Wind %s Generator = | ||||||
|  | Injector = | ||||||
|  | Constructor Mk%d = | ||||||
|  | Frame = | ||||||
|  | Frame Motor = | ||||||
|  | Template = | ||||||
|  | Template (replacing) = | ||||||
|  | Template Motor = | ||||||
|  | Template Tool = | ||||||
| Battery Box = | Battery Box = | ||||||
| Supply Converter = | Supply Converter = | ||||||
| Switching Station = | Switching Station = | ||||||
| CNC Machine = | Fuel-Fired Alloy Furnace = | ||||||
| Coal Alloy Furnace = | Fuel-Fired Furnace = | ||||||
| Extractor = |  | ||||||
| Compressor = |  | ||||||
| Solar Panel = |  | ||||||
| Geothermal Generator = |  | ||||||
| Music Player = |  | ||||||
| Water Mill = |  | ||||||
| Tool WorkShop = |  | ||||||
| Wind Mill = |  | ||||||
| Wind Mill Frame = | Wind Mill Frame = | ||||||
| Forcefield Emitter = |  | ||||||
| Forcefield = | Forcefield = | ||||||
| Nuclear Reactor Core = |  | ||||||
| Nuclear Reactor Rod Compartment = | Nuclear Reactor Rod Compartment = | ||||||
| Quarry = |  | ||||||
|  |  | ||||||
| ## Machine-specific | ## Machine-specific | ||||||
| # $1: Pruduced EU | # $1: Pruduced EU | ||||||
| @@ -85,6 +103,9 @@ Power level = | |||||||
| # $1: Machine name $2: Supply $3: Demand | # $1: Machine name $2: Supply $3: Demand | ||||||
| %s. Supply: %d Demand: %d = | %s. Supply: %d Demand: %d = | ||||||
| Production at %d%% = | Production at %d%% = | ||||||
|  | Choose Milling Program: = | ||||||
|  | Slim Elements half / normal height: = | ||||||
|  | Current track %s = | ||||||
|  |  | ||||||
| ## CNC | ## CNC | ||||||
| Cylinder = | Cylinder = | ||||||
| @@ -117,7 +138,6 @@ Cobble = | |||||||
| Dirt = | Dirt = | ||||||
| Leaves = | Leaves = | ||||||
| Sandstone = | Sandstone = | ||||||
| Steel = |  | ||||||
| Stone = | Stone = | ||||||
| Tree = | Tree = | ||||||
| Wooden = | Wooden = | ||||||
| @@ -130,19 +150,22 @@ Alatro = | |||||||
| Arol = | Arol = | ||||||
| Brass = | Brass = | ||||||
| Bronze = | Bronze = | ||||||
|  | Carbon Steel = | ||||||
|  | Cast Iron = | ||||||
| Chromium = | Chromium = | ||||||
| Coal = | Coal = | ||||||
| Copper = | Copper = | ||||||
| Gold = | Gold = | ||||||
| Iron = |  | ||||||
| Mithril = | Mithril = | ||||||
| Silver = | Silver = | ||||||
| Stainless Steel = | Stainless Steel = | ||||||
| Talinite = | Talinite = | ||||||
| Tin = | Tin = | ||||||
|  | Wrought Iron = | ||||||
| Zinc = | Zinc = | ||||||
|  |  | ||||||
| ## Tools | ## Tools | ||||||
|  | RE Battery = | ||||||
| Water Can = | Water Can = | ||||||
| Lava Can = | Lava Can = | ||||||
| Chainsaw = | Chainsaw = | ||||||
| @@ -151,7 +174,7 @@ Flashlight = | |||||||
| 3 nodes tall. = | 3 nodes tall. = | ||||||
| 3 nodes wide. = | 3 nodes wide. = | ||||||
| 3x3 nodes. = | 3x3 nodes. = | ||||||
| Hold shift and use to change Mining Drill Mk%d modes. = | Use while sneaking to change Mining Drill Mk%d modes. = | ||||||
| Mining Drill Mk%d Mode %d = | Mining Drill Mk%d Mode %d = | ||||||
| Mining Drill Mk%d = | Mining Drill Mk%d = | ||||||
| Mining Laser Mk%d = | Mining Laser Mk%d = | ||||||
| @@ -159,4 +182,8 @@ Single node. = | |||||||
| Sonic Screwdriver = | Sonic Screwdriver = | ||||||
| Tree Tap = | Tree Tap = | ||||||
|  |  | ||||||
|  | ## Craft descriptions | ||||||
|  | Alloy cooking = | ||||||
|  | Grinding = | ||||||
|  | Compressing = | ||||||
|  | Extracting = | ||||||
|   | |||||||
| @@ -10,10 +10,12 @@ minetest.register_craft({ | |||||||
|  |  | ||||||
| technic.register_battery_box({ | technic.register_battery_box({ | ||||||
| 	tier           = "HV", | 	tier           = "HV", | ||||||
| 	max_charge     = 1500000, | 	max_charge     = 1000000, | ||||||
| 	charge_rate    = 100000, | 	charge_rate    = 100000, | ||||||
| 	discharge_rate = 400000, | 	discharge_rate = 400000, | ||||||
| 	charge_step    = 10000, | 	charge_step    = 10000, | ||||||
| 	discharge_step = 40000, | 	discharge_step = 40000, | ||||||
|  | 	upgrade        = 1, | ||||||
|  | 	tube           = 1, | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,9 +14,9 @@ local S = technic.getter | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:forcefield_emitter_off', | 	output = 'technic:forcefield_emitter_off', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 			{'default:mese',         'technic:deployer_off', 'default:mese'        }, | 			{'default:mese',         'technic:motor',          'default:mese'        }, | ||||||
| 			{'technic:deployer_off', 'technic:motor',        'technic:deployer_off'}, | 			{'technic:deployer_off', 'technic:machine_casing', 'technic:deployer_off'}, | ||||||
| 			{'default:mese',         'technic:deployer_off', 'default:mese'        }, | 			{'default:mese',         'technic:hv_cable0',      'default:mese'        }, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -62,36 +62,35 @@ local function update_forcefield(pos, range, active) | |||||||
| 	vm:update_map() | 	vm:update_map() | ||||||
| end | end | ||||||
|  |  | ||||||
| local get_forcefield_formspec = function(range) | local function set_forcefield_formspec(meta) | ||||||
| 	return "size[3,1.5]".. | 	local formspec = "size[5,1.5]".. | ||||||
| 		"field[1,0.5;2,1;range;"..S("Range")..";"..range.."]".. | 		"field[2,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]" | ||||||
| 		"button[0,1;3,1;toggle;"..S("Enable/Disable").."]" | 	if meta:get_int("enabled") == 0 then | ||||||
|  | 		formspec = formspec.."button[0,1;5,1;enable;"..S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]" | ||||||
|  | 	else | ||||||
|  | 		formspec = formspec.."button[0,1;5,1;disable;"..S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]" | ||||||
|  | 	end | ||||||
|  | 	meta:set_string("formspec", formspec) | ||||||
| end | end | ||||||
|  |  | ||||||
| local forcefield_receive_fields = function(pos, formname, fields, sender) | local forcefield_receive_fields = function(pos, formname, fields, sender) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	if fields.range then | ||||||
| 		local range = tonumber(fields.range) or 0 | 		local range = tonumber(fields.range) or 0 | ||||||
|  |  | ||||||
| 	if fields.toggle then |  | ||||||
| 		if meta:get_int("enabled") == 1 then |  | ||||||
| 		   meta:set_int("enabled", 0) |  | ||||||
| 		else |  | ||||||
| 		   meta:set_int("enabled", 1) |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
|  |  | ||||||
| 		-- Smallest field is 5. Anything less is asking for trouble. | 		-- Smallest field is 5. Anything less is asking for trouble. | ||||||
| 		-- Largest is 20. It is a matter of pratical node handling. | 		-- Largest is 20. It is a matter of pratical node handling. | ||||||
| 		-- At the maximim range updating the forcefield takes about 0.2s | 		-- At the maximim range updating the forcefield takes about 0.2s | ||||||
| 		range = math.max(range, 5) | 		range = math.max(range, 5) | ||||||
| 		range = math.min(range, 20) | 		range = math.min(range, 20) | ||||||
|  |  | ||||||
| 		if meta:get_int("range") ~= range then | 		if meta:get_int("range") ~= range then | ||||||
| 			update_forcefield(pos, meta:get_int("range"), false) | 			update_forcefield(pos, meta:get_int("range"), false) | ||||||
| 			meta:set_int("range", range) | 			meta:set_int("range", range) | ||||||
| 		meta:set_string("formspec", get_forcefield_formspec(range)) |  | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
|  | 	if fields.enable then meta:set_int("enabled", 1) end | ||||||
|  | 	if fields.disable then meta:set_int("enabled", 0) end | ||||||
|  | 	set_forcefield_formspec(meta) | ||||||
|  | end | ||||||
|  |  | ||||||
| local mesecons = { | local mesecons = { | ||||||
| 	effector = { | 	effector = { | ||||||
| @@ -105,7 +104,7 @@ local mesecons = { | |||||||
| } | } | ||||||
|  |  | ||||||
| minetest.register_node("technic:forcefield_emitter_off", { | minetest.register_node("technic:forcefield_emitter_off", { | ||||||
| 	description = S("Forcefield Emitter"), | 	description = S("%s Forcefield Emitter"):format("HV"), | ||||||
| 	tiles = {"technic_forcefield_emitter_off.png"}, | 	tiles = {"technic_forcefield_emitter_off.png"}, | ||||||
| 	groups = {cracky = 1}, | 	groups = {cracky = 1}, | ||||||
| 	on_receive_fields = forcefield_receive_fields, | 	on_receive_fields = forcefield_receive_fields, | ||||||
| @@ -115,14 +114,14 @@ minetest.register_node("technic:forcefield_emitter_off", { | |||||||
| 		meta:set_int("HV_EU_demand", 0) | 		meta:set_int("HV_EU_demand", 0) | ||||||
| 		meta:set_int("range", 10) | 		meta:set_int("range", 10) | ||||||
| 		meta:set_int("enabled", 0) | 		meta:set_int("enabled", 0) | ||||||
| 		meta:set_string("formspec", get_forcefield_formspec(10)) | 		meta:set_string("infotext", S("%s Forcefield Emitter"):format("HV")) | ||||||
| 		meta:set_string("infotext", S("Forcefield Emitter")) | 		set_forcefield_formspec(meta) | ||||||
| 	end, | 	end, | ||||||
| 	mesecons = mesecons | 	mesecons = mesecons | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:forcefield_emitter_on", { | minetest.register_node("technic:forcefield_emitter_on", { | ||||||
| 	description = S("Forcefield Emitter"), | 	description = S("%s Forcefield Emitter"):format("HV"), | ||||||
| 	tiles = {"technic_forcefield_emitter_on.png"}, | 	tiles = {"technic_forcefield_emitter_on.png"}, | ||||||
| 	groups = {cracky = 1, not_in_creative_inventory=1}, | 	groups = {cracky = 1, not_in_creative_inventory=1}, | ||||||
| 	drop = "technic:forcefield_emitter_off", | 	drop = "technic:forcefield_emitter_off", | ||||||
| @@ -140,7 +139,7 @@ minetest.register_node("technic:forcefield_emitter_on", { | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:forcefield", { | minetest.register_node("technic:forcefield", { | ||||||
| 	description = S("Forcefield"), | 	description = S("%s Forcefield"):format("HV"), | ||||||
| 	sunlight_propagates = true, | 	sunlight_propagates = true, | ||||||
| 	drawtype = "glasslike", | 	drawtype = "glasslike", | ||||||
| 	groups = {not_in_creative_inventory=1, unbreakable=1}, | 	groups = {not_in_creative_inventory=1, unbreakable=1}, | ||||||
| @@ -166,7 +165,7 @@ minetest.register_abm({ | |||||||
| 		local eu_input   = meta:get_int("HV_EU_input") | 		local eu_input   = meta:get_int("HV_EU_input") | ||||||
| 		local eu_demand  = meta:get_int("HV_EU_demand") | 		local eu_demand  = meta:get_int("HV_EU_demand") | ||||||
| 		local enabled    = meta:get_int("enabled") | 		local enabled    = meta:get_int("enabled") | ||||||
| 		local machine_name = S("Forcefield Emitter") | 		local machine_name = S("%s Forcefield Emitter"):format("HV") | ||||||
| 		-- Power off automatically if no longer connected to a switching station | 		-- Power off automatically if no longer connected to a switching station | ||||||
| 		technic.switching_station_timeout_count(pos, "HV") | 		technic.switching_station_timeout_count(pos, "HV") | ||||||
|  |  | ||||||
| @@ -178,7 +177,7 @@ minetest.register_abm({ | |||||||
| 			if node.name == "technic:forcefield_emitter_on" then | 			if node.name == "technic:forcefield_emitter_on" then | ||||||
| 				meta:set_int("HV_EU_demand", 0) | 				meta:set_int("HV_EU_demand", 0) | ||||||
| 				update_forcefield(pos, meta:get_int("range"), false) | 				update_forcefield(pos, meta:get_int("range"), false) | ||||||
| 				hacky_swap_node(pos, "technic:forcefield_emitter_off") | 				technic.swap_node(pos, "technic:forcefield_emitter_off") | ||||||
| 				meta:set_string("infotext", S("%s Disabled"):format(machine_name)) | 				meta:set_string("infotext", S("%s Disabled"):format(machine_name)) | ||||||
| 				return | 				return | ||||||
| 			end | 			end | ||||||
| @@ -186,11 +185,11 @@ minetest.register_abm({ | |||||||
| 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) | 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) | ||||||
| 			if node.name == "technic:forcefield_emitter_on" then | 			if node.name == "technic:forcefield_emitter_on" then | ||||||
| 				update_forcefield(pos, meta:get_int("range"), false) | 				update_forcefield(pos, meta:get_int("range"), false) | ||||||
| 				hacky_swap_node(pos, "technic:forcefield_emitter_off") | 				technic.swap_node(pos, "technic:forcefield_emitter_off") | ||||||
| 			end | 			end | ||||||
| 		elseif eu_input >= power_requirement then | 		elseif eu_input >= power_requirement then | ||||||
| 			if node.name == "technic:forcefield_emitter_off" then | 			if node.name == "technic:forcefield_emitter_off" then | ||||||
| 				hacky_swap_node(pos, "technic:forcefield_emitter_on") | 				technic.swap_node(pos, "technic:forcefield_emitter_on") | ||||||
| 				meta:set_string("infotext", S("%s Active"):format(machine_name)) | 				meta:set_string("infotext", S("%s Active"):format(machine_name)) | ||||||
| 			end | 			end | ||||||
| 			update_forcefield(pos, meta:get_int("range"), true) | 			update_forcefield(pos, meta:get_int("range"), true) | ||||||
|   | |||||||
| @@ -1,14 +1,13 @@ | |||||||
|  |  | ||||||
| minetest.register_alias("hv_generator", "technic:hv_generator") | minetest.register_alias("hv_generator", "technic:hv_generator") | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:hv_generator', | 	output = 'technic:hv_generator', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:mv_generator',   'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:mv_generator',   'technic:stainless_steel_ingot'}, | ||||||
| 		{'pipeworks:tube_000000',         'technic:hv_transformer', 'pipeworks:tube_000000'}, | 		{'pipeworks:tube_1',              'technic:hv_transformer', 'pipeworks:tube_1'}, | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:hv_cable',       'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:hv_cable0',      'technic:stainless_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| technic.register_generator({tier="HV", supply=1200}) | technic.register_generator({tier="HV", tube=1, supply=1200}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,11 +3,16 @@ technic.register_tier("HV", "High Voltage") | |||||||
|  |  | ||||||
| local path = technic.modpath.."/machines/HV" | local path = technic.modpath.."/machines/HV" | ||||||
|  |  | ||||||
|  | -- Wiring stuff | ||||||
| dofile(path.."/cables.lua") | dofile(path.."/cables.lua") | ||||||
| dofile(path.."/quarry.lua") |  | ||||||
| dofile(path.."/forcefield.lua") |  | ||||||
| dofile(path.."/battery_box.lua") | dofile(path.."/battery_box.lua") | ||||||
|  |  | ||||||
|  | -- Generators | ||||||
| dofile(path.."/solar_array.lua") | dofile(path.."/solar_array.lua") | ||||||
| dofile(path.."/nuclear_reactor.lua") | dofile(path.."/nuclear_reactor.lua") | ||||||
| dofile(path.."/generator.lua") | dofile(path.."/generator.lua") | ||||||
|  |  | ||||||
|  | -- Machines | ||||||
|  | dofile(path.."/quarry.lua") | ||||||
|  | dofile(path.."/forcefield.lua") | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| -- The enriched uranium rod driven EU generator. | -- The enriched uranium rod driven EU generator. | ||||||
| -- A very large and advanced machine providing vast amounts of power. | -- A very large and advanced machine providing vast amounts of power. | ||||||
| -- Very efficient but also expensive to run as it needs uranium. (10000EU 86400 ticks (24h)) | -- Very efficient but also expensive to run as it needs uranium. (10000EU 86400 ticks (one week)) | ||||||
| -- Provides HV EUs that can be down converted as needed. | -- Provides HV EUs that can be down converted as needed. | ||||||
| -- | -- | ||||||
| -- The nuclear reactor core needs water and a protective shield to work. | -- The nuclear reactor core needs water and a protective shield to work. | ||||||
| @@ -17,8 +17,8 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:hv_nuclear_reactor_core', | 	output = 'technic:hv_nuclear_reactor_core', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, | ||||||
| 		{'technic:stainless_steel_ingot',                              '', 'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot',        'technic:machine_casing', 'technic:stainless_steel_ingot'}, | ||||||
| 		{'technic:stainless_steel_ingot',              'technic:hv_cable', 'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot',             'technic:hv_cable0', 'technic:stainless_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -49,7 +49,7 @@ local nodebox = { | |||||||
| } | } | ||||||
|  |  | ||||||
| minetest.register_node("technic:hv_nuclear_reactor_core", { | minetest.register_node("technic:hv_nuclear_reactor_core", { | ||||||
| 	description = S("Nuclear Reactor Core"), | 	description = S("Nuclear %s Generator Core"):format("HV"), | ||||||
| 	tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", | 	tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", | ||||||
| 	         "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", | 	         "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", | ||||||
| 	         "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"}, | 	         "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"}, | ||||||
| @@ -65,7 +65,7 @@ minetest.register_node("technic:hv_nuclear_reactor_core", { | |||||||
| 	}, | 	}, | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("Nuclear Reactor Core")) | 		meta:set_string("infotext", S("Nuclear %s Generator Core"):format("HV")) | ||||||
| 		meta:set_int("HV_EU_supply", 0) | 		meta:set_int("HV_EU_supply", 0) | ||||||
| 		-- Signal to the switching station that this device burns some | 		-- Signal to the switching station that this device burns some | ||||||
| 		-- sort of fuel and needs special handling | 		-- sort of fuel and needs special handling | ||||||
| @@ -75,17 +75,10 @@ minetest.register_node("technic:hv_nuclear_reactor_core", { | |||||||
| 		local inv = meta:get_inventory() | 		local inv = meta:get_inventory() | ||||||
| 		inv:set_size("src", 6) | 		inv:set_size("src", 6) | ||||||
| 	end,	 | 	end,	 | ||||||
| 	can_dig = function(pos, player) | 	can_dig = technic.machine_can_dig, | ||||||
| 		local meta = minetest.get_meta(pos); | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 		local inv = meta:get_inventory() | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 		if not inv:is_empty("src") then | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 				S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		else |  | ||||||
| 			return true |  | ||||||
| 		end |  | ||||||
| 	end, |  | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:hv_nuclear_reactor_core_active", { | minetest.register_node("technic:hv_nuclear_reactor_core_active", { | ||||||
| @@ -103,17 +96,10 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", { | |||||||
| 		type = "fixed", | 		type = "fixed", | ||||||
| 		fixed = nodebox | 		fixed = nodebox | ||||||
| 	}, | 	}, | ||||||
| 	can_dig = function(pos, player) | 	can_dig = technic.machine_can_dig, | ||||||
| 		local meta = minetest.get_meta(pos); | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 		local inv = meta:get_inventory() | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 		if not inv:is_empty("src") then | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 				S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		else |  | ||||||
| 			return true |  | ||||||
| 		end |  | ||||||
| 	end, |  | ||||||
| }) | }) | ||||||
|  |  | ||||||
| local check_reactor_structure = function(pos) | local check_reactor_structure = function(pos) | ||||||
| @@ -208,7 +194,7 @@ minetest.register_abm({ | |||||||
| 	chance   = 1, | 	chance   = 1, | ||||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		local machine_name = S("Nuclear Reactor Core") | 		local machine_name = S("Nuclear %s Generator Core"):format("HV") | ||||||
| 		local burn_time = meta:get_int("burn_time") or 0 | 		local burn_time = meta:get_int("burn_time") or 0 | ||||||
|  |  | ||||||
| 		if burn_time >= burn_ticks or burn_time == 0 then | 		if burn_time >= burn_ticks or burn_time == 0 then | ||||||
| @@ -228,7 +214,7 @@ minetest.register_abm({ | |||||||
| 				if correct_fuel_count == 6 and | 				if correct_fuel_count == 6 and | ||||||
| 				   check_reactor_structure(pos) then | 				   check_reactor_structure(pos) then | ||||||
| 					meta:set_int("burn_time", 1) | 					meta:set_int("burn_time", 1) | ||||||
| 					hacky_swap_node(pos, "technic:hv_nuclear_reactor_core_active")  | 					technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active")  | ||||||
| 					meta:set_int("HV_EU_supply", power_supply) | 					meta:set_int("HV_EU_supply", power_supply) | ||||||
| 					for idx, srcstack in pairs(srclist) do | 					for idx, srcstack in pairs(srclist) do | ||||||
| 						srcstack:take_item() | 						srcstack:take_item() | ||||||
| @@ -240,7 +226,7 @@ minetest.register_abm({ | |||||||
| 			meta:set_int("HV_EU_supply", 0) | 			meta:set_int("HV_EU_supply", 0) | ||||||
| 			meta:set_int("burn_time", 0) | 			meta:set_int("burn_time", 0) | ||||||
| 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | ||||||
| 			hacky_swap_node(pos, "technic:hv_nuclear_reactor_core") | 			technic.swap_node(pos, "technic:hv_nuclear_reactor_core") | ||||||
| 		elseif burn_time > 0 then | 		elseif burn_time > 0 then | ||||||
| 			damage_nearby_players(pos) | 			damage_nearby_players(pos) | ||||||
| 			if not check_reactor_structure(pos) then | 			if not check_reactor_structure(pos) then | ||||||
|   | |||||||
| @@ -3,42 +3,37 @@ local S = technic.getter | |||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{"default:steelblock", "pipeworks:filter",           "default:steelblock"}, | 		{"technic:carbon_steel_block", "pipeworks:filter",       "technic:carbon_steel_block"}, | ||||||
| 		{"default:steelblock", "technic:motor",              "default:steelblock"}, | 		{"technic:motor",              "technic:machine_casing", "technic:diamond_drill_head"}, | ||||||
| 		{"default:steelblock", "technic:diamond_drill_head", "default:steelblock"}}, | 		{"technic:carbon_steel_block", "technic:hv_cable0",      "technic:carbon_steel_block"}}, | ||||||
| 	output = "technic:quarry", | 	output = "technic:quarry", | ||||||
| }) | }) | ||||||
|  |  | ||||||
| local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes | local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes | ||||||
| local quarry_max_depth       = 100 | local quarry_max_depth       = 100 | ||||||
|  |  | ||||||
| local function get_quarry_formspec(size) | local function set_quarry_formspec(meta) | ||||||
| 	return "size[3,1.5]".. | 	local formspec = "size[3,1.5]".. | ||||||
| 		"field[1,0.5;2,1;size;Radius;"..size.."]".. | 		"field[1,0.5;2,1;size;Radius;"..meta:get_int("size").."]" | ||||||
| 		"button[0,1;3,1;toggle;"..S("Enable/Disable").."]" | 	if meta:get_int("enabled") == 0 then | ||||||
|  | 		formspec = formspec.."button[0,1;3,1;enable;"..S("%s Disabled"):format(S("%s Quarry"):format("HV")).."]" | ||||||
|  | 	else | ||||||
|  | 		formspec = formspec.."button[0,1;3,1;disable;"..S("%s Enabled"):format(S("%s Quarry"):format("HV")).."]" | ||||||
|  | 	end | ||||||
|  | 	meta:set_string("formspec", formspec) | ||||||
| end | end | ||||||
|  |  | ||||||
| local function quarry_receive_fields(pos, formname, fields, sender) | local function quarry_receive_fields(pos, formname, fields, sender) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	local size = tonumber(fields.size) | 	if fields.size then | ||||||
|  | 		local size = tonumber(fields.size) or 0 | ||||||
| 	if fields.toggle then |  | ||||||
| 		if meta:get_int("enabled") == 0 then |  | ||||||
| 			meta:set_int("enabled", 1) |  | ||||||
| 		else |  | ||||||
| 			meta:set_int("enabled", 0) |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
|  |  | ||||||
| 	-- Smallest size is 2. Anything less is asking for trouble. |  | ||||||
| 	-- Largest is 8. It is a matter of pratical node handling. |  | ||||||
| 		size = math.max(size, 2) | 		size = math.max(size, 2) | ||||||
| 		size = math.min(size, 8) | 		size = math.min(size, 8) | ||||||
|  |  | ||||||
| 	if meta:get_int("size") ~= size then |  | ||||||
| 		meta:set_int("size", size) | 		meta:set_int("size", size) | ||||||
| 		meta:set_string("formspec", get_quarry_formspec(size)) |  | ||||||
| 	end | 	end | ||||||
|  | 	if fields.enable then meta:set_int("enabled", 1) end | ||||||
|  | 	if fields.disable then meta:set_int("enabled", 0) end | ||||||
|  | 	set_quarry_formspec(meta) | ||||||
| end | end | ||||||
|  |  | ||||||
| local function get_quarry_center(pos, size) | local function get_quarry_center(pos, size) | ||||||
| @@ -80,7 +75,7 @@ local function quarry_dig(pos, center, size) | |||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	local drops = {} | 	local drops = {} | ||||||
| 	local dig_y = meta:get_int("dig_y") | 	local dig_y = meta:get_int("dig_y") | ||||||
| 	local owner = meta:get_int("owner") | 	local owner = meta:get_string("owner") | ||||||
|  |  | ||||||
| 	local vm = VoxelManip() | 	local vm = VoxelManip() | ||||||
| 	local p1 = vector.new( | 	local p1 = vector.new( | ||||||
| @@ -104,19 +99,15 @@ local function quarry_dig(pos, center, size) | |||||||
| 		end | 		end | ||||||
| 		if minetest.is_protected and minetest.is_protected(digpos, owner) then | 		if minetest.is_protected and minetest.is_protected(digpos, owner) then | ||||||
| 			meta:set_int("enabled", 0) | 			meta:set_int("enabled", 0) | ||||||
| 			return | 			set_quarry_formspec(meta) | ||||||
|  | 			return {} | ||||||
| 		end | 		end | ||||||
| 		dig_y = digpos.y | 		dig_y = digpos.y | ||||||
| 		local node = minetest.get_node(digpos) | 		local node = minetest.get_node(digpos) | ||||||
|  | 		local node_def = minetest.registered_nodes[node.name] or { diggable = false } | ||||||
|  | 		if node_def.diggable and ((not node_def.can_dig) or node_def.can_dig(digpos, nil)) then | ||||||
|  | 			minetest.remove_node(digpos) | ||||||
| 			drops = minetest.get_node_drops(node.name, "") | 			drops = minetest.get_node_drops(node.name, "") | ||||||
| 		minetest.dig_node(digpos) |  | ||||||
| 		if minetest.get_node(digpos).name == node.name then |  | ||||||
| 			-- We tried to dig something undigable like a |  | ||||||
| 			-- filled chest. Notice that we check for a node |  | ||||||
| 			-- change, not for air. This is so that we get drops |  | ||||||
| 			-- from things like concrete posts with platforms, |  | ||||||
| 			-- which turn into regular concrete posts when dug. |  | ||||||
| 			drops = {} |  | ||||||
| 		end | 		end | ||||||
| 	elseif not (dig_y < pos.y - quarry_max_depth) then | 	elseif not (dig_y < pos.y - quarry_max_depth) then | ||||||
| 		dig_y = dig_y - 16 | 		dig_y = dig_y - 16 | ||||||
| @@ -128,7 +119,7 @@ end | |||||||
|  |  | ||||||
| local function send_items(items, pos, node) | local function send_items(items, pos, node) | ||||||
| 	for _, item in pairs(items) do | 	for _, item in pairs(items) do | ||||||
| 		local tube_item = tube_item(vector.new(pos), item) | 		local tube_item = pipeworks.tube_item(vector.new(pos), item) | ||||||
| 		tube_item:get_luaentity().start_pos = vector.new(pos) | 		tube_item:get_luaentity().start_pos = vector.new(pos) | ||||||
| 		tube_item:setvelocity(vector.new(0, 1, 0)) | 		tube_item:setvelocity(vector.new(0, 1, 0)) | ||||||
| 		tube_item:setacceleration({x=0, y=0, z=0}) | 		tube_item:setacceleration({x=0, y=0, z=0}) | ||||||
| @@ -136,29 +127,28 @@ local function send_items(items, pos, node) | |||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_node("technic:quarry", { | minetest.register_node("technic:quarry", { | ||||||
| 	description = S("Quarry"), | 	description = S("%s Quarry"):format("HV"), | ||||||
| 	tiles = {"default_steel_block.png", "default_steel_block.png", | 	tiles = {"technic_carbon_steel_block.png", "technic_carbon_steel_block.png", | ||||||
| 	         "default_steel_block.png", "default_steel_block.png", | 	         "technic_carbon_steel_block.png", "technic_carbon_steel_block.png", | ||||||
| 	         "default_steel_block.png^default_tool_mesepick.png", "default_steel_block.png"}, | 	         "technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png"}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	groups = {cracky=2, tubedevice=1}, | 	groups = {cracky=2, tubedevice=1}, | ||||||
| 	tube = { | 	tube = { | ||||||
| 		connect_sides = {top = 1}, | 		connect_sides = {top = 1}, | ||||||
| 	}, | 	}, | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local size = 4 |  | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("Quarry")) | 		meta:set_string("infotext", S("%s Quarry"):format("HV")) | ||||||
| 		meta:set_string("formspec", get_quarry_formspec(4)) | 		meta:set_int("size", 4) | ||||||
| 		meta:set_int("size", size) | 		set_quarry_formspec(meta) | ||||||
| 		meta:set_int("dig_y", pos.y) | 		meta:set_int("dig_y", pos.y) | ||||||
| 	end, | 	end, | ||||||
| 	after_place_node = function(pos, placer, itemstack) | 	after_place_node = function(pos, placer, itemstack) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("owner", placer:get_player_name()) | 		meta:set_string("owner", placer:get_player_name()) | ||||||
| 		tube_scanforobjects(pos) | 		pipeworks.scan_for_tube_objects(pos) | ||||||
| 	end, | 	end, | ||||||
| 	after_dig_node = tube_scanforobjects, | 	after_dig_node = pipeworks.scan_for_tube_objects, | ||||||
| 	on_receive_fields = quarry_receive_fields, | 	on_receive_fields = quarry_receive_fields, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -173,7 +163,7 @@ minetest.register_abm({ | |||||||
| 		local demand = 10000 | 		local demand = 10000 | ||||||
| 		local center = get_quarry_center(pos, size) | 		local center = get_quarry_center(pos, size) | ||||||
| 		local dig_y = meta:get_int("dig_y") | 		local dig_y = meta:get_int("dig_y") | ||||||
| 		local machine_name = S("Quarry") | 		local machine_name = S("%s Quarry"):format("HV") | ||||||
|  |  | ||||||
| 		technic.switching_station_timeout_count(pos, "HV") | 		technic.switching_station_timeout_count(pos, "HV") | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:solar_array_hv 1', | 	output = 'technic:solar_array_hv 1', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:solar_array_mv',     'technic:solar_array_mv', 'technic:solar_array_mv'}, | 		{'technic:solar_array_mv',     'technic:solar_array_mv', 'technic:solar_array_mv'}, | ||||||
| 		{'default:steel_ingot',    'technic:hv_transformer',  'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:hv_transformer', 'technic:carbon_steel_ingot'}, | ||||||
| 		{'',                           'technic:hv_cable0',      ''}, | 		{'',                           'technic:hv_cable0',      ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -5,10 +5,10 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:lv_alloy_furnace', | 	output = 'technic:lv_alloy_furnace', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:brick',           'default:brick',          'default:brick'}, | 		{'default:brick',           'default:brick',          'default:brick'}, | ||||||
| 		{'default:brick',       '',                     'default:brick'}, | 		{'default:brick',           'technic:machine_casing', 'default:brick'}, | ||||||
| 		{'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'}, | 		{'default:brick',           'technic:lv_cable0',      'default:brick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| technic.register_alloy_furnace({tier="LV", cook_time=6, demand={300}}) | technic.register_alloy_furnace({tier = "LV", speed = 1, demand = {300}}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,43 +1,16 @@ | |||||||
| -- LV Battery box and some other nodes... |  | ||||||
|  |  | ||||||
| technic.register_power_tool("technic:battery", 10000) |  | ||||||
| technic.register_power_tool("technic:red_energy_crystal", 100000) |  | ||||||
| technic.register_power_tool("technic:green_energy_crystal", 250000) |  | ||||||
| technic.register_power_tool("technic:blue_energy_crystal", 500000) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	output = 'technic:battery', |  | ||||||
| 	recipe = { |  | ||||||
| 		{'group:wood', 'default:copper_ingot', 'group:wood'}, |  | ||||||
| 		{'group:wood', 'moreores:tin_ingot',   'group:wood'}, |  | ||||||
| 		{'group:wood', 'default:copper_ingot', 'group:wood'}, |  | ||||||
| 	} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_tool("technic:battery", { |  | ||||||
| 	description = "RE Battery", |  | ||||||
| 	inventory_image = "technic_battery.png", |  | ||||||
| 	tool_capabilities = { |  | ||||||
| 		charge = 0, |  | ||||||
| 		max_drop_level = 0, |  | ||||||
| 		groupcaps = { |  | ||||||
| 			fleshy = {times={}, uses=10000, maxlevel=0} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:lv_battery_box0', | 	output = 'technic:lv_battery_box0', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:battery',     'group:wood',           'technic:battery'}, | 		{'group:wood',              'group:wood',              'group:wood'}, | ||||||
| 		{'technic:battery',     'default:copper_ingot', 'technic:battery'}, | 		{'technic:battery',         'technic:machine_casing',  'technic:battery'}, | ||||||
| 		{'default:steel_ingot', 'default:steel_ingot',  'default:steel_ingot'}, | 		{'technic:battery',         'technic:lv_cable0',       'technic:battery'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| technic.register_battery_box({ | technic.register_battery_box({ | ||||||
| 	tier           = "LV", | 	tier           = "LV", | ||||||
| 	max_charge     = 50000, | 	max_charge     = 40000, | ||||||
| 	charge_rate    = 1000, | 	charge_rate    = 1000, | ||||||
| 	discharge_rate = 4000, | 	discharge_rate = 4000, | ||||||
| 	charge_step    = 500, | 	charge_step    = 500, | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ local twosize_products = { | |||||||
|  |  | ||||||
| local cnc_formspec = | local cnc_formspec = | ||||||
| 	"invsize[9,11;]".. | 	"invsize[9,11;]".. | ||||||
| 	"label[1,0;Choose Milling Program:]".. | 	"label[1,0;"..S("Choose Milling Program:").."]".. | ||||||
| 	"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]".. | 	"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]".. | ||||||
| 	"image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]".. | 	"image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]".. | ||||||
| 	"image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]".. | 	"image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]".. | ||||||
| @@ -56,7 +56,7 @@ local cnc_formspec = | |||||||
| 	"image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]".. | 	"image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]".. | ||||||
| 	"image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]".. | 	"image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]".. | ||||||
|  |  | ||||||
| 	"label[1,3.5;Slim Elements half / normal height:]".. | 	"label[1,3.5;"..S("Slim Elements half / normal height:").."]".. | ||||||
|  |  | ||||||
| 	"image_button[1,4;1,0.5;technic_cnc_full.png;full; ]".. | 	"image_button[1,4;1,0.5;technic_cnc_full.png;full; ]".. | ||||||
| 	"image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]".. | 	"image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]".. | ||||||
| @@ -66,9 +66,9 @@ local cnc_formspec = | |||||||
| 	"image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]".. | 	"image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]".. | ||||||
| 	"image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]".. | 	"image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]".. | ||||||
|  |  | ||||||
| 	"label[0, 5.5;In:]".. | 	"label[0, 5.5;"..S("In:").."]".. | ||||||
| 	"list[current_name;src;0.5,5.5;1,1;]".. | 	"list[current_name;src;0.5,5.5;1,1;]".. | ||||||
| 	"label[4, 5.5;Out:]".. | 	"label[4, 5.5;"..S("Out:").."]".. | ||||||
| 	"list[current_name;dst;5,5.5;4,1;]".. | 	"list[current_name;dst;5,5.5;4,1;]".. | ||||||
|  |  | ||||||
| 	"list[current_player;main;0,7;8,4;]" | 	"list[current_player;main;0,7;8,4;]" | ||||||
| @@ -127,7 +127,7 @@ end | |||||||
|  |  | ||||||
| -- The actual block inactive state | -- The actual block inactive state | ||||||
| minetest.register_node("technic:cnc", { | minetest.register_node("technic:cnc", { | ||||||
| 	description = S("CNC Machine"), | 	description = S("%s CNC Machine"):format("LV"), | ||||||
| 	tiles       = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png", | 	tiles       = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png", | ||||||
| 	               "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"}, | 	               "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"}, | ||||||
| 	drawtype    = "nodebox", | 	drawtype    = "nodebox", | ||||||
| @@ -143,45 +143,33 @@ minetest.register_node("technic:cnc", { | |||||||
| 	legacy_facedir_simple = true, | 	legacy_facedir_simple = true, | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("CNC Machine")) | 		meta:set_string("infotext", S("%s CNC Machine"):format("LV")) | ||||||
| 		meta:set_float("technic_power_machine", 1) | 		meta:set_float("technic_power_machine", 1) | ||||||
| 		meta:set_string("formspec", cnc_formspec) | 		meta:set_string("formspec", cnc_formspec) | ||||||
| 		local inv = meta:get_inventory() | 		local inv = meta:get_inventory() | ||||||
| 		inv:set_size("src", 1) | 		inv:set_size("src", 1) | ||||||
| 		inv:set_size("dst", 4) | 		inv:set_size("dst", 4) | ||||||
| 	end, | 	end, | ||||||
| 	can_dig = function(pos,player) | 	can_dig = technic.machine_can_dig, | ||||||
| 		local meta = minetest.get_meta(pos); | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 		local inv = meta:get_inventory() | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 		if not inv:is_empty("src") or not inv:is_empty("dst") then | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 				S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		else |  | ||||||
| 			return true |  | ||||||
| 		end |  | ||||||
| 	end, |  | ||||||
| 	on_receive_fields = form_handler, | 	on_receive_fields = form_handler, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| -- Active state block | -- Active state block | ||||||
| minetest.register_node("technic:cnc_active", { | minetest.register_node("technic:cnc_active", { | ||||||
| 	description = S("CNC Machine"), | 	description = S("%s CNC Machine"):format("LV"), | ||||||
| 	tiles       = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", | 	tiles       = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", | ||||||
| 	               "technic_cnc_side.png",       "technic_cnc_side.png",   "technic_cnc_front_active.png"}, | 	               "technic_cnc_side.png",       "technic_cnc_side.png",   "technic_cnc_front_active.png"}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
|  | 	drop = "technic:cnc", | ||||||
| 	groups = {cracky=2, not_in_creative_inventory=1}, | 	groups = {cracky=2, not_in_creative_inventory=1}, | ||||||
| 	legacy_facedir_simple = true, | 	legacy_facedir_simple = true, | ||||||
| 	can_dig = function(pos,player) | 	can_dig = technic.machine_can_dig, | ||||||
| 		local meta = minetest.get_meta(pos); | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 		local inv = meta:get_inventory() | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 		if not inv:is_empty("src") or not inv:is_empty("dst") then | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 				S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		end |  | ||||||
| 		return true |  | ||||||
| 	end, |  | ||||||
| 	on_receive_fields = form_handler, | 	on_receive_fields = form_handler, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -194,36 +182,29 @@ minetest.register_abm({ | |||||||
| 		local meta         = minetest.get_meta(pos) | 		local meta         = minetest.get_meta(pos) | ||||||
| 		local inv          = meta:get_inventory() | 		local inv          = meta:get_inventory() | ||||||
| 		local eu_input     = meta:get_int("LV_EU_input") | 		local eu_input     = meta:get_int("LV_EU_input") | ||||||
| 		local machine_name = S("CNC Machine") | 		local machine_name = S("%s CNC Machine"):format("LV") | ||||||
| 		local machine_node = "technic:cnc" | 		local machine_node = "technic:cnc" | ||||||
| 		local demand       = 450 | 		local demand       = 450 | ||||||
|  |  | ||||||
| 		-- Setup meta data if it does not exist. state is used as an indicator of this |  | ||||||
| 		if not eu_input then |  | ||||||
| 			meta:set_int("LV_EU_demand", demand) |  | ||||||
| 			meta:set_int("LV_EU_input", 0) |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
|  |  | ||||||
| 		-- Power off automatically if no longer connected to a switching station | 		-- Power off automatically if no longer connected to a switching station | ||||||
| 		technic.switching_station_timeout_count(pos, "LV") | 		technic.switching_station_timeout_count(pos, "LV") | ||||||
|  |  | ||||||
| 		 |  | ||||||
| 		local result = meta:get_string("cnc_product") | 		local result = meta:get_string("cnc_product") | ||||||
| 		if inv:is_empty("src") or  | 		if inv:is_empty("src") or  | ||||||
| 		   (not minetest.registered_nodes[result]) or | 		   (not minetest.registered_nodes[result]) or | ||||||
| 		   (not inv:room_for_item("dst", result)) then | 		   (not inv:room_for_item("dst", result)) then | ||||||
| 			hacky_swap_node(pos, machine_node) | 			technic.swap_node(pos, machine_node) | ||||||
| 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | ||||||
| 			meta:set_string("cnc_product", "") | 			meta:set_string("cnc_product", "") | ||||||
|  | 			meta:set_int("LV_EU_demand", 0) | ||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		if eu_input < demand then | 		if eu_input < demand then | ||||||
| 			hacky_swap_node(pos, machine_node) | 			technic.swap_node(pos, machine_node) | ||||||
| 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) | 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) | ||||||
| 		elseif eu_input >= demand then | 		elseif eu_input >= demand then | ||||||
| 			hacky_swap_node(pos, machine_node.."_active") | 			technic.swap_node(pos, machine_node.."_active") | ||||||
| 			meta:set_string("infotext", S("%s Active"):format(machine_name)) | 			meta:set_string("infotext", S("%s Active"):format(machine_name)) | ||||||
| 			meta:set_int("src_time", meta:get_int("src_time") + 1) | 			meta:set_int("src_time", meta:get_int("src_time") + 1) | ||||||
| 			if meta:get_int("src_time") >= 3 then -- 3 ticks per output | 			if meta:get_int("src_time") >= 3 then -- 3 ticks per output | ||||||
| @@ -248,8 +229,8 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:cnc', | 	output = 'technic:cnc', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:glass',              'technic:diamond_drill_head', 'default:glass'}, | 		{'default:glass',              'technic:diamond_drill_head', 'default:glass'}, | ||||||
| 		{'technic:control_logic_unit', 'technic:motor',              'default:steel_ingot'}, | 		{'technic:control_logic_unit', 'technic:machine_casing',     'technic:motor'}, | ||||||
| 		{'default:steel_ingot',        'default:copper_ingot',       'default:steel_ingot'},          | 		{'technic:carbon_steel_ingot', 'technic:lv_cable0',          'technic:carbon_steel_ingot'},          | ||||||
| 	}, | 	}, | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,13 +14,6 @@ technic.cnc.programs_disable["default:dirt"] = {"technic_cnc_sphere", "technic_c | |||||||
| 		"technic_cnc_slope_edge_upsdown", "technic_cnc_slope_inner_edge_upsdown", | 		"technic_cnc_slope_edge_upsdown", "technic_cnc_slope_inner_edge_upsdown", | ||||||
| 		"technic_cnc_stick", "technic_cnc_cylinder_horizontal"} | 		"technic_cnc_stick", "technic_cnc_cylinder_horizontal"} | ||||||
|  |  | ||||||
| -- TREE |  | ||||||
| ------- |  | ||||||
| technic.cnc.register_all("default:tree", |  | ||||||
|                 {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, |  | ||||||
|                 {"default_tree.png"}, |  | ||||||
|                 S("Wooden")) |  | ||||||
|  |  | ||||||
| -- WOOD | -- WOOD | ||||||
| ------- | ------- | ||||||
| technic.cnc.register_all("default:wood", | technic.cnc.register_all("default:wood", | ||||||
| @@ -65,10 +58,39 @@ technic.cnc.register_all("default:tree", | |||||||
|                 {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1}, |                 {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1}, | ||||||
|                 {"default_tree.png"}, |                 {"default_tree.png"}, | ||||||
|                 S("Tree")) |                 S("Tree")) | ||||||
| -- STEEL |  | ||||||
| -------- | -- WROUGHT IRON | ||||||
| technic.cnc.register_all("default:steel", | --------------- | ||||||
|                 {snappy=1, bendy=2, cracky=1, melty=2, level=2, not_in_creative_inventory=1}, | technic.cnc.register_all("default:steelblock", | ||||||
|                 {"default_steel_block.png"}, |                 {cracky=1, level=2, not_in_creative_inventory=1}, | ||||||
|                 S("Steel")) |                 {"technic_wrought_iron_block.png"}, | ||||||
|  |                 S("Wrought Iron")) | ||||||
|  |  | ||||||
|  | -- Bronze | ||||||
|  | -------- | ||||||
|  | technic.cnc.register_all("default:bronzeblock", | ||||||
|  |                 {cracky=1, level=2, not_in_creative_inventory=1}, | ||||||
|  |                 {"default_bronze_block.png"}, | ||||||
|  |                 S("Bronze")) | ||||||
|  |  | ||||||
|  | -- Stainless Steel | ||||||
|  | -------- | ||||||
|  | technic.cnc.register_all("technic:stainless_steel_block", | ||||||
|  |                 {cracky=1, level=2, not_in_creative_inventory=1}, | ||||||
|  |                 {"technic_stainless_steel_block.png"}, | ||||||
|  |                 S("Stainless Steel")) | ||||||
|  |  | ||||||
|  | -- Marble | ||||||
|  | ------------ | ||||||
|  | technic.cnc.register_all("technic:marble", | ||||||
|  |                 {cracky=3, not_in_creative_inventory=1}, | ||||||
|  |                 {"technic_marble.png"}, | ||||||
|  |                 S("Marble")) | ||||||
|  |  | ||||||
|  | -- Granite | ||||||
|  | ------------ | ||||||
|  | technic.cnc.register_all("technic:granite", | ||||||
|  |                 {cracky=3, not_in_creative_inventory=1}, | ||||||
|  |                 {"technic_granite.png"}, | ||||||
|  |                 S("Granite")) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
|  |  | ||||||
| -- Coal driven alloy furnace. This uses no EUs: | -- Fuel driven alloy furnace. This uses no EUs: | ||||||
|  |  | ||||||
| local S = technic.getter | local S = technic.getter | ||||||
|  |  | ||||||
| @@ -12,53 +12,55 @@ minetest.register_craft({ | |||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | local machine_name = S("Fuel-Fired Alloy Furnace") | ||||||
|  | local formspec = | ||||||
|  | 	"size[8,9]".. | ||||||
|  | 	"label[0,0;"..machine_name.."]".. | ||||||
|  | 	"image[2,2;1,1;default_furnace_fire_bg.png]".. | ||||||
|  | 	"list[current_name;fuel;2,3;1,1;]".. | ||||||
|  | 	"list[current_name;src;2,1;2,1;]".. | ||||||
|  | 	"list[current_name;dst;5,1;2,2;]".. | ||||||
|  | 	"list[current_player;main;0,5;8,4;]" | ||||||
|  |  | ||||||
| minetest.register_node("technic:coal_alloy_furnace", { | minetest.register_node("technic:coal_alloy_furnace", { | ||||||
| 	description = S("Coal Alloy Furnace"), | 	description = machine_name, | ||||||
| 	tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", "technic_coal_alloy_furnace_side.png", | 	tiles = {"technic_coal_alloy_furnace_top.png",  "technic_coal_alloy_furnace_bottom.png", | ||||||
| 		"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"}, | 	         "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", | ||||||
|  | 	         "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	groups = {cracky=2}, | 	groups = {cracky=2}, | ||||||
| 	legacy_facedir_simple = true, | 	legacy_facedir_simple = true, | ||||||
| 	sounds = default.node_sound_stone_defaults(), | 	sounds = default.node_sound_stone_defaults(), | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.env:get_meta(pos) | 		local meta = minetest.env:get_meta(pos) | ||||||
| 		meta:set_string("formspec", coal_alloy_furnace_formspec) | 		meta:set_string("formspec", formspec) | ||||||
| 		meta:set_string("infotext", S("Coal Alloy Furnace")) | 		meta:set_string("infotext", machine_name) | ||||||
| 		local inv = meta:get_inventory() | 		local inv = meta:get_inventory() | ||||||
| 		inv:set_size("fuel", 1) | 		inv:set_size("fuel", 1) | ||||||
| 		inv:set_size("src", 1) | 		inv:set_size("src", 2) | ||||||
| 		inv:set_size("src2", 1) |  | ||||||
| 		inv:set_size("dst", 4) | 		inv:set_size("dst", 4) | ||||||
| 	end, | 	end, | ||||||
| 	can_dig = function(pos,player) | 	can_dig = technic.machine_can_dig, | ||||||
| 		local meta = minetest.env:get_meta(pos); | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 		local inv = meta:get_inventory() | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 		if not (inv:is_empty("fuel") or inv:is_empty("dst") or inv:is_empty("src") or inv:is_empty("src2") )then | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 			return false |  | ||||||
| 			end |  | ||||||
| 		return true |  | ||||||
| 	end, |  | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:coal_alloy_furnace_active", { | minetest.register_node("technic:coal_alloy_furnace_active", { | ||||||
| 	description = "Alloy Furnace", | 	description = machine_name, | ||||||
| 	tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", "technic_coal_alloy_furnace_side.png", | 	tiles = {"technic_coal_alloy_furnace_top.png",  "technic_coal_alloy_furnace_bottom.png", | ||||||
| 	         "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"}, | 	         "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", | ||||||
|  | 	         "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	light_source = 8, | 	light_source = 8, | ||||||
| 	drop = "technic:coal_alloy_furnace", | 	drop = "technic:coal_alloy_furnace", | ||||||
| 	groups = {cracky=2, not_in_creative_inventory=1}, | 	groups = {cracky=2, not_in_creative_inventory=1}, | ||||||
| 	legacy_facedir_simple = true, | 	legacy_facedir_simple = true, | ||||||
| 	sounds = default.node_sound_stone_defaults(), | 	sounds = default.node_sound_stone_defaults(), | ||||||
| 	can_dig = function(pos,player) | 	can_dig = technic.machine_can_dig, | ||||||
| 		local meta = minetest.env:get_meta(pos); | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 		local inv = meta:get_inventory() | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 		if not (inv:is_empty("fuel") or inv:is_empty("dst") or | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 			inv:is_empty("src") or inv:is_empty("src2")) then |  | ||||||
| 			return false |  | ||||||
| 		end |  | ||||||
| 		return true |  | ||||||
| 	end, |  | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_abm({ | minetest.register_abm({ | ||||||
| @@ -68,17 +70,14 @@ minetest.register_abm({ | |||||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		local inv    = meta:get_inventory() | 		local inv    = meta:get_inventory() | ||||||
|  | 		 | ||||||
|  | 		if inv:get_size("src") == 1 then -- Old furnace -> convert it | ||||||
|  | 			inv:set_size("src", 2) | ||||||
|  | 			inv:set_stack("src", 2, inv:get_stack("src2", 1)) | ||||||
|  | 			inv:set_size("src2", 0) | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
| 		local recipe = nil | 		local recipe = nil | ||||||
| 		local machine_name = S("Coal Alloy Furnace") |  | ||||||
| 		local formspec = |  | ||||||
| 			"size[8,9]".. |  | ||||||
| 			"label[0,0;"..machine_name.."]".. |  | ||||||
| 			"image[2,2;1,1;default_furnace_fire_bg.png]".. |  | ||||||
| 			"list[current_name;fuel;2,3;1,1;]".. |  | ||||||
| 			"list[current_name;src;2,1;1,1;]".. |  | ||||||
| 			"list[current_name;src2;3,1;1,1;]".. |  | ||||||
| 			"list[current_name;dst;5,1;2,2;]".. |  | ||||||
| 			"list[current_player;main;0,5;8,4;]" |  | ||||||
|  |  | ||||||
| 		for i, name in pairs({ | 		for i, name in pairs({ | ||||||
| 				"fuel_totaltime", | 				"fuel_totaltime", | ||||||
| @@ -91,33 +90,22 @@ minetest.register_abm({ | |||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		-- Get what to cook if anything | 		-- Get what to cook if anything | ||||||
| 		local srcstack = inv:get_stack("src", 1) | 		local result = technic.get_recipe("alloy", inv:get_list("src")) | ||||||
| 		local src2stack = inv:get_stack("src2", 1) |  | ||||||
| 		local recipe = technic.get_alloy_recipe(srcstack, src2stack) |  | ||||||
| 		if srcstack:get_name() > src2stack:get_name() then |  | ||||||
| 			local temp = srcstack |  | ||||||
| 			srcstack = src2stack |  | ||||||
| 			src2stack = temp |  | ||||||
| 		end |  | ||||||
|  |  | ||||||
| 		local was_active = false | 		local was_active = false | ||||||
|  |  | ||||||
| 		if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then | 		if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then | ||||||
| 			was_active = true | 			was_active = true | ||||||
| 			meta:set_int("fuel_time", meta:get_int("fuel_time") + 1) | 			meta:set_int("fuel_time", meta:get_int("fuel_time") + 1) | ||||||
| 			if recipe then | 			if result then | ||||||
| 				meta:set_int("src_time", meta:get_int("src_time") + 1) | 				meta:set_int("src_time", meta:get_int("src_time") + 1) | ||||||
| 				if meta:get_int("src_time") == 6 then | 				if meta:get_int("src_time") >= result.time then | ||||||
| 					-- check if there's room for output in "dst" list |  | ||||||
| 					local dst_stack = ItemStack(recipe.output) |  | ||||||
| 					if inv:room_for_item("dst", dst_stack) then |  | ||||||
| 						srcstack:take_item(recipe.input[1].count) |  | ||||||
| 						inv:set_stack("src", 1, srcstack) |  | ||||||
| 						src2stack:take_item(recipe.input[2].count) |  | ||||||
| 						inv:set_stack("src2", 1, src2stack) |  | ||||||
| 						inv:add_item("dst", dst_stack) |  | ||||||
| 					end |  | ||||||
| 					meta:set_int("src_time", 0) | 					meta:set_int("src_time", 0) | ||||||
|  | 					local result_stack = ItemStack(result.output) | ||||||
|  | 					if inv:room_for_item("dst", result_stack) then | ||||||
|  | 						inv:set_list("src", result.new_input) | ||||||
|  | 						inv:add_item("dst", result_stack) | ||||||
|  | 					end | ||||||
| 				end | 				end | ||||||
| 			else | 			else | ||||||
| 				meta:set_int("src_time", 0) | 				meta:set_int("src_time", 0) | ||||||
| @@ -128,30 +116,25 @@ minetest.register_abm({ | |||||||
| 			local percent = math.floor(meta:get_float("fuel_time") / | 			local percent = math.floor(meta:get_float("fuel_time") / | ||||||
| 					meta:get_float("fuel_totaltime") * 100) | 					meta:get_float("fuel_totaltime") * 100) | ||||||
| 			meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)") | 			meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)") | ||||||
| 			hacky_swap_node(pos, "technic:coal_alloy_furnace_active") | 			technic.swap_node(pos, "technic:coal_alloy_furnace_active") | ||||||
| 			meta:set_string("formspec", | 			meta:set_string("formspec", | ||||||
| 					"size[8,9]".. | 					"size[8,9]".. | ||||||
| 					"label[0,0;"..machine_name.."]".. | 					"label[0,0;"..machine_name.."]".. | ||||||
| 					"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. | 					"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. | ||||||
| 					(100 - percent)..":default_furnace_fire_fg.png]".. | 					(100 - percent)..":default_furnace_fire_fg.png]".. | ||||||
| 					"list[current_name;fuel;2,3;1,1;]".. | 					"list[current_name;fuel;2,3;1,1;]".. | ||||||
| 					"list[current_name;src;2,1;1,1;]".. | 					"list[current_name;src;2,1;2,1;]".. | ||||||
| 					"list[current_name;src2;3,1;1,1;]".. |  | ||||||
| 					"list[current_name;dst;5,1;2,2;]".. | 					"list[current_name;dst;5,1;2,2;]".. | ||||||
| 					"list[current_player;main;0,5;8,4;]") | 					"list[current_player;main;0,5;8,4;]") | ||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		-- FIXME: Make this look more like the electrical version. | 		local recipe = technic.get_recipe("alloy", inv:get_list("src")) | ||||||
| 		-- This code refetches the recipe to see if it can be done again after the iteration |  | ||||||
| 		srcstack = inv:get_stack("src", 1) |  | ||||||
| 		srcstack = inv:get_stack("src2", 1) |  | ||||||
| 		local recipe = technic.get_alloy_recipe(srcstack, src2stack) |  | ||||||
|  |  | ||||||
| 		if recipe then | 		if not recipe then | ||||||
| 			if was_active then | 			if was_active then | ||||||
| 				meta:set_string("infotext", "Furnace is empty") | 				meta:set_string("infotext", S("%s is empty"):format(machine_name)) | ||||||
| 				hacky_swap_node(pos, "technic:coal_alloy_furnace") | 				technic.swap_node(pos, "technic:coal_alloy_furnace") | ||||||
| 				meta:set_string("formspec", formspec) | 				meta:set_string("formspec", formspec) | ||||||
| 			end | 			end | ||||||
| 			return | 			return | ||||||
| @@ -167,7 +150,7 @@ minetest.register_abm({ | |||||||
|  |  | ||||||
| 		if fuel.time <= 0 then | 		if fuel.time <= 0 then | ||||||
| 			meta:set_string("infotext", S("%s Out Of Fuel"):format(machine_name)) | 			meta:set_string("infotext", S("%s Out Of Fuel"):format(machine_name)) | ||||||
| 			hacky_swap_node(pos, "technic:coal_alloy_furnace") | 			technic.swap_node(pos, "technic:coal_alloy_furnace") | ||||||
| 			meta:set_string("formspec", formspec) | 			meta:set_string("formspec", formspec) | ||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								technic/machines/LV/coal_furnace.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,5 @@ | |||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
|  | if minetest.registered_nodes["default:furnace"].description == "Furnace" then | ||||||
|  | 	minetest.override_item("default:furnace", { description = S("Fuel-Fired Furnace") }) | ||||||
|  | end | ||||||
| @@ -1,170 +1,13 @@ | |||||||
|  |  | ||||||
| technic.compressor_recipes = {} | minetest.register_alias("compressor", "technic:lv_compressor") | ||||||
|  |  | ||||||
| local S = technic.getter |  | ||||||
|  |  | ||||||
| technic.register_compressor_recipe = function(src, src_count, dst, dst_count) |  | ||||||
| 	technic.compressor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count} |  | ||||||
| 	if unified_inventory then |  | ||||||
| 		unified_inventory.register_craft({ |  | ||||||
| 			type = "compressing", |  | ||||||
| 			output = dst.." "..dst_count, |  | ||||||
| 			items = {src.." "..src_count}, |  | ||||||
| 			width = 0, |  | ||||||
| 		}) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| technic.get_compressor_recipe = function(item) |  | ||||||
| 	if technic.compressor_recipes[item.name] and  |  | ||||||
| 	   item.count >= technic.compressor_recipes[item.name].src_count then |  | ||||||
| 		return technic.compressor_recipes[item.name] |  | ||||||
| 	else |  | ||||||
| 		return nil |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| technic.register_compressor_recipe("default:snowblock",         1, "default:ice",             1) |  | ||||||
| technic.register_compressor_recipe("default:sand",              1, "default:sandstone",       1) |  | ||||||
| technic.register_compressor_recipe("default:desert_sand",       1, "default:desert_stone",    1) |  | ||||||
| technic.register_compressor_recipe("technic:mixed_metal_ingot", 1, "technic:composite_plate", 1) |  | ||||||
| technic.register_compressor_recipe("default:copper_ingot",      5, "technic:copper_plate",    1) |  | ||||||
| technic.register_compressor_recipe("technic:coal_dust",         4, "technic:graphite",        1) |  | ||||||
| technic.register_compressor_recipe("technic:carbon_cloth",      1, "technic:carbon_plate",    1) |  | ||||||
| technic.register_compressor_recipe("technic:enriched_uranium",  4, "technic:uranium_fuel",    1) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| minetest.register_alias("compressor", "technic:compressor") |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:compressor', | 	output = 'technic:lv_compressor', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:stone',	'default:stone',	'default:stone'}, | 		{'default:stone',	'technic:motor',		'default:stone'}, | ||||||
| 		{'mesecons:piston',	'technic:motor',	'mesecons:piston'}, | 		{'mesecons:piston',	'technic:machine_casing',	'mesecons:piston'}, | ||||||
| 		{'default:stone',	'technic:lv_cable0',		'default:stone'}, | 		{'default:stone',	'technic:lv_cable0',		'default:stone'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| local compressor_formspec = | technic.register_compressor({tier = "LV", demand = {300}, speed = 1}) | ||||||
| 	"invsize[8,9;]".. |  | ||||||
| 	"label[0,0;"..S("Compressor").."]".. |  | ||||||
| 	"list[current_name;src;3,1;1,1;]".. |  | ||||||
| 	"list[current_name;dst;5,1;2,2;]".. |  | ||||||
| 	"list[current_player;main;0,5;8,4;]" |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:compressor", { |  | ||||||
| 	description = S("Compressor"), |  | ||||||
| 	tiles = {"technic_compressor_top.png",  "technic_compressor_bottom.png", |  | ||||||
| 	         "technic_compressor_side.png", "technic_compressor_side.png", |  | ||||||
| 	         "technic_compressor_back.png", "technic_compressor_front.png"}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {cracky=2}, |  | ||||||
| 	legacy_facedir_simple = true, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	on_construct = function(pos) |  | ||||||
| 		local meta = minetest.get_meta(pos) |  | ||||||
| 		meta:set_string("infotext", S("Compressor")) |  | ||||||
| 		meta:set_string("formspec", compressor_formspec) |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		inv:set_size("src", 1) |  | ||||||
| 		inv:set_size("dst", 4) |  | ||||||
| 	end, |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.get_meta(pos) |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		if not inv:is_empty("src") or not inv:is_empty("dst") then |  | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		else |  | ||||||
| 			return true |  | ||||||
| 		end |  | ||||||
| 	end, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:compressor_active", { |  | ||||||
| 	description = S("Compressor"), |  | ||||||
| 	tiles = {"technic_compressor_top.png",  "technic_compressor_bottom.png", |  | ||||||
| 	         "technic_compressor_side.png", "technic_compressor_side.png", |  | ||||||
| 	         "technic_compressor_back.png", "technic_compressor_front_active.png"}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {cracky=2, not_in_creative_inventory=1}, |  | ||||||
| 	legacy_facedir_simple = true, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.get_meta(pos); |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		if not inv:is_empty("src") or not inv:is_empty("dst") then |  | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		else |  | ||||||
| 			return true |  | ||||||
| 		end |  | ||||||
| 	end, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_abm({ |  | ||||||
| 	nodenames = {"technic:compressor","technic:compressor_active"}, |  | ||||||
| 	interval = 1, |  | ||||||
| 	chance   = 1, |  | ||||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) |  | ||||||
| 		local meta         = minetest.get_meta(pos) |  | ||||||
| 		local eu_input     = meta:get_int("LV_EU_input") |  | ||||||
| 		local machine_name = S("Compressor") |  | ||||||
| 		local machine_node = "technic:compressor" |  | ||||||
| 		local demand       = 300 |  | ||||||
|   |  | ||||||
| 		 -- Setup meta data if it does not exist. |  | ||||||
| 		if not eu_input then |  | ||||||
| 			meta:set_int("LV_EU_demand", demand) |  | ||||||
| 			meta:set_int("LV_EU_input", 0) |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
|   |  | ||||||
| 		-- Power off automatically if no longer connected to a switching station |  | ||||||
| 		technic.switching_station_timeout_count(pos, "LV") |  | ||||||
| 		local inv    = meta:get_inventory() |  | ||||||
| 		local empty  = inv:is_empty("src") |  | ||||||
| 		local srcstack  = inv:get_stack("src", 1) |  | ||||||
| 		local src_item, recipe, result = nil, nil, nil |  | ||||||
|  |  | ||||||
| 		if srcstack then |  | ||||||
| 			src_item = srcstack:to_table() |  | ||||||
| 		end |  | ||||||
| 		if src_item then |  | ||||||
| 			recipe = technic.get_compressor_recipe(src_item) |  | ||||||
| 		end |  | ||||||
| 		if recipe then |  | ||||||
| 			result = {name=recipe.dst_name, count=recipe.dst_count} |  | ||||||
| 		end  |  | ||||||
| 		if empty or (not result) or |  | ||||||
| 		   (not inv:room_for_item("dst", result)) then |  | ||||||
| 			hacky_swap_node(pos, machine_node) |  | ||||||
| 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) |  | ||||||
| 			meta:set_int("LV_EU_demand", 0) |  | ||||||
| 			meta:set_int("src_time", 0) |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
|  |  | ||||||
| 		if eu_input < demand then |  | ||||||
| 			hacky_swap_node(pos, machine_node) |  | ||||||
| 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |  | ||||||
| 		elseif eu_input >= demand then |  | ||||||
| 			hacky_swap_node(pos, machine_node.."_active") |  | ||||||
| 			meta:set_string("infotext", S("%s Active"):format(machine_name)) |  | ||||||
|  |  | ||||||
| 			meta:set_int("src_time", meta:get_int("src_time") + 1) |  | ||||||
| 			if meta:get_int("src_time") >= 4 then  |  | ||||||
| 				meta:set_int("src_time", 0) |  | ||||||
| 				srcstack:take_item(recipe.src_count) |  | ||||||
| 				inv:set_stack("src", 1, srcstack) |  | ||||||
| 				inv:add_item("dst", result) |  | ||||||
| 			end |  | ||||||
| 		end |  | ||||||
| 		meta:set_int("LV_EU_demand", demand) |  | ||||||
| 	end |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| technic.register_machine("LV", "technic:compressor",        technic.receiver) |  | ||||||
| technic.register_machine("LV", "technic:compressor_active", technic.receiver) |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,8 +6,8 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:electric_furnace', | 	output = 'technic:electric_furnace', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:cobble', 'default:cobble',         'default:cobble'}, | 		{'default:cobble', 'default:cobble',         'default:cobble'}, | ||||||
| 		{'default:cobble',      '',                      'default:cobble'}, | 		{'default:cobble', 'technic:machine_casing', 'default:cobble'}, | ||||||
| 		{'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, | 		{'default:cobble', 'technic:lv_cable0',      'default:cobble'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,178 +1,13 @@ | |||||||
|  |  | ||||||
| technic.extractor_recipes ={} | minetest.register_alias("extractor", "technic:lv_extractor") | ||||||
|  |  | ||||||
| local S = technic.getter |  | ||||||
|  |  | ||||||
| technic.register_extractor_recipe = function(src, src_count, dst, dst_count) |  | ||||||
| 	technic.extractor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count} |  | ||||||
| 	if unified_inventory then |  | ||||||
| 		unified_inventory.register_craft({ |  | ||||||
| 			type = "extracting", |  | ||||||
| 			output = dst.." "..dst_count, |  | ||||||
| 			items = {src.." "..src_count}, |  | ||||||
| 			width = 0, |  | ||||||
| 		}) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| -- Receive an ItemStack of result by an ItemStack input |  | ||||||
| technic.get_extractor_recipe = function(item) |  | ||||||
| 	if technic.extractor_recipes[item.name] and |  | ||||||
| 	   item.count >= technic.extractor_recipes[item.name].src_count then |  | ||||||
| 		return technic.extractor_recipes[item.name] |  | ||||||
| 	else |  | ||||||
| 		return nil |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| technic.register_extractor_recipe("technic:coal_dust",        1,          "dye:black",      2) |  | ||||||
| technic.register_extractor_recipe("default:cactus",           1,          "dye:green",      2) |  | ||||||
| technic.register_extractor_recipe("default:dry_shrub",        1,          "dye:brown",      2) |  | ||||||
| technic.register_extractor_recipe("flowers:geranium",         1,          "dye:blue",       2) |  | ||||||
| technic.register_extractor_recipe("flowers:dandelion_white",  1,          "dye:white",      2) |  | ||||||
| technic.register_extractor_recipe("flowers:dandelion_yellow", 1,          "dye:yellow",     2) |  | ||||||
| technic.register_extractor_recipe("flowers:tulip",            1,          "dye:orange",     2) |  | ||||||
| technic.register_extractor_recipe("flowers:rose",             1,          "dye:red",        2) |  | ||||||
| technic.register_extractor_recipe("flowers:viola",            1,          "dye:violet",     2) |  | ||||||
| technic.register_extractor_recipe("technic:raw_latex",        1,          "technic:rubber", 3) |  | ||||||
| technic.register_extractor_recipe("moretrees:rubber_tree_trunk_empty", 1, "technic:rubber", 1) |  | ||||||
| technic.register_extractor_recipe("moretrees:rubber_tree_trunk",       1, "technic:rubber", 1) |  | ||||||
| technic.register_extractor_recipe("technic:uranium",          5,          "technic:enriched_uranium", 1) |  | ||||||
|  |  | ||||||
| minetest.register_alias("extractor", "technic:extractor") |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:extractor', | 	output = 'technic:lv_extractor', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:treetap', 'technic:motor',          'technic:treetap'}, | 		{'technic:treetap', 'technic:motor',          'technic:treetap'}, | ||||||
| 		{'technic:treetap', 'technic:lv_cable0', 'technic:treetap'}, | 		{'technic:treetap', 'technic:machine_casing', 'technic:treetap'}, | ||||||
| 		{'',                '',                  ''}, | 		{'',                'technic:lv_cable0',      ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| local extractor_formspec = | technic.register_extractor({tier = "LV", demand = {300}, speed = 1}) | ||||||
|    "invsize[8,9;]".. |  | ||||||
|    "label[0,0;"..S("Extractor").."]".. |  | ||||||
|    "list[current_name;src;3,1;1,1;]".. |  | ||||||
|    "list[current_name;dst;5,1;2,2;]".. |  | ||||||
|    "list[current_player;main;0,5;8,4;]" |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:extractor", { |  | ||||||
| 	description = S("Extractor"), |  | ||||||
| 	tiles = {"technic_lv_grinder_top.png",  "technic_lv_grinder_bottom.png", "technic_lv_grinder_side.png", |  | ||||||
| 	         "technic_lv_grinder_side.png", "technic_lv_grinder_side.png",   "technic_lv_grinder_front.png"}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {cracky=2}, |  | ||||||
| 	legacy_facedir_simple = true, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	on_construct = function(pos) |  | ||||||
| 		local meta = minetest.get_meta(pos) |  | ||||||
| 		meta:set_string("infotext", S("Extractor")) |  | ||||||
| 		meta:set_string("formspec", extractor_formspec) |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		inv:set_size("src", 1) |  | ||||||
| 		inv:set_size("dst", 4) |  | ||||||
| 	end, |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.get_meta(pos); |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		if not inv:is_empty("src") or not inv:is_empty("dst") then |  | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 				S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		else |  | ||||||
| 			return true |  | ||||||
| 		end |  | ||||||
| 	end, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:extractor_active", { |  | ||||||
| 	description = S("Extractor"), |  | ||||||
| 	tiles = {"technic_lv_grinder_top.png",  "technic_lv_grinder_bottom.png", |  | ||||||
| 	         "technic_lv_grinder_side.png", "technic_lv_grinder_side.png", |  | ||||||
| 	         "technic_lv_grinder_side.png", "technic_lv_grinder_front_active.png"}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {cracky=2, not_in_creative_inventory=1}, |  | ||||||
| 	legacy_facedir_simple = true, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.get_meta(pos); |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		if not inv:is_empty("src") or not inv:is_empty("dst") then |  | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 				S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		else |  | ||||||
| 			return true |  | ||||||
| 		end |  | ||||||
| 	end, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_abm({ |  | ||||||
| 	nodenames = {"technic:extractor", "technic:extractor_active"}, |  | ||||||
| 	interval = 1, |  | ||||||
| 	chance   = 1, |  | ||||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) |  | ||||||
| 		-- The machine will automatically shut down if disconnected from power in some fashion. |  | ||||||
| 		local meta     = minetest.get_meta(pos) |  | ||||||
| 		local inv      = meta:get_inventory() |  | ||||||
| 		local srcstack = inv:get_stack("src", 1) |  | ||||||
| 		local eu_input = meta:get_int("LV_EU_input") |  | ||||||
|  |  | ||||||
| 		-- Machine information |  | ||||||
| 		local machine_name = S("Extractor") |  | ||||||
| 		local machine_node = "technic:extractor" |  | ||||||
| 		local demand       = 300 |  | ||||||
|  |  | ||||||
| 		-- Setup meta data if it does not exist. |  | ||||||
| 		if not eu_input then |  | ||||||
| 			meta:set_int("LV_EU_demand", demand) |  | ||||||
| 			meta:set_int("LV_EU_input", 0) |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
|  |  | ||||||
| 		-- Power off automatically if no longer connected to a switching station |  | ||||||
| 		technic.switching_station_timeout_count(pos, "LV") |  | ||||||
|  |  | ||||||
| 		if srcstack then |  | ||||||
| 			src_item = srcstack:to_table() |  | ||||||
| 		end |  | ||||||
| 		if src_item then |  | ||||||
| 			recipe = technic.get_extractor_recipe(src_item) |  | ||||||
| 		end |  | ||||||
| 		if recipe then |  | ||||||
| 			result = {name=recipe.dst_name, count=recipe.dst_count} |  | ||||||
| 		end  |  | ||||||
| 		if inv:is_empty("src") or (not recipe) or (not result) or |  | ||||||
| 		   (not inv:room_for_item("dst", result)) then |  | ||||||
| 			hacky_swap_node(pos, machine_node) |  | ||||||
| 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) |  | ||||||
| 			meta:set_int("LV_EU_demand", 0) |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
|  |  | ||||||
| 		if eu_input < demand then |  | ||||||
| 			-- unpowered - go idle |  | ||||||
| 			hacky_swap_node(pos, machine_node) |  | ||||||
| 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |  | ||||||
| 		elseif eu_input >= demand then |  | ||||||
| 			-- Powered |  | ||||||
| 			hacky_swap_node(pos, machine_node.."_active") |  | ||||||
| 			meta:set_string("infotext", S("%s Active"):format(machine_name)) |  | ||||||
|  |  | ||||||
| 			meta:set_int("src_time", meta:get_int("src_time") + 1) |  | ||||||
| 			if meta:get_int("src_time") >= 4 then -- 4 ticks per output |  | ||||||
| 				meta:set_int("src_time", 0) |  | ||||||
| 				srcstack:take_item(recipe.src_count) |  | ||||||
| 				inv:set_stack("src", 1, srcstack) |  | ||||||
| 				inv:add_item("dst", result) |  | ||||||
| 			end |  | ||||||
| 		end |  | ||||||
| 		meta:set_int("LV_EU_demand", demand) |  | ||||||
| 	end |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| technic.register_machine("LV", "technic:extractor",        technic.receiver) |  | ||||||
| technic.register_machine("LV", "technic:extractor_active", technic.receiver) |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,8 +9,8 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:lv_generator', | 	output = 'technic:lv_generator', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:stone', 'default:stone',          'default:stone'}, | 		{'default:stone', 'default:stone',          'default:stone'}, | ||||||
| 		{'default:stone', '',                     'default:stone'}, | 		{'default:stone', 'technic:machine_casing', 'default:stone'}, | ||||||
| 		{'default:stone', 'default:copper_ingot', 'default:stone'}, | 		{'default:stone', 'technic:lv_cable0',      'default:stone'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,24 +10,18 @@ local S = technic.getter | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:geothermal', | 	output = 'technic:geothermal', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:stone', 'default:stone', 'default:stone'}, | 		{'default:stone', 'default:diamond', 'default:stone'}, | ||||||
| 		{'default:copper_ingot', 'default:diamond', 'default:copper_ingot'}, | 		{'default:copper_ingot', 'technic:machine_casing', 'default:copper_ingot'}, | ||||||
| 		{'default:stone', 'default:copper_ingot', 'default:stone'}, | 		{'default:stone', 'technic:lv_cable0', 'default:stone'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craftitem("technic:geothermal", { | minetest.register_craftitem("technic:geothermal", { | ||||||
| 	description = S("Geothermal Generator"), | 	description = S("Geothermal %s Generator"):format("LV"), | ||||||
| })  | })  | ||||||
|  |  | ||||||
| local geothermal_formspec = |  | ||||||
| 	"invsize[8,4;]".. |  | ||||||
| 	"label[0,0;"..S("Geothermal Generator").."]".. |  | ||||||
| 	"list[current_player;main;0,5;8,4;]" |  | ||||||
| 	 |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:geothermal", { | minetest.register_node("technic:geothermal", { | ||||||
| 	description = S("Geothermal Generator"), | 	description = S("Geothermal %s Generator"):format("LV"), | ||||||
| 	tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png", | 	tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png", | ||||||
| 	         "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, | 	         "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| @@ -36,14 +30,13 @@ minetest.register_node("technic:geothermal", { | |||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("Geothermal Generator")) | 		meta:set_string("infotext", S("Geothermal %s Generator"):format("LV")) | ||||||
| 		meta:set_int("LV_EU_supply", 0) | 		meta:set_int("LV_EU_supply", 0) | ||||||
| 		meta:set_string("formspec", geothermal_formspec)	 |  | ||||||
| 	end,	 | 	end,	 | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:geothermal_active", { | minetest.register_node("technic:geothermal_active", { | ||||||
| 	description = S("Geothermal Generator"), | 	description = S("Geothermal %s Generator"):format("LV"), | ||||||
| 	tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png", | 	tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png", | ||||||
| 	         "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, | 	         "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| @@ -102,17 +95,15 @@ minetest.register_abm({ | |||||||
| 			meta:set_int("LV_EU_supply", eu_supply) | 			meta:set_int("LV_EU_supply", eu_supply) | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		meta:set_string("formspec", | 		meta:set_string("infotext", | ||||||
| 			"invsize[8,4;]".. | 			S("Geothermal %s Generator"):format("LV").." ("..production_level.."%)") | ||||||
| 			"label[0,0;"..S("Geothermal Generator").."]".. |  | ||||||
| 			"label[4,0;"..S("Production at %d%%"):format(production_level).."]") |  | ||||||
|  |  | ||||||
| 		if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then | 		if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then | ||||||
| 			hacky_swap_node (pos, "technic:geothermal_active") | 			technic.swap_node (pos, "technic:geothermal_active") | ||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
| 		if production_level == 0 then | 		if production_level == 0 then | ||||||
| 			hacky_swap_node(pos, "technic:geothermal") | 			technic.swap_node(pos, "technic:geothermal") | ||||||
| 			meta:set_int("LV_EU_supply", 0) | 			meta:set_int("LV_EU_supply", 0) | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
|   | |||||||
| @@ -3,9 +3,9 @@ minetest.register_alias("grinder", "technic:grinder") | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:grinder', | 	output = 'technic:grinder', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:desert_stone', 'default:desert_stone',  'default:desert_stone'}, |  | ||||||
| 		{'default:desert_stone', 'default:diamond',        'default:desert_stone'}, | 		{'default:desert_stone', 'default:diamond',        'default:desert_stone'}, | ||||||
| 		{'default:stone',        'moreores:copper_ingot', 'default:stone'}, | 		{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'}, | ||||||
|  | 		{'default:stone',        'technic:lv_cable0',      'default:stone'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,20 +3,31 @@ technic.register_tier("LV", "Low Voltage") | |||||||
|  |  | ||||||
| local path = technic.modpath.."/machines/LV" | local path = technic.modpath.."/machines/LV" | ||||||
|  |  | ||||||
|  | -- Wiring stuff | ||||||
| dofile(path.."/cables.lua") | dofile(path.."/cables.lua") | ||||||
| dofile(path.."/battery_box.lua") | dofile(path.."/battery_box.lua") | ||||||
| dofile(path.."/alloy_furnace.lua") |  | ||||||
| dofile(path.."/coal_alloy_furnace.lua") | -- Generators | ||||||
| dofile(path.."/solar_panel.lua") | dofile(path.."/solar_panel.lua") | ||||||
| dofile(path.."/solar_array.lua") | dofile(path.."/solar_array.lua") | ||||||
| dofile(path.."/geothermal.lua") | dofile(path.."/geothermal.lua") | ||||||
| dofile(path.."/water_mill.lua") | dofile(path.."/water_mill.lua") | ||||||
| dofile(path.."/generator.lua") | dofile(path.."/generator.lua") | ||||||
|  |  | ||||||
|  | -- Coal-powered machines (TODO -> move to somewhere else?) | ||||||
|  | dofile(path.."/coal_alloy_furnace.lua") | ||||||
|  | dofile(path.."/coal_furnace.lua") | ||||||
|  |  | ||||||
|  | -- Machines | ||||||
|  | dofile(path.."/alloy_furnace.lua") | ||||||
| dofile(path.."/electric_furnace.lua") | dofile(path.."/electric_furnace.lua") | ||||||
| dofile(path.."/music_player.lua") |  | ||||||
| dofile(path.."/grinder.lua") | dofile(path.."/grinder.lua") | ||||||
|  | dofile(path.."/extractor.lua") | ||||||
|  | dofile(path.."/compressor.lua") | ||||||
|  |  | ||||||
|  | dofile(path.."/music_player.lua") | ||||||
|  |  | ||||||
| dofile(path.."/cnc.lua") | dofile(path.."/cnc.lua") | ||||||
| dofile(path.."/cnc_api.lua") | dofile(path.."/cnc_api.lua") | ||||||
| dofile(path.."/cnc_nodes.lua") | dofile(path.."/cnc_nodes.lua") | ||||||
| dofile(path.."/extractor.lua") |  | ||||||
| dofile(path.."/compressor.lua") |  | ||||||
|   | |||||||
| @@ -7,15 +7,17 @@ minetest.register_alias("music_player", "technic:music_player") | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:music_player', | 	output = 'technic:music_player', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:wood',      'group:wood',           'group:wood'}, | 		{'group:wood',      'default:diamond',        'group:wood'}, | ||||||
| 		{'default:diamond', 'default:diamond',      'default:diamond'}, | 		{'default:diamond', 'technic:machine_casing', 'default:diamond'}, | ||||||
| 		{'default:stone',   'default:copper_ingot', 'default:stone'}, | 		{'default:stone',   'technic:lv_cable0',      'default:stone'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | local music_handles = {} | ||||||
|  |  | ||||||
| local music_player_formspec = | local music_player_formspec = | ||||||
| 	"invsize[8,9;]".. | 	"invsize[8,9;]".. | ||||||
| 	"label[0,0;"..S("Music Player").."]".. | 	"label[0,0;"..S("%s Music Player"):format("LV").."]".. | ||||||
| 	"button[4,1;1,1;track1;1]".. | 	"button[4,1;1,1;track1;1]".. | ||||||
| 	"button[5,1;1,1;track2;2]".. | 	"button[5,1;1,1;track2;2]".. | ||||||
| 	"button[6,1;1,1;track3;3]".. | 	"button[6,1;1,1;track3;3]".. | ||||||
| @@ -27,24 +29,30 @@ local music_player_formspec = | |||||||
| 	"button[6,3;1,1;track9;9]".. | 	"button[6,3;1,1;track9;9]".. | ||||||
| 	"button[4,4;1,2;play;Play]".. | 	"button[4,4;1,2;play;Play]".. | ||||||
| 	"button[6,4;1,2;stop;Stop]".. | 	"button[6,4;1,2;stop;Stop]".. | ||||||
| 	"label[4,0;Current track --]" | 	"label[4,0;"..S("Current track %s"):format("--").."]" | ||||||
|  |  | ||||||
|  | local function play_track(pos, track) | ||||||
|  | 	return minetest.sound_play("technic_track"..tostring(track), | ||||||
|  | 			{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,}) | ||||||
|  | end | ||||||
|  |  | ||||||
| minetest.register_node("technic:music_player", { | minetest.register_node("technic:music_player", { | ||||||
| 	description = S("Music Player"), | 	description = S("%s Music Player"):format("LV"), | ||||||
| 	tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png", | 	tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png", | ||||||
| 	         "technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"}, | 	         "technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"}, | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("Music Player")) | 		meta:set_string("infotext", S("%s Music Player"):format("LV")) | ||||||
| 		meta:set_int("active", 0) | 		meta:set_int("active", 0) | ||||||
| 		meta:set_int("current_track", 1) | 		meta:set_int("current_track", 1) | ||||||
| 		meta:set_string("formspec", music_player_formspec) | 		meta:set_string("formspec", music_player_formspec) | ||||||
| 	end, | 	end, | ||||||
| 	on_receive_fields = function(pos, formanme, fields, sender) | 	on_receive_fields = function(pos, formanme, fields, sender) | ||||||
| 		local meta          = minetest.get_meta(pos) | 		local meta          = minetest.get_meta(pos) | ||||||
| 		local music_handle  = meta:get_int("music_handle") | 		local pos_hash      = minetest.hash_node_position(pos) | ||||||
|  | 		local music_handle  = music_handles[pos_hash] | ||||||
| 		local current_track = meta:get_int("current_track") | 		local current_track = meta:get_int("current_track") | ||||||
| 		if fields.track1 then current_track = 1 end | 		if fields.track1 then current_track = 1 end | ||||||
| 		if fields.track2 then current_track = 2 end | 		if fields.track2 then current_track = 2 end | ||||||
| @@ -58,7 +66,7 @@ minetest.register_node("technic:music_player", { | |||||||
| 		meta:set_int("current_track", current_track) | 		meta:set_int("current_track", current_track) | ||||||
| 		meta:set_string("formspec", | 		meta:set_string("formspec", | ||||||
| 				"invsize[8,9;]".. | 				"invsize[8,9;]".. | ||||||
| 				"label[0,0;"..S("Music Player").."]".. | 				"label[0,0;"..S("%s Music Player"):format("LV").."]".. | ||||||
| 				"button[4,1;1,1;track1;1]".. | 				"button[4,1;1,1;track1;1]".. | ||||||
| 				"button[5,1;1,1;track2;2]".. | 				"button[5,1;1,1;track2;2]".. | ||||||
| 				"button[6,1;1,1;track3;3]".. | 				"button[6,1;1,1;track3;3]".. | ||||||
| @@ -70,12 +78,13 @@ minetest.register_node("technic:music_player", { | |||||||
| 				"button[6,3;1,1;track9;9]".. | 				"button[6,3;1,1;track9;9]".. | ||||||
| 				"button[4,4;1,2;play;Play]".. | 				"button[4,4;1,2;play;Play]".. | ||||||
| 				"button[6,4;1,2;stop;Stop]".. | 				"button[6,4;1,2;stop;Stop]".. | ||||||
| 				"label[4,0;Current track " | 				"label[4,0;"..S("Current track %s") | ||||||
| 				..current_track.."]") | 					:format(current_track).."]") | ||||||
| 		if fields.play then | 		if fields.play then | ||||||
| 			if music_handle then | 			if music_handle then | ||||||
| 				minetest.sound_stop(music_handle) | 				minetest.sound_stop(music_handle) | ||||||
| 			end | 			end | ||||||
|  | 			music_handle = play_track(pos, current_track) | ||||||
| 			meta:set_int("active", 1) | 			meta:set_int("active", 1) | ||||||
| 		end | 		end | ||||||
| 		if fields.stop then | 		if fields.stop then | ||||||
| @@ -84,7 +93,7 @@ minetest.register_node("technic:music_player", { | |||||||
| 				minetest.sound_stop(music_handle) | 				minetest.sound_stop(music_handle) | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 		meta:set_int("music_handle", music_handle) | 		music_handles[pos_hash] = music_handle | ||||||
| 	end, | 	end, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -95,12 +104,13 @@ minetest.register_abm({ | |||||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
| 		local meta         = minetest.get_meta(pos) | 		local meta         = minetest.get_meta(pos) | ||||||
| 		local eu_input     = meta:get_int("LV_EU_input") | 		local eu_input     = meta:get_int("LV_EU_input") | ||||||
| 		local machine_name = S("Music Player") | 		local machine_name = S("%s Music Player"):format("LV") | ||||||
| 		local machine_node = "technic:music_player" | 		local machine_node = "technic:music_player" | ||||||
| 		local demand       = 150 | 		local demand       = 150 | ||||||
|  |  | ||||||
| 		local music_handle = meta:get_int("music_handle") |  | ||||||
| 		local current_track = meta:get_int("current_track") | 		local current_track = meta:get_int("current_track") | ||||||
|  | 		local pos_hash      = minetest.hash_node_position(pos) | ||||||
|  | 		local music_handle  = music_handles[pos_hash] | ||||||
|  |  | ||||||
| 		-- Setup meta data if it does not exist. | 		-- Setup meta data if it does not exist. | ||||||
| 		if not eu_input then | 		if not eu_input then | ||||||
| @@ -115,9 +125,6 @@ minetest.register_abm({ | |||||||
| 		if meta:get_int("active") == 0 then | 		if meta:get_int("active") == 0 then | ||||||
| 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | ||||||
| 			meta:set_int("LV_EU_demand", 0) | 			meta:set_int("LV_EU_demand", 0) | ||||||
| 			if music_handle then |  | ||||||
| 				minetest.sound_stop(music_handle) |  | ||||||
| 			end |  | ||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| @@ -125,13 +132,15 @@ minetest.register_abm({ | |||||||
| 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) | 			meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) | ||||||
| 			if music_handle then | 			if music_handle then | ||||||
| 				minetest.sound_stop(music_handle) | 				minetest.sound_stop(music_handle) | ||||||
|  | 				music_handle = nil | ||||||
| 			end | 			end | ||||||
| 		elseif eu_input >= demand then | 		elseif eu_input >= demand then | ||||||
| 			meta:set_string("infotext", S("%s Active"):format(machine_name)) | 			meta:set_string("infotext", S("%s Active"):format(machine_name)) | ||||||
| 			music_handle = minetest.sound_play("technic_track"..current_track, | 			if not music_handle then | ||||||
| 					{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,}) | 				music_handle = play_track(pos, current_track) | ||||||
| 			meta:set_int("music_handle", music_handle) |  | ||||||
| 			end | 			end | ||||||
|  | 		end | ||||||
|  | 		music_handles[pos_hash] = music_handle | ||||||
| 		meta:set_int("LV_EU_demand", demand) | 		meta:set_int("LV_EU_demand", demand) | ||||||
| 	end | 	end | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:solar_array_lv 1', | 	output = 'technic:solar_array_lv 1', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:solar_panel',        'technic:solar_panel',    'technic:solar_panel'}, | 		{'technic:solar_panel',        'technic:solar_panel',    'technic:solar_panel'}, | ||||||
| 		{'default:steel_ingot', 'technic:lv_transformer', 'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'}, | ||||||
| 		{'',                           'technic:lv_cable0',      ''}, | 		{'',                           'technic:lv_cable0',      ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ minetest.register_node("technic:solar_panel", { | |||||||
| 	         "technic_solar_panel_side.png", "technic_solar_panel_side.png",   "technic_solar_panel_side.png"}, | 	         "technic_solar_panel_side.png", "technic_solar_panel_side.png",   "technic_solar_panel_side.png"}, | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
|     	description = S("Solar Panel"), |     	description = S("Small Solar %s Generator"):format("LV"), | ||||||
| 	active = false, | 	active = false, | ||||||
| 	drawtype = "nodebox", | 	drawtype = "nodebox", | ||||||
| 	paramtype = "light", | 	paramtype = "light", | ||||||
| @@ -21,7 +21,7 @@ minetest.register_node("technic:solar_panel", { | |||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_int("LV_EU_supply", 0) | 		meta:set_int("LV_EU_supply", 0) | ||||||
| 		meta:set_string("infotext", S("Solar Panel")) | 		meta:set_string("infotext", S("Small Solar %s Generator"):format("LV")) | ||||||
| 	end, | 	end, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -29,7 +29,7 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:solar_panel', | 	output = 'technic:solar_panel', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'}, | 		{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'}, | ||||||
| 		{'default:steel_ingot',         'technic:lv_cable0',           'default:steel_ingot'}, | 		{'technic:wrought_iron_ingot',  'technic:lv_cable0',           'technic:wrought_iron_ingot'}, | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
| @@ -48,7 +48,7 @@ minetest.register_abm({ | |||||||
| 		-- To take care of some of it solar panels do not work outside daylight hours or if | 		-- To take care of some of it solar panels do not work outside daylight hours or if | ||||||
| 		-- built below -10m | 		-- built below -10m | ||||||
| 		local pos1 = {x=pos.x, y=pos.y+1, z=pos.z} | 		local pos1 = {x=pos.x, y=pos.y+1, z=pos.z} | ||||||
| 		local machine_name = S("Solar Panel") | 		local machine_name = S("Small Solar %s Generator"):format("LV") | ||||||
|  |  | ||||||
| 		local light = minetest.get_node_light(pos1, nil) | 		local light = minetest.get_node_light(pos1, nil) | ||||||
| 		local time_of_day = minetest.get_timeofday() | 		local time_of_day = minetest.get_timeofday() | ||||||
|   | |||||||
| @@ -9,14 +9,14 @@ minetest.register_alias("water_mill", "technic:water_mill") | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:water_mill', | 	output = 'technic:water_mill', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:stone', 'default:stone',        'default:stone'}, | 		{'default:stone', 'default:diamond',        'default:stone'}, | ||||||
| 		{'group:wood',    'default:diamond',      'group:wood'}, | 		{'group:wood',    'technic:machine_casing', 'group:wood'}, | ||||||
| 		{'default:stone', 'default:copper_ingot', 'default:stone'}, | 		{'default:stone', 'technic:lv_cable0',      'default:stone'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:water_mill", { | minetest.register_node("technic:water_mill", { | ||||||
| 	description = S("Water Mill"), | 	description = S("Hydro %s Generator"):format("LV"), | ||||||
| 	tiles = {"technic_water_mill_top.png",  "technic_machine_bottom.png", | 	tiles = {"technic_water_mill_top.png",  "technic_machine_bottom.png", | ||||||
| 	         "technic_water_mill_side.png", "technic_water_mill_side.png", | 	         "technic_water_mill_side.png", "technic_water_mill_side.png", | ||||||
| 	         "technic_water_mill_side.png", "technic_water_mill_side.png"}, | 	         "technic_water_mill_side.png", "technic_water_mill_side.png"}, | ||||||
| @@ -26,13 +26,13 @@ minetest.register_node("technic:water_mill", { | |||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("Water Mill")) | 		meta:set_string("infotext", S("Hydro %s Generator"):format("LV")) | ||||||
| 		meta:set_int("LV_EU_supply", 0) | 		meta:set_int("LV_EU_supply", 0) | ||||||
| 	end,	 | 	end,	 | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:water_mill_active", { | minetest.register_node("technic:water_mill_active", { | ||||||
| 	description = S("Water Mill"), | 	description = S("Hydro %s Generator"):format("LV"), | ||||||
| 	tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png", | 	tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png", | ||||||
| 	         "technic_water_mill_side.png",       "technic_water_mill_side.png", | 	         "technic_water_mill_side.png",       "technic_water_mill_side.png", | ||||||
| 	         "technic_water_mill_side.png",       "technic_water_mill_side.png"}, | 	         "technic_water_mill_side.png",       "technic_water_mill_side.png"}, | ||||||
| @@ -85,16 +85,16 @@ minetest.register_abm({ | |||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		meta:set_string("infotext", | 		meta:set_string("infotext", | ||||||
| 			S("Water Mill").." ("..production_level.."%)") | 			S("Hydro %s Generator"):format("LV").." ("..production_level.."%)") | ||||||
|  |  | ||||||
| 		if production_level > 0 and | 		if production_level > 0 and | ||||||
| 		   minetest.get_node(pos).name == "technic:water_mill" then | 		   minetest.get_node(pos).name == "technic:water_mill" then | ||||||
| 			hacky_swap_node (pos, "technic:water_mill_active") | 			technic.swap_node (pos, "technic:water_mill_active") | ||||||
| 			meta:set_int("LV_EU_supply", 0) | 			meta:set_int("LV_EU_supply", 0) | ||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
| 		if production_level == 0 then | 		if production_level == 0 then | ||||||
| 			hacky_swap_node(pos, "technic:water_mill") | 			technic.swap_node(pos, "technic:water_mill") | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| })  | })  | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:mv_alloy_furnace', | 	output = 'technic:mv_alloy_furnace', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'}, | ||||||
| 		{'pipeworks:tube_000000',         'technic:mv_transformer',   'pipeworks:tube_000000'}, | 		{'pipeworks:tube_1',              'technic:mv_transformer',   'pipeworks:tube_1'}, | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',        'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',        'technic:stainless_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  |  | ||||||
| technic.register_alloy_furnace({tier="MV", cook_time=4, upgrade=1, tube=1, demand={3000, 2000, 1000}}) | technic.register_alloy_furnace({tier = "MV", speed = 1.5, upgrade = 1, tube = 1, demand = {3000, 2000, 1000}}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,10 +11,12 @@ minetest.register_craft({ | |||||||
|  |  | ||||||
| technic.register_battery_box({ | technic.register_battery_box({ | ||||||
| 	tier           = "MV", | 	tier           = "MV", | ||||||
| 	max_charge     = 300000, | 	max_charge     = 200000, | ||||||
| 	charge_rate    = 20000, | 	charge_rate    = 20000, | ||||||
| 	discharge_rate = 80000, | 	discharge_rate = 80000, | ||||||
| 	charge_step    = 2000, | 	charge_step    = 2000, | ||||||
| 	discharge_step = 8000, | 	discharge_step = 8000, | ||||||
|  | 	upgrade        = 1, | ||||||
|  | 	tube           = 1, | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								technic/machines/MV/compressor.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,12 @@ | |||||||
|  | -- MV compressor | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'technic:mv_compressor', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'technic:stainless_steel_ingot', 'technic:lv_compressor',  'technic:stainless_steel_ingot'}, | ||||||
|  | 		{'pipeworks:tube_1',              'technic:mv_transformer', 'pipeworks:tube_1'}, | ||||||
|  | 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | technic.register_compressor({tier = "MV", demand = {800, 600, 400}, speed = 2, upgrade = 1, tube = 1}) | ||||||
| @@ -9,7 +9,7 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:mv_electric_furnace', | 	output = 'technic:mv_electric_furnace', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'}, | ||||||
| 		{'pipeworks:tube_000000',         'technic:mv_transformer',      'pipeworks:tube_000000'}, | 		{'pipeworks:tube_1',         'technic:mv_transformer',      'pipeworks:tube_1'}, | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',           'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',           'technic:stainless_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								technic/machines/MV/extractor.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,12 @@ | |||||||
|  | -- MV extractor | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'technic:mv_extractor', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'technic:stainless_steel_ingot', 'technic:lv_extractor',   'technic:stainless_steel_ingot'}, | ||||||
|  | 		{'pipeworks:tube_1',              'technic:mv_transformer', 'pipeworks:tube_1'}, | ||||||
|  | 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | technic.register_extractor({tier = "MV", demand = {800, 600, 400}, speed = 2, upgrade = 1, tube = 1}) | ||||||
| @@ -1,14 +1,13 @@ | |||||||
|  |  | ||||||
| minetest.register_alias("generator_mv", "technic:generator_mv") | minetest.register_alias("generator_mv", "technic:generator_mv") | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:mv_generator', | 	output = 'technic:mv_generator', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:lv_generator',   'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:lv_generator',   'technic:stainless_steel_ingot'}, | ||||||
| 		{'pipeworks:tube_000000',         'technic:mv_transformer', 'pipeworks:tube_000000'}, | 		{'pipeworks:tube_1',              'technic:mv_transformer', 'pipeworks:tube_1'}, | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:mv_cable',       'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| technic.register_generator({tier="MV", supply=600}) | technic.register_generator({tier="MV", tube=1, supply=600}) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:mv_grinder', | 	output = 'technic:mv_grinder', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:lv_grinder',     'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:lv_grinder',     'technic:stainless_steel_ingot'}, | ||||||
| 		{'pipeworks:tube_000000',         'technic:mv_transformer', 'pipeworks:tube_000000'}, | 		{'pipeworks:tube_1',         'technic:mv_transformer', 'pipeworks:tube_1'}, | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -3,20 +3,29 @@ technic.register_tier("MV", "Medium Voltage") | |||||||
|  |  | ||||||
| local path = technic.modpath.."/machines/MV" | local path = technic.modpath.."/machines/MV" | ||||||
|  |  | ||||||
| dofile(path.."/alloy_furnace.lua") | -- Wiring stuff | ||||||
| dofile(path.."/battery_box.lua") |  | ||||||
| dofile(path.."/cables.lua") | dofile(path.."/cables.lua") | ||||||
| dofile(path.."/electric_furnace.lua") | dofile(path.."/battery_box.lua") | ||||||
| dofile(path.."/grinder.lua") |  | ||||||
| dofile(path.."/solar_array.lua") | -- Generators | ||||||
| dofile(path.."/tool_workshop.lua") |  | ||||||
| if technic.config:get_bool("enable_wind_mill") then | if technic.config:get_bool("enable_wind_mill") then | ||||||
| 	dofile(path.."/wind_mill.lua") | 	dofile(path.."/wind_mill.lua") | ||||||
| end | end | ||||||
| dofile(path.."/generator.lua") | dofile(path.."/generator.lua") | ||||||
|  | dofile(path.."/solar_array.lua") | ||||||
|  |  | ||||||
|  | -- Machines | ||||||
|  | dofile(path.."/alloy_furnace.lua") | ||||||
|  | dofile(path.."/electric_furnace.lua") | ||||||
|  | dofile(path.."/grinder.lua") | ||||||
|  | dofile(path.."/extractor.lua") | ||||||
|  | dofile(path.."/compressor.lua") | ||||||
|  |  | ||||||
|  | dofile(path.."/tool_workshop.lua") | ||||||
|  |  | ||||||
| -- The power radiator supplies appliances with inductive coupled power: | -- The power radiator supplies appliances with inductive coupled power: | ||||||
| -- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric. | -- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric. | ||||||
| dofile(path.."/power_radiator.lua") | -- This is currently useless, slow, and mostly copied | ||||||
| dofile(path.."/lighting.lua") | --dofile(path.."/power_radiator.lua") | ||||||
|  | --dofile(path.."/lighting.lua") | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ end | |||||||
| technic.inductive_on_punch_off = function(pos, eu_charge, swapnode) | technic.inductive_on_punch_off = function(pos, eu_charge, swapnode) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	if meta:get_string("has_supply") ~= "" then | 	if meta:get_string("has_supply") ~= "" then | ||||||
| 		hacky_swap_node(pos, swapnode) | 		technic.swap_node(pos, swapnode) | ||||||
| 		meta:set_int("active", 1) | 		meta:set_int("active", 1) | ||||||
| 		meta:set_int("EU_charge",eu_charge) | 		meta:set_int("EU_charge",eu_charge) | ||||||
| 		--print("-----------") | 		--print("-----------") | ||||||
| @@ -56,7 +56,7 @@ end | |||||||
|  |  | ||||||
| technic.inductive_on_punch_on = function(pos, eu_charge, swapnode) | technic.inductive_on_punch_on = function(pos, eu_charge, swapnode) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	hacky_swap_node(pos, swapnode) | 	technic.swap_node(pos, swapnode) | ||||||
| 	meta:set_int("active", 0) | 	meta:set_int("active", 0) | ||||||
| 	meta:set_int("EU_charge",eu_charge) | 	meta:set_int("EU_charge",eu_charge) | ||||||
| 	--print("-----------") | 	--print("-----------") | ||||||
| @@ -82,7 +82,7 @@ local shutdown_inductive_appliances = function(pos) | |||||||
| 			local nodename = minetest.get_node(pos1).name | 			local nodename = minetest.get_node(pos1).name | ||||||
| 			-- Swap the node and make sure it is off and unpowered | 			-- Swap the node and make sure it is off and unpowered | ||||||
| 			if string.sub(nodename, -7) == "_active" then | 			if string.sub(nodename, -7) == "_active" then | ||||||
| 				hacky_swap_node(pos1, string.sub(nodename, 1, -8)) | 				technic.swap_node(pos1, string.sub(nodename, 1, -8)) | ||||||
| 				meta1:set_int("active", 0) | 				meta1:set_int("active", 0) | ||||||
| 				meta1:set_int("EU_charge", 0) | 				meta1:set_int("EU_charge", 0) | ||||||
| 			end | 			end | ||||||
| @@ -108,7 +108,7 @@ local toggle_on_off_inductive_appliances = function(pos, node, puncher) | |||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_node("technic:power_radiator", { | minetest.register_node("technic:power_radiator", { | ||||||
| 	description = "Power Radiator", | 	description = "MV Power Radiator", | ||||||
| 	tiles  = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", | 	tiles  = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", | ||||||
| 	          "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, | 	          "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, | ||||||
| 	groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, | 	groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, | ||||||
| @@ -124,7 +124,7 @@ minetest.register_node("technic:power_radiator", { | |||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_int("MV_EU_demand",1)               -- Demand on the primary side when idle | 		meta:set_int("MV_EU_demand",1)               -- Demand on the primary side when idle | ||||||
| 		meta:set_int("connected_EU_demand",0)        -- Potential demand of connected appliances | 		meta:set_int("connected_EU_demand",0)        -- Potential demand of connected appliances | ||||||
| 		meta:set_string("infotext", "Power Radiator") | 		meta:set_string("infotext", "MV Power Radiator") | ||||||
| 	end, | 	end, | ||||||
| 	on_dig = function(pos, node, digger) | 	on_dig = function(pos, node, digger) | ||||||
| 		shutdown_inductive_appliances(pos) | 		shutdown_inductive_appliances(pos) | ||||||
| @@ -138,8 +138,8 @@ minetest.register_node("technic:power_radiator", { | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:power_radiator 1', | 	output = 'technic:power_radiator 1', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'}, | ||||||
| 		{'technic:copper_coil',           'technic:mv_transformer',        'technic:copper_coil'}, | 		{'technic:copper_coil',           'technic:machine_casing', 'technic:copper_coil'}, | ||||||
| 		{'technic:rubber',                'technic:mv_cable0',      'technic:rubber'}, | 		{'technic:rubber',                'technic:mv_cable0',      'technic:rubber'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
| @@ -158,7 +158,7 @@ minetest.register_abm({ | |||||||
|  |  | ||||||
| 		if eu_input == 0 then | 		if eu_input == 0 then | ||||||
| 			-- No power | 			-- No power | ||||||
| 			meta:set_string("infotext", "Power Radiator is unpowered"); | 			meta:set_string("infotext", "MV Power Radiator is unpowered"); | ||||||
| 			-- meta:set_int("active", 1) -- used for setting textures someday maybe | 			-- meta:set_int("active", 1) -- used for setting textures someday maybe | ||||||
| 			shutdown_inductive_appliances(pos) | 			shutdown_inductive_appliances(pos) | ||||||
| 			meta:set_int("connected_EU_demand", 0) | 			meta:set_int("connected_EU_demand", 0) | ||||||
| @@ -201,7 +201,7 @@ minetest.register_abm({ | |||||||
| 					-- The appliance has power from this node. Spend power if it is on. | 					-- The appliance has power from this node. Spend power if it is on. | ||||||
| 					used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor) | 					used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor) | ||||||
| 				end | 				end | ||||||
| 				meta:set_string("infotext", "Power Radiator is powered (" | 				meta:set_string("infotext", "MV Power Radiator is powered (" | ||||||
| 					..math.floor(used_charge / max_charge * 100) | 					..math.floor(used_charge / max_charge * 100) | ||||||
| 					.."% of maximum power)"); | 					.."% of maximum power)"); | ||||||
| 				if used_charge == 0 then | 				if used_charge == 0 then | ||||||
|   | |||||||
| @@ -3,10 +3,12 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:solar_array_mv 1', | 	output = 'technic:solar_array_mv 1', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:solar_array_lv',     'technic:solar_array_lv', 'technic:solar_array_lv'}, | 		{'technic:solar_array_lv',     'technic:solar_array_lv', 'technic:solar_array_lv'}, | ||||||
| 		{'default:steel_ingot',    'technic:mv_transformer', 'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'}, | ||||||
| 		{'',                           'technic:mv_cable0',      ''}, | 		{'',                           'technic:mv_cable0',      ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| technic.register_solar_array({tier="MV", power=30}) | technic.register_solar_array({tier="MV", power=30}) | ||||||
|  |  | ||||||
|  | -- compatibility alias for upgrading from old versions of technic | ||||||
|  | minetest.register_alias("technic:solar_panel_mv", "technic:solar_array_mv") | ||||||
|   | |||||||
| @@ -8,41 +8,34 @@ local S = technic.getter | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:tool_workshop', | 	output = 'technic:tool_workshop', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:wood',    'group:wood',           'group:wood'}, |  | ||||||
| 		{'group:wood',    'default:diamond',        'group:wood'}, | 		{'group:wood',    'default:diamond',        'group:wood'}, | ||||||
| 		{'default:stone', 'default:copper_ingot', 'default:stone'}, | 		{'group:wood',    'technic:machine_casing', 'group:wood'}, | ||||||
|  | 		{'default:stone', 'technic:mv_cable0',      'default:stone'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| local workshop_formspec = | local workshop_formspec = | ||||||
| 	"invsize[8,9;]".. | 	"invsize[8,9;]".. | ||||||
| 	"list[current_name;src;3,1;1,1;]".. | 	"list[current_name;src;3,1;1,1;]".. | ||||||
| 	"label[0,0;"..S("Tool Workshop").."]".. | 	"label[0,0;"..S("%s Tool Workshop"):format("MV").."]".. | ||||||
| 	"list[current_player;main;0,5;8,4;]" | 	"list[current_player;main;0,5;8,4;]" | ||||||
|  |  | ||||||
| minetest.register_node("technic:tool_workshop", { | minetest.register_node("technic:tool_workshop", { | ||||||
| 	description = S("Tool Workshop"), | 	description = S("%s Tool Workshop"):format("MV"), | ||||||
| 	tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png", | 	tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png", | ||||||
| 	         "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"}, | 	         "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"}, | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("Tool Workshop")) | 		meta:set_string("infotext", S("%s Tool Workshop"):format("MV")) | ||||||
| 		meta:set_string("formspec", workshop_formspec) | 		meta:set_string("formspec", workshop_formspec) | ||||||
| 		local inv = meta:get_inventory() | 		local inv = meta:get_inventory() | ||||||
| 		inv:set_size("src", 1) | 		inv:set_size("src", 1) | ||||||
| 	end,	 | 	end,	 | ||||||
| 	can_dig = function(pos,player) | 	can_dig = technic.machine_can_dig, | ||||||
| 		local meta = minetest.get_meta(pos); | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 		local inv = meta:get_inventory() | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 		if not inv:is_empty("src") then |  | ||||||
| 			minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 				S("Machine cannot be removed because it is not empty")) |  | ||||||
| 			return false |  | ||||||
| 		end |  | ||||||
| 		return true |  | ||||||
| 	end, |  | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_abm({ | minetest.register_abm({ | ||||||
| @@ -53,7 +46,7 @@ minetest.register_abm({ | |||||||
| 		local meta         = minetest.get_meta(pos) | 		local meta         = minetest.get_meta(pos) | ||||||
| 		local inv          = meta:get_inventory() | 		local inv          = meta:get_inventory() | ||||||
| 		local eu_input     = meta:get_int("MV_EU_input") | 		local eu_input     = meta:get_int("MV_EU_input") | ||||||
| 		local machine_name = S("Tool Workshop") | 		local machine_name = S("%s Tool Workshop"):format("MV") | ||||||
| 		local machine_node = "technic:tool_workshop" | 		local machine_node = "technic:tool_workshop" | ||||||
| 		local demand       = 5000 | 		local demand       = 5000 | ||||||
|  |  | ||||||
| @@ -67,11 +60,18 @@ minetest.register_abm({ | |||||||
| 		-- Power off automatically if no longer connected to a switching station | 		-- Power off automatically if no longer connected to a switching station | ||||||
| 		technic.switching_station_timeout_count(pos, "MV") | 		technic.switching_station_timeout_count(pos, "MV") | ||||||
|  |  | ||||||
| 		srcstack = inv:get_stack("src", 1) | 		local repairable = false | ||||||
| 		if inv:is_empty("src") or | 		local srcstack = inv:get_stack("src", 1) | ||||||
| 		   srcstack:get_wear() == 0 or | 		if not srcstack:is_empty() then | ||||||
| 		   srcstack:get_name() == "technic:water_can" or | 			local itemdef = minetest.registered_items[srcstack:get_name()] | ||||||
| 		   srcstack:get_name() == "technic:lava_can" then | 			if itemdef and | ||||||
|  | 					(not itemdef.wear_represents or | ||||||
|  | 					itemdef.wear_represents == "mechanical_wear") and | ||||||
|  | 					srcstack:get_wear() ~= 0 then | ||||||
|  | 				repairable = true | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		if not repairable then | ||||||
| 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | 			meta:set_string("infotext", S("%s Idle"):format(machine_name)) | ||||||
| 			meta:set_int("MV_EU_demand", 0) | 			meta:set_int("MV_EU_demand", 0) | ||||||
| 			return | 			return | ||||||
|   | |||||||
| @@ -4,25 +4,25 @@ local S = technic.getter | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:wind_mill_frame 5', | 	output = 'technic:wind_mill_frame 5', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot', '',                    'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', '',                           'technic:carbon_steel_ingot'}, | ||||||
| 		{'',                    'default:steel_ingot', ''}, | 		{'',                           'technic:carbon_steel_ingot', ''}, | ||||||
| 		{'default:steel_ingot', '',                    'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', '',                           'technic:carbon_steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:wind_mill', | 	output = 'technic:wind_mill', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'',                    'default:steel_ingot', ''}, | 		{'',                           'technic:motor',              ''}, | ||||||
| 		{'default:steel_ingot', 'technic:motor',       'default:steel_ingot'}, | 		{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'}, | ||||||
| 		{'',                    'default:steelblock',  ''}, | 		{'',                           'technic:mv_cable0',          ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:wind_mill_frame", { | minetest.register_node("technic:wind_mill_frame", { | ||||||
| 	description = S("Wind Mill Frame"), | 	description = S("Wind Mill Frame"), | ||||||
| 	drawtype = "glasslike_framed", | 	drawtype = "glasslike_framed", | ||||||
| 	tiles = {"default_steel_block.png", "default_glass.png"}, | 	tiles = {"technic_carbon_steel_block.png", "default_glass.png"}, | ||||||
| 	sunlight_propagates = true, | 	sunlight_propagates = true, | ||||||
| 	groups = {cracky=3}, | 	groups = {cracky=3}, | ||||||
| 	sounds = default.node_sound_stone_defaults(), | 	sounds = default.node_sound_stone_defaults(), | ||||||
| @@ -30,8 +30,8 @@ minetest.register_node("technic:wind_mill_frame", { | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:wind_mill", { | minetest.register_node("technic:wind_mill", { | ||||||
| 	description = S("Wind Mill"), | 	description = S("Wind %s Generator"):format("MV"), | ||||||
| 	tiles = {"default_steel_block.png"}, | 	tiles = {"technic_carbon_steel_block.png"}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	groups = {cracky=1}, | 	groups = {cracky=1}, | ||||||
| 	sounds = default.node_sound_stone_defaults(), | 	sounds = default.node_sound_stone_defaults(), | ||||||
| @@ -48,7 +48,7 @@ minetest.register_node("technic:wind_mill", { | |||||||
| 	}, | 	}, | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		meta:set_string("infotext", S("Wind Mill")) | 		meta:set_string("infotext", S("Wind %s Generator"):format("MV")) | ||||||
| 		meta:set_int("MV_EU_supply", 0) | 		meta:set_int("MV_EU_supply", 0) | ||||||
| 	end,	 | 	end,	 | ||||||
| }) | }) | ||||||
| @@ -72,7 +72,7 @@ minetest.register_abm({ | |||||||
| 	chance   = 1, | 	chance   = 1, | ||||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		local machine_name = S("Wind Mill") | 		local machine_name = S("Wind %s Generator"):format("MV") | ||||||
| 		local power = math.min(pos.y * 100, 5000) | 		local power = math.min(pos.y * 100, 5000) | ||||||
|  |  | ||||||
| 		if not check_wind_mill(pos) then | 		if not check_wind_mill(pos) then | ||||||
|   | |||||||
| @@ -1,278 +1,7 @@ | |||||||
|  |  | ||||||
| minetest.register_craft({ | local S = technic.getter | ||||||
| 	type = "shapeless", |  | ||||||
| 	output = 'technic:constructor_mk1_off 1', |  | ||||||
| 	recipe = {'technic:nodebreaker_off', 'technic:deployer_off'}, |  | ||||||
|  |  | ||||||
| }) | local function deploy_node(inv, slot_name, pos1, node1, node) | ||||||
| minetest.register_craft({ |  | ||||||
| 	type = "shapeless", |  | ||||||
| 	output = 'technic:constructor_mk2_off 1', |  | ||||||
| 	recipe = {'technic:constructor_mk1_off', 'technic:constructor_mk1_off'}, |  | ||||||
|  |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	type = "shapeless", |  | ||||||
| 	output = 'technic:constructor_mk3_off 1', |  | ||||||
| 	recipe = {'technic:constructor_mk2_off', 'technic:constructor_mk2_off'}, |  | ||||||
|  |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| mk1_on = function(pos, node) |  | ||||||
| 	local meta = minetest.get_meta(pos) |  | ||||||
| 	local inv = meta:get_inventory() |  | ||||||
| 	local pos1={} |  | ||||||
| 	pos1.x=pos.x |  | ||||||
| 	pos1.y=pos.y |  | ||||||
| 	pos1.z=pos.z |  | ||||||
| 	if node.param2==3 then pos1.x=pos1.x+1 end |  | ||||||
| 	if node.param2==2 then pos1.z=pos1.z+1 end |  | ||||||
| 	if node.param2==1 then pos1.x=pos1.x-1 end |  | ||||||
| 	if node.param2==0 then pos1.z=pos1.z-1 end |  | ||||||
|  |  | ||||||
| 	if node.name == "technic:constructor_mk1_off" then |  | ||||||
| 		hacky_swap_node(pos,"technic:constructor_mk1_on") |  | ||||||
| 		nodeupdate(pos) |  | ||||||
| 		local node1=minetest.get_node(pos1) |  | ||||||
| 		deploy_node (inv,"slot1",pos1,node1,node) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| mk1_off = function(pos, node) |  | ||||||
| 	if node.name == "technic:constructor_mk1_on" then |  | ||||||
| 		hacky_swap_node(pos,"technic:constructor_mk1_off") |  | ||||||
| 		nodeupdate(pos) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:constructor_mk1_off", { |  | ||||||
| 	description = "Constructor MK1", |  | ||||||
| 	tile_images = {"technic_constructor_mk1_top_off.png","technic_constructor_mk1_bottom_off.png","technic_constructor_mk1_side2_off.png","technic_constructor_mk1_side1_off.png", |  | ||||||
| 			"technic_constructor_back.png","technic_constructor_front_off.png"}, |  | ||||||
| 	is_ground_content = true, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2}, |  | ||||||
| 	mesecons= {effector={action_on=mk1_on}}, |  | ||||||
| 	sounds = default.node_sound_stone_defaults(), |  | ||||||
| 	on_construct = function(pos) |  | ||||||
| 	local meta = minetest.get_meta(pos) |  | ||||||
| 	meta:set_string("formspec", |  | ||||||
| 				"invsize[8,9;]".. |  | ||||||
| 				"label[0,0;Constructor MK1]".. |  | ||||||
| 				"label[5,0;Slot 1]".. |  | ||||||
| 				"list[current_name;slot1;6,0;1,1;]".. |  | ||||||
| 				"list[current_player;main;0,5;8,4;]") |  | ||||||
| 		meta:set_string("infotext", "Constructor MK1") |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		inv:set_size("slot1", 1) |  | ||||||
| 	end, |  | ||||||
|  |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.get_meta(pos) |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		return inv:is_empty("slot1") |  | ||||||
| 	end,	 |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:constructor_mk1_on", { |  | ||||||
| 	description = "Constructor MK1", |  | ||||||
| 	tile_images = {"technic_constructor_mk1_top_on.png","technic_constructor_mk1_bottom_on.png","technic_constructor_mk1_side2_on.png","technic_constructor_mk1_side1_on.png", |  | ||||||
| 			"technic_constructor_back.png","technic_constructor_front_on.png"}, |  | ||||||
| 	is_ground_content = true, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon = 2,not_in_creative_inventory=1}, |  | ||||||
| 	mesecons= {effector={action_off=mk1_off}}, |  | ||||||
| 	sounds = default.node_sound_stone_defaults(), |  | ||||||
| }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| --Constructor MK2 |  | ||||||
|  |  | ||||||
| mk2_on = function(pos, node) |  | ||||||
| 	local meta = minetest.get_meta(pos) |  | ||||||
| 	local inv = meta:get_inventory() |  | ||||||
| 	local pos1={} |  | ||||||
| 	local pos2={} |  | ||||||
| 	pos1.x=pos.x |  | ||||||
| 	pos1.y=pos.y |  | ||||||
| 	pos1.z=pos.z |  | ||||||
| 	pos2.x=pos.x |  | ||||||
| 	pos2.y=pos.y |  | ||||||
| 	pos2.z=pos.z |  | ||||||
| 	if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 end |  | ||||||
| 	if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 end |  | ||||||
| 	if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 end |  | ||||||
| 	if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 end |  | ||||||
|  |  | ||||||
| 	if node.name == "technic:constructor_mk2_off" then |  | ||||||
| 		hacky_swap_node(pos,"technic:constructor_mk2_on") |  | ||||||
| 		nodeupdate(pos) |  | ||||||
| 		local node1=minetest.get_node(pos1) |  | ||||||
| 		deploy_node (inv,"slot1",pos1,node1,node) |  | ||||||
| 		local node1=minetest.get_node(pos2)	 |  | ||||||
| 		deploy_node (inv,"slot2",pos2,node1,node) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| mk2_off = function(pos, node) |  | ||||||
| 	if node.name == "technic:constructor_mk2_on" then |  | ||||||
| 		hacky_swap_node(pos,"technic:constructor_mk2_off") |  | ||||||
| 		nodeupdate(pos) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:constructor_mk2_off", { |  | ||||||
| 	description = "Constructor MK2", |  | ||||||
| 	tile_images = {"technic_constructor_mk2_top_off.png","technic_constructor_mk2_bottom_off.png","technic_constructor_mk2_side2_off.png","technic_constructor_mk2_side1_off.png", |  | ||||||
| 			"technic_constructor_back.png","technic_constructor_front_off.png"}, |  | ||||||
| 	is_ground_content = true, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2}, |  | ||||||
| 	mesecons= {effector={action_on=mk2_on}}, |  | ||||||
| 	sounds = default.node_sound_stone_defaults(), |  | ||||||
| 	on_construct = function(pos) |  | ||||||
| 	local meta = minetest.get_meta(pos) |  | ||||||
| 	meta:set_string("formspec", |  | ||||||
| 				"invsize[8,9;]".. |  | ||||||
| 				"label[0,0;Constructor MK2]".. |  | ||||||
| 				"label[5,0;Slot 1]".. |  | ||||||
| 				"list[current_name;slot1;6,0;1,1;]".. |  | ||||||
| 				"label[5,1;Slot 2]".. |  | ||||||
| 				"list[current_name;slot2;6,1;1,1;]".. |  | ||||||
| 				"list[current_player;main;0,5;8,4;]") |  | ||||||
| 		meta:set_string("infotext", "Constructor MK2") |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		inv:set_size("slot1", 1) |  | ||||||
| 		inv:set_size("slot2", 1) |  | ||||||
| 	end, |  | ||||||
|  |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.get_meta(pos) |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false then return false end |  | ||||||
| 		return true |  | ||||||
| 	end,	 |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:constructor_mk2_on", { |  | ||||||
| 	description = "Constructor MK2", |  | ||||||
| 	tile_images = {"technic_constructor_mk2_top_on.png","technic_constructor_mk2_bottom_on.png","technic_constructor_mk2_side2_on.png","technic_constructor_mk2_side1_on.png", |  | ||||||
| 			"technic_constructor_back.png","technic_constructor_front_on.png"}, |  | ||||||
| 	is_ground_content = true, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2, not_in_creative_inventory=1}, |  | ||||||
| 	mesecons= {effector={action_off=mk2_off}}, |  | ||||||
| 	sounds = default.node_sound_stone_defaults(), |  | ||||||
| }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Constructor MK3 |  | ||||||
| mk3_on = function(pos, node) |  | ||||||
| 	local meta = minetest.get_meta(pos) |  | ||||||
| 	local inv = meta:get_inventory() |  | ||||||
| 	 |  | ||||||
| 	local pos1={} |  | ||||||
| 	local pos2={} |  | ||||||
| 	local pos3={} |  | ||||||
| 	local pos4={} |  | ||||||
| 	 |  | ||||||
| 	pos1.x=pos.x |  | ||||||
| 	pos1.y=pos.y |  | ||||||
| 	pos1.z=pos.z |  | ||||||
| 	 |  | ||||||
| 	pos2.x=pos.x |  | ||||||
| 	pos2.y=pos.y |  | ||||||
| 	pos2.z=pos.z |  | ||||||
| 	 |  | ||||||
| 	pos3.x=pos.x |  | ||||||
| 	pos3.y=pos.y |  | ||||||
| 	pos3.z=pos.z |  | ||||||
|  |  | ||||||
| 	pos4.x=pos.x |  | ||||||
| 	pos4.y=pos.y |  | ||||||
| 	pos4.z=pos.z |  | ||||||
|  |  | ||||||
| 	if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 pos3.x=pos3.x+3 pos4.x=pos4.x+4 end |  | ||||||
| 	if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 pos3.z=pos3.z+3 pos4.z=pos4.z+4 end |  | ||||||
| 	if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 pos3.x=pos3.x-3 pos4.x=pos4.x-4 end |  | ||||||
| 	if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 pos3.z=pos3.z-3 pos4.z=pos4.z-4 end |  | ||||||
|  |  | ||||||
| 	if node.name == "technic:constructor_mk3_off" then |  | ||||||
| 		hacky_swap_node(pos,"technic:constructor_mk3_on") |  | ||||||
| 		nodeupdate(pos) |  | ||||||
| 		local node1=minetest.get_node(pos1) |  | ||||||
| 		deploy_node (inv,"slot1",pos1,node1,node) |  | ||||||
| 		local node1=minetest.get_node(pos2)	 |  | ||||||
| 		deploy_node (inv,"slot2",pos2,node1,node) |  | ||||||
| 		local node1=minetest.get_node(pos3)	 |  | ||||||
| 		deploy_node (inv,"slot3",pos3,node1,node) |  | ||||||
| 		local node1=minetest.get_node(pos4)	 |  | ||||||
| 		deploy_node (inv,"slot4",pos4,node1,node) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| mk3_off = function(pos, node) |  | ||||||
| 	if node.name == "technic:constructor_mk3_on" then |  | ||||||
| 		hacky_swap_node(pos,"technic:constructor_mk3_off") |  | ||||||
| 		nodeupdate(pos) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:constructor_mk3_off", { |  | ||||||
| 	description = "Constructor MK3", |  | ||||||
| 	tile_images = {"technic_constructor_mk3_top_off.png","technic_constructor_mk3_bottom_off.png","technic_constructor_mk3_side2_off.png","technic_constructor_mk3_side1_off.png", |  | ||||||
| 			"technic_constructor_back.png","technic_constructor_front_off.png"}, |  | ||||||
| 	is_ground_content = true, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2}, |  | ||||||
| 	mesecons= {effector={action_on=mk3_on}}, |  | ||||||
| 	sounds = default.node_sound_stone_defaults(), |  | ||||||
| 	on_construct = function(pos) |  | ||||||
| 	local meta = minetest.get_meta(pos) |  | ||||||
| 	meta:set_string("formspec", |  | ||||||
| 				"invsize[8,9;]".. |  | ||||||
| 				"label[0,0;Constructor MK2]".. |  | ||||||
| 				"label[5,0;Slot 1]".. |  | ||||||
| 				"list[current_name;slot1;6,0;1,1;]".. |  | ||||||
| 				"label[5,1;Slot 2]".. |  | ||||||
| 				"list[current_name;slot2;6,1;1,1;]".. |  | ||||||
| 				"label[5,2;Slot 3]".. |  | ||||||
| 				"list[current_name;slot3;6,2;1,1;]".. |  | ||||||
| 				"label[5,3;Slot 4]".. |  | ||||||
| 				"list[current_name;slot4;6,3;1,1;]".. |  | ||||||
| 				"list[current_player;main;0,5;8,4;]") |  | ||||||
| 		meta:set_string("infotext", "Constructor MK3") |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		inv:set_size("slot1", 1) |  | ||||||
| 		inv:set_size("slot2", 1) |  | ||||||
| 		inv:set_size("slot3", 1) |  | ||||||
| 		inv:set_size("slot4", 1) |  | ||||||
|  |  | ||||||
| 	end, |  | ||||||
|  |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.get_meta(pos) |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false or inv:is_empty("slot3")==false or inv:is_empty("slot4")==false then return false end |  | ||||||
| 		return true |  | ||||||
| 	end,	 |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:constructor_mk3_on", { |  | ||||||
| 	description = "Constructor MK3", |  | ||||||
| 	tile_images = {"technic_constructor_mk3_top_on.png","technic_constructor_mk3_bottom_on.png","technic_constructor_mk3_side2_on.png","technic_constructor_mk3_side1_on.png", |  | ||||||
| 			"technic_constructor_back.png","technic_constructor_front_on.png"}, |  | ||||||
| 	is_ground_content = true, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,not_in_creative_inventory=1}, |  | ||||||
| 	mesecons= {effector={action_off=mk3_off}}, |  | ||||||
| 	sounds = default.node_sound_stone_defaults(), |  | ||||||
| }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| deploy_node =function (inv, slot_name, pos1, node1, node) |  | ||||||
| 	if node1.name == "air" then  | 	if node1.name == "air" then  | ||||||
| 		if not inv:is_empty(slot_name) then | 		if not inv:is_empty(slot_name) then | ||||||
| 			stack1=inv:get_list(slot_name) | 			stack1=inv:get_list(slot_name) | ||||||
| @@ -342,3 +71,294 @@ deploy_node =function (inv, slot_name, pos1, node1, node) | |||||||
| 	end | 	end | ||||||
|  |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "shapeless", | ||||||
|  | 	output = 'technic:constructor_mk1_off 1', | ||||||
|  | 	recipe = {'technic:nodebreaker_off', 'technic:deployer_off'}, | ||||||
|  |  | ||||||
|  | }) | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "shapeless", | ||||||
|  | 	output = 'technic:constructor_mk2_off 1', | ||||||
|  | 	recipe = {'technic:constructor_mk1_off', 'technic:constructor_mk1_off'}, | ||||||
|  |  | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "shapeless", | ||||||
|  | 	output = 'technic:constructor_mk3_off 1', | ||||||
|  | 	recipe = {'technic:constructor_mk2_off', 'technic:constructor_mk2_off'}, | ||||||
|  |  | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | local function mk1_on(pos, node) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	local pos1={} | ||||||
|  | 	pos1.x=pos.x | ||||||
|  | 	pos1.y=pos.y | ||||||
|  | 	pos1.z=pos.z | ||||||
|  | 	if node.param2==3 then pos1.x=pos1.x+1 end | ||||||
|  | 	if node.param2==2 then pos1.z=pos1.z+1 end | ||||||
|  | 	if node.param2==1 then pos1.x=pos1.x-1 end | ||||||
|  | 	if node.param2==0 then pos1.z=pos1.z-1 end | ||||||
|  |  | ||||||
|  | 	if node.name == "technic:constructor_mk1_off" then | ||||||
|  | 		technic.swap_node(pos,"technic:constructor_mk1_on") | ||||||
|  | 		nodeupdate(pos) | ||||||
|  | 		local node1=minetest.get_node(pos1) | ||||||
|  | 		deploy_node (inv,"slot1",pos1,node1,node) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function mk1_off(pos, node) | ||||||
|  | 	if node.name == "technic:constructor_mk1_on" then | ||||||
|  | 		technic.swap_node(pos,"technic:constructor_mk1_off") | ||||||
|  | 		nodeupdate(pos) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:constructor_mk1_off", { | ||||||
|  | 	description = S("Constructor Mk%d"):format(1), | ||||||
|  | 	tile_images = {"technic_constructor_mk1_top_off.png","technic_constructor_mk1_bottom_off.png","technic_constructor_mk1_side2_off.png","technic_constructor_mk1_side1_off.png", | ||||||
|  | 			"technic_constructor_back.png","technic_constructor_front_off.png"}, | ||||||
|  | 	is_ground_content = true, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2}, | ||||||
|  | 	mesecons= {effector={action_on=mk1_on}}, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	on_construct = function(pos) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	meta:set_string("formspec", | ||||||
|  | 				"invsize[8,9;]".. | ||||||
|  | 				"label[0,0;"..S("Constructor Mk%d"):format(1).."]".. | ||||||
|  | 				"label[5,0;"..S("Slot %d"):format(1).."]".. | ||||||
|  | 				"list[current_name;slot1;6,0;1,1;]".. | ||||||
|  | 				"list[current_player;main;0,5;8,4;]") | ||||||
|  | 		meta:set_string("infotext", S("Constructor Mk%d"):format(1)) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		inv:set_size("slot1", 1) | ||||||
|  | 	end, | ||||||
|  |  | ||||||
|  | 	can_dig = function(pos,player) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		return inv:is_empty("slot1") | ||||||
|  | 	end,	 | ||||||
|  | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:constructor_mk1_on", { | ||||||
|  | 	description = S("Constructor Mk%d"):format(1), | ||||||
|  | 	tile_images = {"technic_constructor_mk1_top_on.png","technic_constructor_mk1_bottom_on.png","technic_constructor_mk1_side2_on.png","technic_constructor_mk1_side1_on.png", | ||||||
|  | 			"technic_constructor_back.png","technic_constructor_front_on.png"}, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	drop = "technic:constructor_mk1_off", | ||||||
|  | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon = 2,not_in_creative_inventory=1}, | ||||||
|  | 	mesecons= {effector={action_off=mk1_off}}, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | --Constructor Mk2 | ||||||
|  |  | ||||||
|  | local function mk2_on(pos, node) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	local pos1={} | ||||||
|  | 	local pos2={} | ||||||
|  | 	pos1.x=pos.x | ||||||
|  | 	pos1.y=pos.y | ||||||
|  | 	pos1.z=pos.z | ||||||
|  | 	pos2.x=pos.x | ||||||
|  | 	pos2.y=pos.y | ||||||
|  | 	pos2.z=pos.z | ||||||
|  | 	if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 end | ||||||
|  | 	if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 end | ||||||
|  | 	if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 end | ||||||
|  | 	if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 end | ||||||
|  |  | ||||||
|  | 	if node.name == "technic:constructor_mk2_off" then | ||||||
|  | 		technic.swap_node(pos,"technic:constructor_mk2_on") | ||||||
|  | 		nodeupdate(pos) | ||||||
|  | 		local node1=minetest.get_node(pos1) | ||||||
|  | 		deploy_node (inv,"slot1",pos1,node1,node) | ||||||
|  | 		local node1=minetest.get_node(pos2)	 | ||||||
|  | 		deploy_node (inv,"slot2",pos2,node1,node) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function mk2_off(pos, node) | ||||||
|  | 	if node.name == "technic:constructor_mk2_on" then | ||||||
|  | 		technic.swap_node(pos,"technic:constructor_mk2_off") | ||||||
|  | 		nodeupdate(pos) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:constructor_mk2_off", { | ||||||
|  | 	description = S("Constructor Mk%d"):format(2), | ||||||
|  | 	tile_images = {"technic_constructor_mk2_top_off.png","technic_constructor_mk2_bottom_off.png","technic_constructor_mk2_side2_off.png","technic_constructor_mk2_side1_off.png", | ||||||
|  | 			"technic_constructor_back.png","technic_constructor_front_off.png"}, | ||||||
|  | 	is_ground_content = true, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2}, | ||||||
|  | 	mesecons= {effector={action_on=mk2_on}}, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	on_construct = function(pos) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	meta:set_string("formspec", | ||||||
|  | 				"invsize[8,9;]".. | ||||||
|  | 				"label[0,0;"..S("Constructor Mk%d"):format(2).."]".. | ||||||
|  | 				"label[5,0;"..S("Slot %d"):format(1).."]".. | ||||||
|  | 				"list[current_name;slot1;6,0;1,1;]".. | ||||||
|  | 				"label[5,1;"..S("Slot %d"):format(2).."]".. | ||||||
|  | 				"list[current_name;slot2;6,1;1,1;]".. | ||||||
|  | 				"list[current_player;main;0,5;8,4;]") | ||||||
|  | 		meta:set_string("infotext", S("Constructor Mk%d"):format(2)) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		inv:set_size("slot1", 1) | ||||||
|  | 		inv:set_size("slot2", 1) | ||||||
|  | 	end, | ||||||
|  | 	can_dig = function(pos,player) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false then return false end | ||||||
|  | 		return true | ||||||
|  | 	end, | ||||||
|  | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:constructor_mk2_on", { | ||||||
|  | 	description = S("Constructor Mk%d"):format(2), | ||||||
|  | 	tile_images = {"technic_constructor_mk2_top_on.png","technic_constructor_mk2_bottom_on.png","technic_constructor_mk2_side2_on.png","technic_constructor_mk2_side1_on.png", | ||||||
|  | 			"technic_constructor_back.png","technic_constructor_front_on.png"}, | ||||||
|  | 	is_ground_content = true, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	drop = "technic:constructor_mk2_off", | ||||||
|  | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2, not_in_creative_inventory=1}, | ||||||
|  | 	mesecons = {effector={action_off=mk2_off}}, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | -- Constructor Mk3 | ||||||
|  | local function mk3_on(pos, node) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	 | ||||||
|  | 	local pos1={} | ||||||
|  | 	local pos2={} | ||||||
|  | 	local pos3={} | ||||||
|  | 	local pos4={} | ||||||
|  | 	 | ||||||
|  | 	pos1.x=pos.x | ||||||
|  | 	pos1.y=pos.y | ||||||
|  | 	pos1.z=pos.z | ||||||
|  | 	 | ||||||
|  | 	pos2.x=pos.x | ||||||
|  | 	pos2.y=pos.y | ||||||
|  | 	pos2.z=pos.z | ||||||
|  | 	 | ||||||
|  | 	pos3.x=pos.x | ||||||
|  | 	pos3.y=pos.y | ||||||
|  | 	pos3.z=pos.z | ||||||
|  |  | ||||||
|  | 	pos4.x=pos.x | ||||||
|  | 	pos4.y=pos.y | ||||||
|  | 	pos4.z=pos.z | ||||||
|  |  | ||||||
|  | 	if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 pos3.x=pos3.x+3 pos4.x=pos4.x+4 end | ||||||
|  | 	if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 pos3.z=pos3.z+3 pos4.z=pos4.z+4 end | ||||||
|  | 	if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 pos3.x=pos3.x-3 pos4.x=pos4.x-4 end | ||||||
|  | 	if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 pos3.z=pos3.z-3 pos4.z=pos4.z-4 end | ||||||
|  |  | ||||||
|  | 	if node.name == "technic:constructor_mk3_off" then | ||||||
|  | 		technic.swap_node(pos,"technic:constructor_mk3_on") | ||||||
|  | 		nodeupdate(pos) | ||||||
|  | 		local node1=minetest.get_node(pos1) | ||||||
|  | 		deploy_node (inv,"slot1",pos1,node1,node) | ||||||
|  | 		local node1=minetest.get_node(pos2)	 | ||||||
|  | 		deploy_node (inv,"slot2",pos2,node1,node) | ||||||
|  | 		local node1=minetest.get_node(pos3)	 | ||||||
|  | 		deploy_node (inv,"slot3",pos3,node1,node) | ||||||
|  | 		local node1=minetest.get_node(pos4)	 | ||||||
|  | 		deploy_node (inv,"slot4",pos4,node1,node) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function mk3_off(pos, node) | ||||||
|  | 	if node.name == "technic:constructor_mk3_on" then | ||||||
|  | 		technic.swap_node(pos,"technic:constructor_mk3_off") | ||||||
|  | 		nodeupdate(pos) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:constructor_mk3_off", { | ||||||
|  | 	description = S("Constructor Mk%d"):format(3), | ||||||
|  | 	tile_images = {"technic_constructor_mk3_top_off.png","technic_constructor_mk3_bottom_off.png","technic_constructor_mk3_side2_off.png","technic_constructor_mk3_side1_off.png", | ||||||
|  | 			"technic_constructor_back.png","technic_constructor_front_off.png"}, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2}, | ||||||
|  | 	mesecons = {effector={action_on=mk3_on}}, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	on_construct = function(pos) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	meta:set_string("formspec", | ||||||
|  | 				"invsize[8,9;]".. | ||||||
|  | 				"label[0,0;"..S("Constructor Mk%d"):format(3).."]".. | ||||||
|  | 				"label[5,0;"..S("Slot %d"):format(1).."]".. | ||||||
|  | 				"list[current_name;slot1;6,0;1,1;]".. | ||||||
|  | 				"label[5,1;"..S("Slot %d"):format(2).."]".. | ||||||
|  | 				"list[current_name;slot2;6,1;1,1;]".. | ||||||
|  | 				"label[5,2;"..S("Slot %d"):format(3).."]".. | ||||||
|  | 				"list[current_name;slot3;6,2;1,1;]".. | ||||||
|  | 				"label[5,3;"..S("Slot %d"):format(4).."]".. | ||||||
|  | 				"list[current_name;slot4;6,3;1,1;]".. | ||||||
|  | 				"list[current_player;main;0,5;8,4;]") | ||||||
|  | 		meta:set_string("infotext", S("Constructor Mk%d"):format(3)) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		inv:set_size("slot1", 1) | ||||||
|  | 		inv:set_size("slot2", 1) | ||||||
|  | 		inv:set_size("slot3", 1) | ||||||
|  | 		inv:set_size("slot4", 1) | ||||||
|  |  | ||||||
|  | 	end, | ||||||
|  |  | ||||||
|  | 	can_dig = function(pos,player) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false or inv:is_empty("slot3")==false or inv:is_empty("slot4")==false then return false end | ||||||
|  | 		return true | ||||||
|  | 	end,	 | ||||||
|  | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:constructor_mk3_on", { | ||||||
|  | 	description = S("Constructor Mk%d"):format(3), | ||||||
|  | 	tile_images = {"technic_constructor_mk3_top_on.png","technic_constructor_mk3_bottom_on.png","technic_constructor_mk3_side2_on.png","technic_constructor_mk3_side1_on.png", | ||||||
|  | 			"technic_constructor_back.png","technic_constructor_front_on.png"}, | ||||||
|  | 	is_ground_content = true, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	drop = "technic:constructor_mk3_off", | ||||||
|  | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,not_in_creative_inventory=1}, | ||||||
|  | 	mesecons = {effector={action_off=mk3_off}}, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
| frames = {} | frames = {} | ||||||
|  |  | ||||||
| local infinite_stacks = minetest.setting_getbool("creative_mode") and minetest.get_modpath("unified_inventory") == nil | local infinite_stacks = minetest.setting_getbool("creative_mode") and minetest.get_modpath("unified_inventory") == nil | ||||||
| @@ -44,7 +47,7 @@ local function get_face(pos,ppos,pvect) | |||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| function lines(str) | local function lines(str) | ||||||
| 	local t = {} | 	local t = {} | ||||||
| 	local function helper(line) table.insert(t, line) return "" end | 	local function helper(line) table.insert(t, line) return "" end | ||||||
| 	helper((str:gsub("(.-)\r?\n", helper))) | 	helper((str:gsub("(.-)\r?\n", helper))) | ||||||
| @@ -204,7 +207,7 @@ local nodeboxes= { | |||||||
| 	 | 	 | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:frame_"..nameext,{ | 	minetest.register_node("technic:frame_"..nameext,{ | ||||||
| 		description = "Frame", | 		description = S("Frame"), | ||||||
| 		tiles = {"technic_frame.png"}, | 		tiles = {"technic_frame.png"}, | ||||||
| 		groups=groups, | 		groups=groups, | ||||||
| 		drawtype = "nodebox", | 		drawtype = "nodebox", | ||||||
| @@ -539,15 +542,19 @@ local function frame_motor_on(pos, node) | |||||||
| 		nnode.name = frames_pos[pos_to_string(nnodepos)] | 		nnode.name = frames_pos[pos_to_string(nnodepos)] | ||||||
| 	end | 	end | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	if meta:get_int("last_moved") == minetest.get_gametime() then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
| 	local owner = meta:get_string("owner") | 	local owner = meta:get_string("owner") | ||||||
| 	if minetest.registered_nodes[nnode.name].frame==1 then | 	if minetest.registered_nodes[nnode.name].frame==1 then | ||||||
| 		local connected_nodes=get_connected_nodes(nnodepos) | 		local connected_nodes=get_connected_nodes(nnodepos) | ||||||
| 		move_nodes_vect(connected_nodes,dir,pos,owner) | 		move_nodes_vect(connected_nodes,dir,pos,owner) | ||||||
| 	end | 	end | ||||||
|  | 	minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime()) | ||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_node("technic:frame_motor",{ | minetest.register_node("technic:frame_motor",{ | ||||||
| 	description = "Frame motor", | 	description = S("Frame Motor"), | ||||||
| 	tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", | 	tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", | ||||||
| 		"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, | 		"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, | ||||||
| @@ -600,7 +607,7 @@ local function swap_template(pos, new) | |||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	local saved_node = meta:get_string("saved_node") | 	local saved_node = meta:get_string("saved_node") | ||||||
| 	meta:set_string("saved_node", "") | 	meta:set_string("saved_node", "") | ||||||
| 	hacky_swap_node(pos, new) | 	technic.swap_node(pos, new) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	meta:set_string("saved_node", saved_node) | 	meta:set_string("saved_node", saved_node) | ||||||
| end | end | ||||||
| @@ -738,7 +745,7 @@ local function template_on_destruct(pos, node) | |||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_node("technic:template",{ | minetest.register_node("technic:template",{ | ||||||
| 	description = "Template", | 	description = S("Template"), | ||||||
| 	tiles = {"technic_mv_cable.png"}, | 	tiles = {"technic_mv_cable.png"}, | ||||||
| 	drop = "", | 	drop = "", | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, | ||||||
| @@ -750,7 +757,7 @@ minetest.register_node("technic:template",{ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:template_disabled",{ | minetest.register_node("technic:template_disabled",{ | ||||||
| 	description = "Template", | 	description = S("Template"), | ||||||
| 	tiles = {"technic_hv_cable.png"}, | 	tiles = {"technic_hv_cable.png"}, | ||||||
| 	drop = "", | 	drop = "", | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, | ||||||
| @@ -763,7 +770,7 @@ minetest.register_node("technic:template_disabled",{ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_node("technic:template_connector",{ | minetest.register_node("technic:template_connector",{ | ||||||
| 	description = "Template", | 	description = S("Template"), | ||||||
| 	tiles = {"technic_lv_cable.png"}, | 	tiles = {"technic_lv_cable.png"}, | ||||||
| 	drop = "", | 	drop = "", | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, | ||||||
| @@ -775,7 +782,7 @@ minetest.register_node("technic:template_connector",{ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craftitem("technic:template_replacer",{ | minetest.register_craftitem("technic:template_replacer",{ | ||||||
| 	description = "Template (replacing)", | 	description = S("Template (replacing)"), | ||||||
| 	inventory_image = "technic_template_replacer.png", | 	inventory_image = "technic_template_replacer.png", | ||||||
| 	on_place = function(itemstack, placer, pointed_thing) | 	on_place = function(itemstack, placer, pointed_thing) | ||||||
| 		local p = pointed_thing.under | 		local p = pointed_thing.under | ||||||
| @@ -795,11 +802,11 @@ minetest.register_craftitem("technic:template_replacer",{ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_tool("technic:template_tool",{ | minetest.register_tool("technic:template_tool",{ | ||||||
| 	description = "Template tool", | 	description = S("Template Tool"), | ||||||
| 	inventory_image = "technic_template_tool.png", | 	inventory_image = "technic_template_tool.png", | ||||||
| 	on_use = function(itemstack, puncher, pointed_thing) | 	on_use = function(itemstack, puncher, pointed_thing) | ||||||
| 		local pos = pointed_thing.under | 		local pos = pointed_thing.under | ||||||
| 		if pos == nil or (minetest.is_protected and minetest.is_protected(pos, placer:get_player_name())) then | 		if pos == nil or (minetest.is_protected and minetest.is_protected(pos, puncher:get_player_name())) then | ||||||
| 			return nil | 			return nil | ||||||
| 		end | 		end | ||||||
| 		local node = minetest.get_node(pos) | 		local node = minetest.get_node(pos) | ||||||
| @@ -840,15 +847,19 @@ local function template_motor_on(pos, node) | |||||||
| 	local dir = minetest.facedir_to_dir(node.param2) | 	local dir = minetest.facedir_to_dir(node.param2) | ||||||
| 	local nnode=minetest.get_node(nnodepos) | 	local nnode=minetest.get_node(nnodepos) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	if meta:get_int("last_moved") == minetest.get_gametime() then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
| 	local owner = meta:get_string("owner") | 	local owner = meta:get_string("owner") | ||||||
| 	if nnode.name == "technic:template" then | 	if nnode.name == "technic:template" then | ||||||
| 		local connected_nodes=get_template_nodes(nnodepos) | 		local connected_nodes=get_template_nodes(nnodepos) | ||||||
| 		move_nodes_vect(connected_nodes,dir,pos,owner) | 		move_nodes_vect(connected_nodes,dir,pos,owner) | ||||||
| 	end | 	end | ||||||
|  | 	minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime()) | ||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_node("technic:template_motor",{ | minetest.register_node("technic:template_motor",{ | ||||||
| 	description = "Template motor", | 	description = S("Template Motor"), | ||||||
| 	tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", | 	tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", | ||||||
| 		"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, | 		"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, | ||||||
| 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, | 	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, | ||||||
| @@ -874,7 +885,7 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:frame_motor', | 	output = 'technic:frame_motor', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'',					'technic:frame_111111',	''}, | 		{'',					'technic:frame_111111',	''}, | ||||||
| 		{'group:mesecons_conductor_craftable',	'technic:motor',	'group:mesecons_conductor_craftable'}, | 		{'group:mesecon_conductor_craftable',	'technic:motor',	'group:mesecon_conductor_craftable'}, | ||||||
| 		{'',					'technic:frame_111111',	''}, | 		{'',					'technic:frame_111111',	''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
| @@ -902,7 +913,7 @@ minetest.register_craft({ | |||||||
| 	output = 'technic:template_motor', | 	output = 'technic:template_motor', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'',					'technic:template',	''}, | 		{'',					'technic:template',	''}, | ||||||
| 		{'group:mesecons_conductor_craftable',	'technic:motor',	'group:mesecons_conductor_craftable'}, | 		{'group:mesecon_conductor_craftable',	'technic:motor',	'group:mesecon_conductor_craftable'}, | ||||||
| 		{'',					'technic:template',	''}, | 		{'',					'technic:template',	''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -1,78 +1,7 @@ | |||||||
| minetest.register_craftitem("technic:injector", { |  | ||||||
| 	description = "Injector", |  | ||||||
| 	stack_max = 99, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craft({ | local S = technic.getter | ||||||
| 	output = 'technic:injector 1', |  | ||||||
| 	recipe = { |  | ||||||
| 		{'', 'technic:control_logic_unit',''}, |  | ||||||
| 		{'', 'default:chest',''}, |  | ||||||
| 		{'', 'pipeworks:tube_000000',''}, |  | ||||||
| 	} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_node("technic:injector", { | local function inject_items (pos) | ||||||
| 	description = "Injector", |  | ||||||
| 	tiles = {"technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png", |  | ||||||
| 		"technic_injector_side.png", "technic_injector_side.png", "technic_injector_side.png"}, |  | ||||||
| 	groups = chest_groups1, |  | ||||||
| 	tube = tubes_properties, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	on_construct = function(pos) |  | ||||||
| 		local meta = minetest.env:get_meta(pos) |  | ||||||
| 		meta:set_string("formspec", |  | ||||||
| 				"invsize[8,9;]".. |  | ||||||
| 				"label[0,0;Injector]".. |  | ||||||
| 				"button[0,1;.8,.8;mode;]".. |  | ||||||
| 				"label[.8,1;Mode: single items]".. |  | ||||||
| 				"list[current_name;main;0,2;8,2;]".. |  | ||||||
| 				"list[current_player;main;0,5;8,4;]") |  | ||||||
| 		meta:set_string("infotext", "Injector") |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		inv:set_size("main", 8*4) |  | ||||||
| 		meta:set_string("mode","single items") |  | ||||||
| 	end, |  | ||||||
| 	can_dig = function(pos,player) |  | ||||||
| 		local meta = minetest.env:get_meta(pos); |  | ||||||
| 		local inv = meta:get_inventory() |  | ||||||
| 		return inv:is_empty("main") |  | ||||||
| 	end, |  | ||||||
| 	on_receive_fields = function(pos, formanme, fields, sender) |  | ||||||
| 	local meta = minetest.env:get_meta(pos) |  | ||||||
| 	local mode=meta:get_string("mode") |  | ||||||
| 	if fields.mode then  |  | ||||||
| 		if mode=="single items" then mode="whole stacks"  |  | ||||||
| 		 else mode="single items" |  | ||||||
| 		end |  | ||||||
| 	local mode=meta:set_string("mode",mode) |  | ||||||
| 	end |  | ||||||
| 	meta:set_string("formspec", |  | ||||||
| 				"invsize[8,9;]".. |  | ||||||
| 				"label[0,0;Injector]".. |  | ||||||
| 				"button[0,1;.8,.8;mode;]".. |  | ||||||
| 				"label[.8,1;Mode: "..mode.."]".. |  | ||||||
| 				"list[current_name;main;0,2;8,2;]".. |  | ||||||
| 				"list[current_player;main;0,5;8,4;]") |  | ||||||
| 	end, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_abm({ |  | ||||||
| 	nodenames = {"technic:injector"}, |  | ||||||
| 	interval = 1, |  | ||||||
| 	chance = 1, |  | ||||||
|  |  | ||||||
| 	action = function(pos, node, active_object_count, active_object_count_wider) |  | ||||||
| 	local pos1={} |  | ||||||
| 	pos1.x = pos.x |  | ||||||
| 	pos1.y = pos.y-1 |  | ||||||
| 	pos1.z = pos.z |  | ||||||
| 	local meta=minetest.env:get_meta(pos1)  |  | ||||||
| 		if meta:get_int("tubelike")==1 then inject_items (pos) end |  | ||||||
| 	end, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| function inject_items (pos) |  | ||||||
| 		local meta=minetest.env:get_meta(pos)  | 		local meta=minetest.env:get_meta(pos)  | ||||||
| 		local inv = meta:get_inventory() | 		local inv = meta:get_inventory() | ||||||
| 		local mode=meta:get_string("mode") | 		local mode=meta:get_string("mode") | ||||||
| @@ -84,7 +13,7 @@ function inject_items (pos) | |||||||
| 				local item0=stack:to_table() | 				local item0=stack:to_table() | ||||||
| 				if item0 then  | 				if item0 then  | ||||||
| 					item0["count"]="1" | 					item0["count"]="1" | ||||||
| 					local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},item0) | 					local item1=pipeworks.tube_item({x=pos.x,y=pos.y,z=pos.z},item0) | ||||||
| 					item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} | 					item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} | ||||||
| 					item1:setvelocity({x=0, y=-1, z=0}) | 					item1:setvelocity({x=0, y=-1, z=0}) | ||||||
| 					item1:setacceleration({x=0, y=0, z=0}) | 					item1:setacceleration({x=0, y=0, z=0}) | ||||||
| @@ -102,7 +31,7 @@ function inject_items (pos) | |||||||
| 				if stack then | 				if stack then | ||||||
| 				local item0=stack:to_table() | 				local item0=stack:to_table() | ||||||
| 				if item0 then  | 				if item0 then  | ||||||
| 					local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},item0) | 					local item1=pipeworks.tube_item({x=pos.x,y=pos.y,z=pos.z},item0) | ||||||
| 					item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} | 					item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} | ||||||
| 					item1:setvelocity({x=0, y=-1, z=0}) | 					item1:setvelocity({x=0, y=-1, z=0}) | ||||||
| 					item1:setacceleration({x=0, y=0, z=0}) | 					item1:setacceleration({x=0, y=0, z=0}) | ||||||
| @@ -115,3 +44,77 @@ function inject_items (pos) | |||||||
| 		end | 		end | ||||||
| 		 | 		 | ||||||
| end | end | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'technic:injector 1', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'', 'technic:control_logic_unit',''}, | ||||||
|  | 		{'', 'default:chest',''}, | ||||||
|  | 		{'', 'pipeworks:tube_1',''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_node("technic:injector", { | ||||||
|  | 	description = S("Injector"), | ||||||
|  | 	tiles = {"technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png", | ||||||
|  | 		"technic_injector_side.png", "technic_injector_side.png", "technic_injector_side.png"}, | ||||||
|  | 	groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice=1}, | ||||||
|  | 	tube = {connect_sides={bottom=1}}, | ||||||
|  | 	sounds = default.node_sound_wood_defaults(), | ||||||
|  | 	on_construct = function(pos) | ||||||
|  | 		local meta = minetest.env:get_meta(pos) | ||||||
|  | 		meta:set_string("formspec", | ||||||
|  | 				"invsize[8,9;]".. | ||||||
|  | 				"label[0,0;"..S("Injector").."]".. | ||||||
|  | 				"button[0,1;.8,.8;mode;]".. | ||||||
|  | 				"label[.8,1;"..S("Mode: %s"):format("single items").."]".. | ||||||
|  | 				"list[current_name;main;0,2;8,2;]".. | ||||||
|  | 				"list[current_player;main;0,5;8,4;]") | ||||||
|  | 		meta:set_string("infotext", S("Injector")) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		inv:set_size("main", 8*4) | ||||||
|  | 		meta:set_string("mode","single items") | ||||||
|  | 	end, | ||||||
|  | 	can_dig = function(pos,player) | ||||||
|  | 		local meta = minetest.env:get_meta(pos); | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		return inv:is_empty("main") | ||||||
|  | 	end, | ||||||
|  | 	on_receive_fields = function(pos, formanme, fields, sender) | ||||||
|  | 		local meta = minetest.env:get_meta(pos) | ||||||
|  | 		local mode=meta:get_string("mode") | ||||||
|  | 		if fields.mode then  | ||||||
|  | 			if mode == "single items" then | ||||||
|  | 				mode = "whole stacks"  | ||||||
|  | 			else | ||||||
|  | 				mode = "single items" | ||||||
|  | 			end | ||||||
|  | 			meta:set_string("mode", mode) | ||||||
|  | 		end | ||||||
|  | 		meta:set_string("formspec", | ||||||
|  | 				"invsize[8,9;]".. | ||||||
|  | 				"label[0,0;"..S("Injector").."]".. | ||||||
|  | 				"button[0,1;.8,.8;mode;]".. | ||||||
|  | 				"label[.8,1;"..S("Mode: %s"):format(S(mode)).."]".. | ||||||
|  | 				"list[current_name;main;0,2;8,2;]".. | ||||||
|  | 				"list[current_player;main;0,5;8,4;]") | ||||||
|  | 	end, | ||||||
|  | 	allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 	allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 	allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"technic:injector"}, | ||||||
|  | 	interval = 1, | ||||||
|  | 	chance = 1, | ||||||
|  | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
|  | 	local pos1={} | ||||||
|  | 	pos1.x = pos.x | ||||||
|  | 	pos1.y = pos.y-1 | ||||||
|  | 	pos1.z = pos.z | ||||||
|  | 	local meta=minetest.env:get_meta(pos1)  | ||||||
|  | 		if meta:get_int("tubelike")==1 then inject_items (pos) end | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,287 +1,10 @@ | |||||||
|  |  | ||||||
| local S = technic.getter | local S = technic.getter | ||||||
|  |  | ||||||
| -- Register alloy recipes |  | ||||||
| technic.alloy_recipes = {} |  | ||||||
|  |  | ||||||
| -- Register recipe in a table |  | ||||||
| technic.register_alloy_recipe = function(metal1, count1, metal2, count2, result, count3) |  | ||||||
| 	in1 = { |  | ||||||
| 		name  = metal1, |  | ||||||
| 		count = count1, |  | ||||||
| 	} |  | ||||||
| 	in2 = { |  | ||||||
| 		name  = metal2, |  | ||||||
| 		count = count2, |  | ||||||
| 	} |  | ||||||
| 	-- Sort the inputs alphebetically |  | ||||||
| 	if in1.name > in2.name then |  | ||||||
| 		local temp = in1 |  | ||||||
| 		in1 = in2 |  | ||||||
| 		in2 = temp |  | ||||||
| 	end |  | ||||||
| 	technic.alloy_recipes[in1.name.." "..in2.name] = { |  | ||||||
| 		input = {in1, in2}, |  | ||||||
| 		output = { |  | ||||||
| 			name = result, |  | ||||||
| 			count = count3, |  | ||||||
| 		}, |  | ||||||
| 	} |  | ||||||
| 	if unified_inventory then |  | ||||||
| 		unified_inventory.register_craft({ |  | ||||||
| 			type = "alloy", |  | ||||||
| 			output = result.." "..count3, |  | ||||||
| 			items = {metal1.." "..count1, metal2.." "..count2}, |  | ||||||
| 			width = 2, |  | ||||||
| 		}) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| -- Retrieve a recipe given the input metals. |  | ||||||
| function technic.get_alloy_recipe(stack1, stack2) |  | ||||||
| 	-- Sort the stacks alphebetically |  | ||||||
| 	if stack1:get_name() > stack2:get_name() then |  | ||||||
| 		local temp = stack1 |  | ||||||
| 		stack1 = stack2 |  | ||||||
| 		stack2 = temp |  | ||||||
| 	end |  | ||||||
| 	for _, recipe in pairs(technic.alloy_recipes) do |  | ||||||
| 		if recipe.input[1].name == stack1:get_name() and |  | ||||||
| 		   recipe.input[2].name == stack2:get_name() and |  | ||||||
| 		   stack1:get_count() >= recipe.input[1].count and |  | ||||||
| 		   stack2:get_count() >= recipe.input[2].count then |  | ||||||
| 			return recipe |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| technic.register_alloy_recipe("technic:copper_dust",   3, "technic:tin_dust",       1, "technic:bronze_dust",           4) |  | ||||||
| technic.register_alloy_recipe("default:copper_ingot",  3, "moreores:tin_ingot",     1, "moreores:bronze_ingot",         4) |  | ||||||
| technic.register_alloy_recipe("technic:iron_dust",     3, "technic:chromium_dust",  1, "technic:stainless_steel_dust",  4) |  | ||||||
| technic.register_alloy_recipe("default:steel_ingot",   3, "technic:chromium_ingot", 1, "technic:stainless_steel_ingot", 4) |  | ||||||
| technic.register_alloy_recipe("technic:copper_dust",   2, "technic:zinc_dust",      1, "technic:brass_dust",            3) |  | ||||||
| technic.register_alloy_recipe("default:copper_ingot",  2, "technic:zinc_ingot",     1, "technic:brass_ingot",           3) |  | ||||||
| technic.register_alloy_recipe("default:sand",          2, "technic:coal_dust",      2, "technic:silicon_wafer",         1) |  | ||||||
| technic.register_alloy_recipe("technic:silicon_wafer", 1, "technic:gold_dust",      1, "technic:doped_silicon_wafer",   1) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function technic.register_alloy_furnace(data) | function technic.register_alloy_furnace(data) | ||||||
| 	local tier = data.tier | 	data.typename = "alloy" | ||||||
| 	local ltier = string.lower(tier) | 	data.machine_name = "alloy_furnace" | ||||||
|  | 	data.machine_desc = S("%s Alloy Furnace") | ||||||
| 	local tube_side_texture = data.tube and "technic_"..ltier.."_alloy_furnace_side_tube.png" | 	technic.register_base_machine(data) | ||||||
| 			or "technic_"..ltier.."_alloy_furnace_side.png" |  | ||||||
| 	local groups = {cracky=2} |  | ||||||
| 	local active_groups = {cracky=2, not_in_creative_inventory=1} |  | ||||||
| 	if data.tube then |  | ||||||
| 		groups.tubedevice = 1 |  | ||||||
| 		groups.tubedevice_receiver = 1 |  | ||||||
| 		active_groups.tubedevice = 1 |  | ||||||
| 		active_groups.tubedevice_receiver = 1 |  | ||||||
| end | end | ||||||
|  |  | ||||||
| 	local formspec = |  | ||||||
| 		"invsize[8,10;]".. |  | ||||||
| 		"label[0,0;"..S("%s Alloy Furnace"):format(tier).."]".. |  | ||||||
| 		"list[current_name;src;3,1;1,2;]".. |  | ||||||
| 		"list[current_name;dst;5,1;2,2;]".. |  | ||||||
| 		"list[current_player;main;0,6;8,4;]" |  | ||||||
| 	if data.upgrade then |  | ||||||
| 		formspec = formspec.. |  | ||||||
| 			"list[current_name;upgrade1;1,4;1,1;]".. |  | ||||||
| 			"list[current_name;upgrade2;2,4;1,1;]".. |  | ||||||
| 			"label[1,5;Upgrade Slots]" |  | ||||||
| 	end |  | ||||||
|  |  | ||||||
| 	data.formspec = formspec |  | ||||||
|  |  | ||||||
| 	local tube = { |  | ||||||
| 		insert_object = function(pos, node, stack, direction) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:add_item("src", stack) |  | ||||||
| 		end, |  | ||||||
| 		can_insert = function(pos, node, stack, direction) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:room_for_item("src", stack) |  | ||||||
| 		end, |  | ||||||
| 		connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:"..ltier.."_alloy_furnace", { |  | ||||||
| 		description = S("%s Alloy Furnace"):format(tier), |  | ||||||
| 		tiles = {"technic_"..ltier.."_alloy_furnace_top.png", |  | ||||||
| 		         "technic_"..ltier.."_alloy_furnace_bottom.png", |  | ||||||
| 			 tube_side_texture, |  | ||||||
| 		         tube_side_texture, |  | ||||||
| 			 "technic_"..ltier.."_alloy_furnace_side.png", |  | ||||||
| 		         "technic_"..ltier.."_alloy_furnace_front.png"}, |  | ||||||
| 		paramtype2 = "facedir", |  | ||||||
| 		groups = groups, |  | ||||||
| 		tube = tube, |  | ||||||
| 		technic = data, |  | ||||||
| 		legacy_facedir_simple = true, |  | ||||||
| 		sounds = default.node_sound_stone_defaults(), |  | ||||||
| 		on_construct = function(pos) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local name = minetest.get_node(pos).name |  | ||||||
| 			local data = minetest.registered_nodes[name].technic |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 			meta:set_string("infotext", S("%s Alloy Furnace"):format(data.tier)) |  | ||||||
| 			meta:set_string("formspec", data.formspec) |  | ||||||
| 			meta:set_int("tube_time",  0) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			inv:set_size("src", 2) |  | ||||||
| 			inv:set_size("dst", 4) |  | ||||||
| 			inv:set_size("upgrade1", 1) |  | ||||||
| 			inv:set_size("upgrade2", 1) |  | ||||||
| 		end, |  | ||||||
| 		can_dig = function(pos, player) |  | ||||||
| 			local meta = minetest.get_meta(pos); |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			if not inv:is_empty("src") or not inv:is_empty("dst") or |  | ||||||
| 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |  | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:"..ltier.."_alloy_furnace_active",{ |  | ||||||
| 		description = S(tier.." Alloy Furnace"), |  | ||||||
| 		tiles = {"technic_"..ltier.."_alloy_furnace_top.png", |  | ||||||
| 		         "technic_"..ltier.."_alloy_furnace_bottom.png", |  | ||||||
| 			 tube_side_texture, |  | ||||||
| 		         tube_side_texture, |  | ||||||
| 			 "technic_"..ltier.."_alloy_furnace_side.png", |  | ||||||
| 		         "technic_"..ltier.."_alloy_furnace_front_active.png"}, |  | ||||||
| 		paramtype2 = "facedir", |  | ||||||
| 		light_source = 8, |  | ||||||
| 		drop = "technic:"..ltier.."_alloy_furnace", |  | ||||||
| 		groups = active_groups, |  | ||||||
| 		tube = tube, |  | ||||||
| 		technic = data, |  | ||||||
| 		legacy_facedir_simple = true, |  | ||||||
| 		sounds = default.node_sound_stone_defaults(), |  | ||||||
| 		can_dig = function(pos, player) |  | ||||||
| 			local meta = minetest.get_meta(pos); |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			if not inv:is_empty("src") or not inv:is_empty("dst") or |  | ||||||
| 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |  | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		-- These three makes sure upgrades are not moved in or out while the furnace is active. |  | ||||||
| 		allow_metadata_inventory_put = function(pos, listname, index, stack, player) |  | ||||||
| 			if listname == "src" or listname == "dst" then |  | ||||||
| 				return stack:get_count() |  | ||||||
| 			else |  | ||||||
| 				return 0 -- Disallow the move |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		allow_metadata_inventory_take = function(pos, listname, index, stack, player) |  | ||||||
| 			if listname == "src" or listname == "dst" then |  | ||||||
| 				return stack:get_count() |  | ||||||
| 			else |  | ||||||
| 				return 0 -- Disallow the move |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player) |  | ||||||
| 			return 0 |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_abm({ |  | ||||||
| 		nodenames = {"technic:"..ltier.."_alloy_furnace", "technic:"..ltier.."_alloy_furnace_active"}, |  | ||||||
| 		interval = 1, |  | ||||||
| 		chance = 1, |  | ||||||
| 		action = function(pos, node, active_object_count, active_object_count_wider) |  | ||||||
| 			local data         = minetest.registered_nodes[node.name].technic |  | ||||||
| 			local meta         = minetest.get_meta(pos) |  | ||||||
| 			local inv          = meta:get_inventory() |  | ||||||
| 			local eu_input     = meta:get_int(data.tier.."_EU_input") |  | ||||||
|  |  | ||||||
| 			-- Machine information |  | ||||||
| 			local machine_name   = S("%s Alloy Furnace"):format(data.tier) |  | ||||||
| 			local machine_node   = "technic:"..string.lower(data.tier).."_alloy_furnace" |  | ||||||
| 			local machine_demand = data.demand |  | ||||||
|  |  | ||||||
| 			-- Setup meta data if it does not exist. |  | ||||||
| 			if not eu_input then |  | ||||||
| 				meta:set_int(data.tier.."_EU_demand", machine_demand[1]) |  | ||||||
| 				meta:set_int(data.tier.."_EU_input", 0) |  | ||||||
| 			end |  | ||||||
|  |  | ||||||
| 			-- Power off automatically if no longer connected to a switching station |  | ||||||
| 			technic.switching_station_timeout_count(pos, data.tier) |  | ||||||
|  |  | ||||||
| 			local EU_upgrade, tube_upgrade = 0, 0 |  | ||||||
| 			if data.upgrade then |  | ||||||
| 				EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta) |  | ||||||
| 			end |  | ||||||
| 			if data.tube then |  | ||||||
| 				technic.handle_machine_pipeworks(pos, tube_upgrade) |  | ||||||
| 			end |  | ||||||
|  |  | ||||||
| 			-- Get what to cook if anything |  | ||||||
| 			local srcstack  = inv:get_stack("src", 1) |  | ||||||
| 			local src2stack = inv:get_stack("src", 2) |  | ||||||
| 			local recipe = technic.get_alloy_recipe(srcstack, src2stack) |  | ||||||
| 			local result = recipe and ItemStack(recipe.output) or nil |  | ||||||
| 			-- Sort the stacks alphabetically |  | ||||||
| 			if srcstack:get_name() > src2stack:get_name() then |  | ||||||
| 				local temp = srcstack |  | ||||||
| 				srcstack = src2stack |  | ||||||
| 				src2stack = temp |  | ||||||
| 			end |  | ||||||
| 			if not result or |  | ||||||
| 			   not inv:room_for_item("dst", result) then |  | ||||||
| 				hacky_swap_node(pos, machine_node) |  | ||||||
| 				meta:set_string("infotext", S("%s Idle"):format(machine_name)) |  | ||||||
| 				meta:set_int(data.tier.."_EU_demand", 0) |  | ||||||
| 				return |  | ||||||
| 			end |  | ||||||
|  |  | ||||||
| 			if eu_input < machine_demand[EU_upgrade+1] then |  | ||||||
| 				-- Unpowered - go idle |  | ||||||
| 				hacky_swap_node(pos, machine_node) |  | ||||||
| 				meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |  | ||||||
| 			elseif eu_input >= machine_demand[EU_upgrade+1] then |  | ||||||
| 				-- Powered |  | ||||||
| 				hacky_swap_node(pos, machine_node.."_active") |  | ||||||
| 				meta:set_string("infotext", S("%s Active"):format(machine_name)) |  | ||||||
| 				meta:set_int("src_time", meta:get_int("src_time") + 1) |  | ||||||
| 				if meta:get_int("src_time") == data.cook_time then |  | ||||||
| 					meta:set_int("src_time", 0) |  | ||||||
| 					-- check if there's room for output and that we have the materials |  | ||||||
| 					if inv:room_for_item("dst", result) then |  | ||||||
| 						srcstack:take_item(recipe.input[1].count) |  | ||||||
| 						inv:set_stack("src", 1, srcstack) |  | ||||||
| 						src2stack:take_item(recipe.input[2].count) |  | ||||||
| 						inv:set_stack("src", 2, src2stack) |  | ||||||
| 						-- Put result in "dst" list |  | ||||||
| 						inv:add_item("dst", result) |  | ||||||
| 					else |  | ||||||
| 						next_state = 1 |  | ||||||
| 					end |  | ||||||
| 				end |  | ||||||
| 			 |  | ||||||
| 			end |  | ||||||
| 			meta:set_int(data.tier.."_EU_demand", machine_demand[EU_upgrade+1]) |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	technic.register_machine(tier, "technic:"..ltier.."_alloy_furnace",        technic.receiver) |  | ||||||
| 	technic.register_machine(tier, "technic:"..ltier.."_alloy_furnace_active", technic.receiver) |  | ||||||
|  |  | ||||||
| end -- End registration |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								technic/machines/register/alloy_recipes.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,28 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
|  | technic.register_recipe_type("alloy", S("Alloy cooking"), 2) | ||||||
|  |  | ||||||
|  | function technic.register_alloy_recipe(data) | ||||||
|  | 	data.time = data.time or 6 | ||||||
|  | 	technic.register_recipe("alloy", data) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local recipes = { | ||||||
|  | 	{"technic:copper_dust 3",         "technic:tin_dust",           "technic:bronze_dust 4"}, | ||||||
|  | 	{"default:copper_ingot 3",        "moreores:tin_ingot",         "default:bronze_ingot 4"}, | ||||||
|  | 	{"technic:wrought_iron_dust",     "technic:coal_dust",          "technic:carbon_steel_dust"}, | ||||||
|  | 	{"technic:wrought_iron_ingot",    "technic:coal_dust",          "technic:carbon_steel_ingot"}, | ||||||
|  | 	{"technic:carbon_steel_dust",     "technic:coal_dust",          "technic:cast_iron_dust"}, | ||||||
|  | 	{"technic:carbon_steel_ingot",    "technic:coal_dust",          "technic:cast_iron_ingot"}, | ||||||
|  | 	{"technic:carbon_steel_dust 3",   "technic:chromium_dust",      "technic:stainless_steel_dust 4"}, | ||||||
|  | 	{"technic:carbon_steel_ingot 3",  "technic:chromium_ingot",     "technic:stainless_steel_ingot 4"}, | ||||||
|  | 	{"technic:copper_dust 2",         "technic:zinc_dust",          "technic:brass_dust 3"}, | ||||||
|  | 	{"default:copper_ingot 2",        "technic:zinc_ingot",         "technic:brass_ingot 3"}, | ||||||
|  | 	{"default:sand 2",                "technic:coal_dust 2",        "technic:silicon_wafer"}, | ||||||
|  | 	{"technic:silicon_wafer",         "technic:gold_dust",          "technic:doped_silicon_wafer"}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | for _, data in pairs(recipes) do | ||||||
|  | 	technic.register_alloy_recipe({input = {data[1], data[2]}, output = data[3]}) | ||||||
|  | end | ||||||
| @@ -1,11 +1,67 @@ | |||||||
|  |  | ||||||
| local S = technic.getter | local S = technic.getter | ||||||
|  |  | ||||||
|  | technic.register_power_tool("technic:battery", 10000) | ||||||
|  | technic.register_power_tool("technic:red_energy_crystal", 50000) | ||||||
|  | technic.register_power_tool("technic:green_energy_crystal", 150000) | ||||||
|  | technic.register_power_tool("technic:blue_energy_crystal", 450000) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'technic:battery', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'default:copper_ingot', 'group:wood'}, | ||||||
|  | 		{'group:wood', 'moreores:tin_ingot',   'group:wood'}, | ||||||
|  | 		{'group:wood', 'default:copper_ingot', 'group:wood'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_tool("technic:battery", { | ||||||
|  | 	description = S("RE Battery"), | ||||||
|  | 	inventory_image = "technic_battery.png", | ||||||
|  | 	wear_represents = "technic_RE_charge", | ||||||
|  | 	on_refill = technic.refill_RE_charge, | ||||||
|  | 	tool_capabilities = { | ||||||
|  | 		charge = 0, | ||||||
|  | 		max_drop_level = 0, | ||||||
|  | 		groupcaps = { | ||||||
|  | 			fleshy = {times={}, uses=10000, maxlevel=0} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | local tube = { | ||||||
|  | 	insert_object = function(pos, node, stack, direction) | ||||||
|  | 		if direction.y == 0 then | ||||||
|  | 			return stack | ||||||
|  | 		end | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		if direction.y > 0 then | ||||||
|  | 			return inv:add_item("src", stack) | ||||||
|  | 		else | ||||||
|  | 			return inv:add_item("dst", stack) | ||||||
|  | 		end | ||||||
|  | 	end, | ||||||
|  | 	can_insert = function(pos, node, stack, direction) | ||||||
|  | 		if direction.y == 0 then | ||||||
|  | 			return false | ||||||
|  | 		end | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		if direction.y > 0 then | ||||||
|  | 			return inv:room_for_item("src", stack) | ||||||
|  | 		else | ||||||
|  | 			return inv:room_for_item("dst", stack) | ||||||
|  | 		end | ||||||
|  | 	end, | ||||||
|  | 	connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, | ||||||
|  | } | ||||||
|  |  | ||||||
| function technic.register_battery_box(data) | function technic.register_battery_box(data) | ||||||
| 	local tier = data.tier | 	local tier = data.tier | ||||||
| 	local ltier = string.lower(tier) | 	local ltier = string.lower(tier) | ||||||
|  |  | ||||||
| 	data.formspec = | 	local formspec = | ||||||
| 		"invsize[8,9;]".. | 		"invsize[8,9;]".. | ||||||
| 		"image[1,1;1,2;technic_power_meter_bg.png]".. | 		"image[1,1;1,2;technic_power_meter_bg.png]".. | ||||||
| 		"list[current_name;src;3,1;1,1;]".. | 		"list[current_name;src;3,1;1,1;]".. | ||||||
| @@ -17,11 +73,24 @@ function technic.register_battery_box(data) | |||||||
| 		"label[1,3;"..S("Power level").."]".. | 		"label[1,3;"..S("Power level").."]".. | ||||||
| 		"list[current_player;main;0,5;8,4;]" | 		"list[current_player;main;0,5;8,4;]" | ||||||
| 	 | 	 | ||||||
|  | 	if data.upgrade then | ||||||
|  | 		formspec = formspec.. | ||||||
|  | 			"list[current_name;upgrade1;3.5,3;1,1;]".. | ||||||
|  | 			"list[current_name;upgrade2;4.5,3;1,1;]".. | ||||||
|  | 			"label[3.5,4;"..S("Upgrade Slots").."]" | ||||||
|  | 	end | ||||||
|  |  | ||||||
| 	for i = 0, 8 do | 	for i = 0, 8 do | ||||||
| 		local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2} | 		local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2} | ||||||
| 		if i ~= 0 then | 		if i ~= 0 then | ||||||
| 			groups.not_in_creative_inventory = 1 | 			groups.not_in_creative_inventory = 1 | ||||||
| 		end | 		end | ||||||
|  | 		 | ||||||
|  | 		if data.tube then | ||||||
|  | 			groups.tubedevice = 1 | ||||||
|  | 			groups.tubedevice_receiver = 1 | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
| 		minetest.register_node("technic:"..ltier.."_battery_box"..i, { | 		minetest.register_node("technic:"..ltier.."_battery_box"..i, { | ||||||
| 			description = S("%s Battery Box"):format(tier), | 			description = S("%s Battery Box"):format(tier), | ||||||
| 			tiles = {"technic_"..ltier.."_battery_box_top.png", | 			tiles = {"technic_"..ltier.."_battery_box_top.png", | ||||||
| @@ -31,35 +100,30 @@ function technic.register_battery_box(data) | |||||||
| 				 "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png", | 				 "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png", | ||||||
| 				 "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"}, | 				 "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"}, | ||||||
| 			groups = groups, | 			groups = groups, | ||||||
|  | 			tube = data.tube and tube or nil, | ||||||
|  | 			paramtype2 = "facedir", | ||||||
| 			sounds = default.node_sound_wood_defaults(), | 			sounds = default.node_sound_wood_defaults(), | ||||||
| 			drop = "technic:"..ltier.."_battery_box0", | 			drop = "technic:"..ltier.."_battery_box0", | ||||||
| 			technic = data, |  | ||||||
| 			on_construct = function(pos) | 			on_construct = function(pos) | ||||||
| 				local meta = minetest.get_meta(pos) | 				local meta = minetest.get_meta(pos) | ||||||
| 				local inv = meta:get_inventory() | 				local inv = meta:get_inventory() | ||||||
| 				local node = minetest.get_node(pos) | 				local node = minetest.get_node(pos) | ||||||
| 				local data = minetest.registered_nodes[node.name].technic |  | ||||||
|  |  | ||||||
| 				meta:set_string("infotext", S("%s Battery Box"):format(data.tier)) | 				meta:set_string("infotext", S("%s Battery Box"):format(tier)) | ||||||
| 				meta:set_string("formspec", data.formspec) | 				meta:set_string("formspec", formspec) | ||||||
| 				meta:set_int(data.tier.."_EU_demand", 0) | 				meta:set_int(tier.."_EU_demand", 0) | ||||||
| 				meta:set_int(data.tier.."_EU_supply", 0) | 				meta:set_int(tier.."_EU_supply", 0) | ||||||
| 				meta:set_int(data.tier.."_EU_input",  0) | 				meta:set_int(tier.."_EU_input",  0) | ||||||
| 				meta:set_float("internal_EU_charge", 0) | 				meta:set_float("internal_EU_charge", 0) | ||||||
| 				inv:set_size("src", 1) | 				inv:set_size("src", 1) | ||||||
| 				inv:set_size("dst", 1) | 				inv:set_size("dst", 1) | ||||||
|  | 				inv:set_size("upgrade1", 1) | ||||||
|  | 				inv:set_size("upgrade2", 1) | ||||||
| 			end, | 			end, | ||||||
| 			can_dig = function(pos, player) | 			can_dig = technic.machine_can_dig, | ||||||
| 				local meta = minetest.get_meta(pos); | 			allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 				local inv = meta:get_inventory() | 			allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 				if not inv:is_empty("src") or not inv:is_empty("dst") then | 			allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 					minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 						S("Machine cannot be removed because it is not empty")) |  | ||||||
| 					return false |  | ||||||
| 				else |  | ||||||
| 					return true |  | ||||||
| 				end |  | ||||||
| 			end, |  | ||||||
| 		}) | 		}) | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| @@ -73,16 +137,18 @@ function technic.register_battery_box(data) | |||||||
| 		interval = 1, | 		interval = 1, | ||||||
| 		chance   = 1, | 		chance   = 1, | ||||||
| 		action = function(pos, node, active_object_count, active_object_count_wider) | 		action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
| 			local data           = minetest.registered_nodes[node.name].technic |  | ||||||
| 			local meta           = minetest.get_meta(pos) | 			local meta           = minetest.get_meta(pos) | ||||||
| 			local eu_input       = meta:get_int(data.tier.."_EU_input") | 			local eu_input       = meta:get_int(tier.."_EU_input") | ||||||
| 			local current_charge = meta:get_int("internal_EU_charge") | 			local current_charge = meta:get_int("internal_EU_charge") | ||||||
| 			local max_charge     = data.max_charge |  | ||||||
| 			local charge_rate    = data.charge_rate |  | ||||||
| 			local discharge_rate = data.discharge_rate |  | ||||||
|  |  | ||||||
| 			-- Power off automatically if no longer connected to a switching station | 			-- Power off automatically if no longer connected to a switching station | ||||||
| 			technic.switching_station_timeout_count(pos, data.tier) | 			technic.switching_station_timeout_count(pos, tier) | ||||||
|  |  | ||||||
|  | 			local EU_upgrade, tube_upgrade = 0, 0 | ||||||
|  | 			if data.upgrade then | ||||||
|  | 				EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta) | ||||||
|  | 			end | ||||||
|  | 			local max_charge = data.max_charge * (1 + EU_upgrade / 10) | ||||||
| 			 | 			 | ||||||
| 			-- Charge/discharge the battery with the input EUs | 			-- Charge/discharge the battery with the input EUs | ||||||
| 			if eu_input >= 0 then | 			if eu_input >= 0 then | ||||||
| @@ -92,16 +158,30 @@ function technic.register_battery_box(data) | |||||||
| 			end | 			end | ||||||
|  |  | ||||||
| 			-- Charging/discharging tools here | 			-- Charging/discharging tools here | ||||||
| 			current_charge = technic.charge_tools(meta, | 			local tool_full, tool_empty | ||||||
|  | 			current_charge, tool_full = technic.charge_tools(meta, | ||||||
| 					current_charge, data.charge_step) | 					current_charge, data.charge_step) | ||||||
| 			current_charge = technic.discharge_tools(meta, | 			current_charge, tool_empty = technic.discharge_tools(meta, | ||||||
| 					current_charge, data.discharge_step, max_charge) | 					current_charge, data.discharge_step, | ||||||
|  | 					max_charge) | ||||||
|  | 			 | ||||||
|  | 			if data.tube then | ||||||
|  | 				local inv = meta:get_inventory() | ||||||
|  | 				technic.handle_machine_pipeworks(pos, tube_upgrade, | ||||||
|  | 				function(pos, x_velocity, z_velocity) | ||||||
|  | 					if tool_full and not inv:is_empty("src") then | ||||||
|  | 						technic.send_items(pos, x_velocity, z_velocity, "src") | ||||||
|  | 					elseif tool_empty and not inv:is_empty("dst") then | ||||||
|  | 						technic.send_items(pos, x_velocity, z_velocity, "dst") | ||||||
|  | 					end | ||||||
|  | 				end) | ||||||
|  | 			end | ||||||
|  |  | ||||||
| 			-- We allow batteries to charge on less than the demand | 			-- We allow batteries to charge on less than the demand | ||||||
| 			meta:set_int(data.tier.."_EU_demand", | 			meta:set_int(tier.."_EU_demand", | ||||||
| 					math.min(charge_rate, max_charge - current_charge)) | 					math.min(data.charge_rate, max_charge - current_charge)) | ||||||
| 			meta:set_int(data.tier.."_EU_supply", | 			meta:set_int(tier.."_EU_supply", | ||||||
| 					math.min(discharge_rate, current_charge)) | 					math.min(data.discharge_rate, current_charge)) | ||||||
|  |  | ||||||
| 			meta:set_int("internal_EU_charge", current_charge) | 			meta:set_int("internal_EU_charge", current_charge) | ||||||
|  |  | ||||||
| @@ -111,18 +191,19 @@ function technic.register_battery_box(data) | |||||||
| 			charge_count = math.max(charge_count, 0) | 			charge_count = math.max(charge_count, 0) | ||||||
| 			local last_count = meta:get_float("last_side_shown") | 			local last_count = meta:get_float("last_side_shown") | ||||||
| 			if charge_count ~= last_count then | 			if charge_count ~= last_count then | ||||||
| 				hacky_swap_node(pos,"technic:"..string.lower(data.tier).."_battery_box"..charge_count) | 				technic.swap_node(pos,"technic:"..ltier.."_battery_box"..charge_count) | ||||||
| 				meta:set_float("last_side_shown", charge_count) | 				meta:set_float("last_side_shown", charge_count) | ||||||
| 			end | 			end | ||||||
|  |  | ||||||
| 			local charge_percent = math.floor(current_charge / max_charge * 100) | 			local charge_percent = math.floor(current_charge / max_charge * 100) | ||||||
| 			meta:set_string("formspec", | 			meta:set_string("formspec", | ||||||
| 				data.formspec.. | 				formspec.. | ||||||
| 				"image[1,1;1,2;technic_power_meter_bg.png" | 				"image[1,1;1,2;technic_power_meter_bg.png" | ||||||
| 				.."^[lowpart:"..charge_percent | 				.."^[lowpart:"..charge_percent | ||||||
| 				..":technic_power_meter_fg.png]") | 				..":technic_power_meter_fg.png]") | ||||||
|  |  | ||||||
| 			local infotext = S("%s Battery Box: %d/%d"):format(data.tier, current_charge, max_charge) | 			local infotext = S("%s Battery Box: %d/%d"):format(tier, | ||||||
|  | 					current_charge, max_charge) | ||||||
| 			if eu_input == 0 then | 			if eu_input == 0 then | ||||||
| 				infotext = S("%s Idle"):format(infotext) | 				infotext = S("%s Idle"):format(infotext) | ||||||
| 			end | 			end | ||||||
| @@ -142,17 +223,16 @@ end -- End registration | |||||||
| function technic.charge_tools(meta, batt_charge, charge_step) | function technic.charge_tools(meta, batt_charge, charge_step) | ||||||
| 	local inv = meta:get_inventory() | 	local inv = meta:get_inventory() | ||||||
| 	if inv:is_empty("src") then | 	if inv:is_empty("src") then | ||||||
| 		return batt_charge | 		return batt_charge, false | ||||||
| 	end | 	end | ||||||
| 	local srcstack = inv:get_stack("src", 1) | 	local srcstack = inv:get_stack("src", 1) | ||||||
| 	local src_meta = get_item_meta(srcstack:get_metadata()) |  | ||||||
|  |  | ||||||
| 	local toolname = srcstack:get_name() | 	local toolname = srcstack:get_name() | ||||||
| 	if not technic.power_tools[toolname] then | 	if not technic.power_tools[toolname] then | ||||||
| 		return batt_charge | 		return batt_charge, false | ||||||
| 	end | 	end | ||||||
| 	-- Set meta data for the tool if it didn't do it itself | 	-- Set meta data for the tool if it didn't do it itself | ||||||
| 	src_meta = get_item_meta(srcstack:get_metadata()) | 	src_meta = minetest.deserialize(srcstack:get_metadata()) | ||||||
| 	src_meta = src_meta or {} | 	src_meta = src_meta or {} | ||||||
| 	if not src_meta.charge then | 	if not src_meta.charge then | ||||||
| 		src_meta.charge = 0 | 		src_meta.charge = 0 | ||||||
| @@ -160,8 +240,10 @@ function technic.charge_tools(meta, batt_charge, charge_step) | |||||||
| 	-- Do the charging | 	-- Do the charging | ||||||
| 	local item_max_charge = technic.power_tools[toolname] | 	local item_max_charge = technic.power_tools[toolname] | ||||||
| 	local tool_charge     = src_meta.charge | 	local tool_charge     = src_meta.charge | ||||||
| 	if tool_charge >= item_max_charge or batt_charge <= 0 then | 	if tool_charge >= item_max_charge then | ||||||
| 		return batt_charge | 		return batt_charge, true | ||||||
|  | 	elseif batt_charge <= 0 then | ||||||
|  | 		return batt_charge, false | ||||||
| 	end | 	end | ||||||
| 	charge_step = math.min(charge_step, batt_charge) | 	charge_step = math.min(charge_step, batt_charge) | ||||||
| 	charge_step = math.min(charge_step, item_max_charge - tool_charge) | 	charge_step = math.min(charge_step, item_max_charge - tool_charge) | ||||||
| @@ -169,24 +251,24 @@ function technic.charge_tools(meta, batt_charge, charge_step) | |||||||
| 	batt_charge = batt_charge - charge_step | 	batt_charge = batt_charge - charge_step | ||||||
| 	technic.set_RE_wear(srcstack, tool_charge, item_max_charge) | 	technic.set_RE_wear(srcstack, tool_charge, item_max_charge) | ||||||
| 	src_meta.charge = tool_charge | 	src_meta.charge = tool_charge | ||||||
| 	srcstack:set_metadata(set_item_meta(src_meta)) | 	srcstack:set_metadata(minetest.serialize(src_meta)) | ||||||
| 	inv:set_stack("src", 1, srcstack) | 	inv:set_stack("src", 1, srcstack) | ||||||
| 	return batt_charge | 	return batt_charge, (tool_charge == item_max_charge) | ||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
| function technic.discharge_tools(meta, batt_charge, charge_step, max_charge) | function technic.discharge_tools(meta, batt_charge, charge_step, max_charge) | ||||||
| 	local inv = meta:get_inventory() | 	local inv = meta:get_inventory() | ||||||
| 	if inv:is_empty("dst") then | 	if inv:is_empty("dst") then | ||||||
| 		return batt_charge | 		return batt_charge, false | ||||||
| 	end | 	end | ||||||
| 	srcstack = inv:get_stack("dst", 1) | 	srcstack = inv:get_stack("dst", 1) | ||||||
| 	local toolname = srcstack:get_name() | 	local toolname = srcstack:get_name() | ||||||
| 	if technic.power_tools[toolname] == nil then | 	if technic.power_tools[toolname] == nil then | ||||||
| 		return batt_charge | 		return batt_charge, false | ||||||
| 	end | 	end | ||||||
| 	-- Set meta data for the tool if it didn't do it itself :-( | 	-- Set meta data for the tool if it didn't do it itself :-( | ||||||
| 	local src_meta = get_item_meta(srcstack:get_metadata()) | 	local src_meta = minetest.deserialize(srcstack:get_metadata()) | ||||||
| 	src_meta = src_meta or {} | 	src_meta = src_meta or {} | ||||||
| 	if not src_meta.charge then | 	if not src_meta.charge then | ||||||
| 		src_meta.charge = 0 | 		src_meta.charge = 0 | ||||||
| @@ -195,8 +277,10 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge) | |||||||
| 	-- Do the discharging | 	-- Do the discharging | ||||||
| 	local item_max_charge = technic.power_tools[toolname] | 	local item_max_charge = technic.power_tools[toolname] | ||||||
| 	local tool_charge     = src_meta.charge | 	local tool_charge     = src_meta.charge | ||||||
| 	if tool_charge <= 0 or batt_charge >= max_charge then | 	if tool_charge <= 0 then | ||||||
| 		return batt_charge | 		return batt_charge, true | ||||||
|  | 	elseif batt_charge >= max_charge then | ||||||
|  | 		return batt_charge, false | ||||||
| 	end | 	end | ||||||
| 	charge_step = math.min(charge_step, max_charge - batt_charge) | 	charge_step = math.min(charge_step, max_charge - batt_charge) | ||||||
| 	charge_step = math.min(charge_step, tool_charge) | 	charge_step = math.min(charge_step, tool_charge) | ||||||
| @@ -204,8 +288,8 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge) | |||||||
| 	batt_charge = batt_charge + charge_step | 	batt_charge = batt_charge + charge_step | ||||||
| 	technic.set_RE_wear(srcstack, tool_charge, item_max_charge) | 	technic.set_RE_wear(srcstack, tool_charge, item_max_charge) | ||||||
| 	src_meta.charge = tool_charge | 	src_meta.charge = tool_charge | ||||||
| 	srcstack:set_metadata(set_item_meta(src_meta)) | 	srcstack:set_metadata(minetest.serialize(src_meta)) | ||||||
| 	inv:set_stack("dst", 1, srcstack) | 	inv:set_stack("dst", 1, srcstack) | ||||||
| 	return batt_charge | 	return batt_charge, (tool_charge == 0) | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -62,12 +62,9 @@ end | |||||||
|  |  | ||||||
| minetest.register_on_placenode(function(pos, node) | minetest.register_on_placenode(function(pos, node) | ||||||
| 	for tier, machine_list in pairs(technic.machines) do | 	for tier, machine_list in pairs(technic.machines) do | ||||||
| 		for machine_name, _ in pairs(machine_list) do | 		if machine_list[node.name] ~= nil then | ||||||
| 			if node.name == machine_name then |  | ||||||
| 			technic.update_cables(pos, tier, true) | 			technic.update_cables(pos, tier, true) | ||||||
| 			technic.networks = {} | 			technic.networks = {} | ||||||
| 				return |  | ||||||
| 			end |  | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| end) | end) | ||||||
| @@ -75,12 +72,9 @@ end) | |||||||
|  |  | ||||||
| minetest.register_on_dignode(function(pos, node) | minetest.register_on_dignode(function(pos, node) | ||||||
| 	for tier, machine_list in pairs(technic.machines) do | 	for tier, machine_list in pairs(technic.machines) do | ||||||
| 		for machine_name, _ in pairs(machine_list) do | 		if machine_list[node.name] ~= nil then | ||||||
| 			if node.name == machine_name then |  | ||||||
| 			technic.update_cables(pos, tier, true) | 			technic.update_cables(pos, tier, true) | ||||||
| 			technic.networks = {} | 			technic.networks = {} | ||||||
| 				return |  | ||||||
| 			end |  | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| end) | end) | ||||||
|   | |||||||
| @@ -1,4 +1,6 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
| function technic.handle_machine_upgrades(meta) | function technic.handle_machine_upgrades(meta) | ||||||
| 	-- Get the names of the upgrades | 	-- Get the names of the upgrades | ||||||
| 	local inv = meta:get_inventory() | 	local inv = meta:get_inventory() | ||||||
| @@ -35,23 +37,27 @@ function technic.handle_machine_upgrades(meta) | |||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
| function technic.send_items(pos, x_velocity, z_velocity) | function technic.send_items(pos, x_velocity, z_velocity, output_name) | ||||||
| 	-- Send items on their way in the pipe system. | 	-- Send items on their way in the pipe system. | ||||||
|  | 	if output_name == nil then | ||||||
|  | 		output_name = "dst" | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
| 	local meta = minetest.get_meta(pos)  | 	local meta = minetest.get_meta(pos)  | ||||||
| 	local inv = meta:get_inventory() | 	local inv = meta:get_inventory() | ||||||
| 	local i = 0 | 	local i = 0 | ||||||
| 	for _, stack in ipairs(inv:get_list("dst")) do | 	for _, stack in ipairs(inv:get_list(output_name)) do | ||||||
| 		i = i + 1 | 		i = i + 1 | ||||||
| 		if stack then | 		if stack then | ||||||
| 			local item0 = stack:to_table() | 			local item0 = stack:to_table() | ||||||
| 			if item0 then  | 			if item0 then  | ||||||
| 				item0["count"] = "1" | 				item0["count"] = "1" | ||||||
| 				local item1 = tube_item({x=pos.x, y=pos.y, z=pos.z}, item0) | 				local item1 = pipeworks.tube_item({x=pos.x, y=pos.y, z=pos.z}, item0) | ||||||
| 				item1:get_luaentity().start_pos = {x=pos.x, y=pos.y, z=pos.z} | 				item1:get_luaentity().start_pos = {x=pos.x, y=pos.y, z=pos.z} | ||||||
| 				item1:setvelocity({x=x_velocity, y=0, z=z_velocity}) | 				item1:setvelocity({x=x_velocity, y=0, z=z_velocity}) | ||||||
| 				item1:setacceleration({x=0, y=0, z=0}) | 				item1:setacceleration({x=0, y=0, z=0}) | ||||||
| 				stack:take_item(1) | 				stack:take_item(1) | ||||||
| 				inv:set_stack("dst", i, stack) | 				inv:set_stack(output_name, i, stack) | ||||||
| 				return | 				return | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| @@ -79,7 +85,11 @@ function technic.smelt_item(meta, result, speed) | |||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| function technic.handle_machine_pipeworks(pos, tube_upgrade) | function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function) | ||||||
|  | 	if send_function == nil then | ||||||
|  | 		send_function = technic.send_items | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
| 	local node = minetest.get_node(pos) | 	local node = minetest.get_node(pos) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	local inv = meta:get_inventory() | 	local inv = meta:get_inventory() | ||||||
| @@ -100,12 +110,48 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade) | |||||||
| 	end | 	end | ||||||
| 	tube_time = meta:get_int("tube_time") | 	tube_time = meta:get_int("tube_time") | ||||||
| 	tube_time = tube_time + tube_upgrade | 	tube_time = tube_time + tube_upgrade | ||||||
| 	if tube_time > 3 then | 	if tube_time >= 2 then | ||||||
| 		tube_time = 0 | 		tube_time = 0 | ||||||
| 		if output_tube_connected then | 		if output_tube_connected then | ||||||
| 			technic.send_items(pos, x_velocity, z_velocity) | 			send_function(pos, x_velocity, z_velocity) | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| 	meta:set_int("tube_time", tube_time) | 	meta:set_int("tube_time", tube_time) | ||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
|  | function technic.machine_can_dig(pos, player) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	if not inv:is_empty("src") or not inv:is_empty("dst") or | ||||||
|  | 	   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then | ||||||
|  | 		minetest.chat_send_player(player:get_player_name(), | ||||||
|  | 			S("Machine cannot be removed because it is not empty")) | ||||||
|  | 		return false | ||||||
|  | 	else | ||||||
|  | 		return true | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function inv_change(pos, player, count) | ||||||
|  | 	if minetest.is_protected(pos, player:get_player_name()) then | ||||||
|  | 		minetest.chat_send_player(player:get_player_name(), | ||||||
|  | 			S("Inventory move disallowed due to protection")) | ||||||
|  | 		return 0 | ||||||
|  | 	end | ||||||
|  | 	return count | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function technic.machine_inventory_put(pos, listname, index, stack, player) | ||||||
|  | 	return inv_change(pos, player, stack:get_count()) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function technic.machine_inventory_take(pos, listname, index, stack, player) | ||||||
|  | 	return inv_change(pos, player, stack:get_count()) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function technic.machine_inventory_move(pos, from_list, from_index, | ||||||
|  | 		to_list, to_index, count, player) | ||||||
|  | 	return inv_change(pos, player, count) | ||||||
|  | end | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								technic/machines/register/compressor.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,9 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
|  | function technic.register_compressor(data) | ||||||
|  | 	data.typename = "compressing" | ||||||
|  | 	data.machine_name = "compressor" | ||||||
|  | 	data.machine_desc = S("%s Compressor") | ||||||
|  | 	technic.register_base_machine(data) | ||||||
|  | end | ||||||
							
								
								
									
										24
									
								
								technic/machines/register/compressor_recipes.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,24 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
|  | technic.register_recipe_type("compressing", S("Compressing")) | ||||||
|  |  | ||||||
|  | function technic.register_compressor_recipe(data) | ||||||
|  | 	data.time = data.time or 4 | ||||||
|  | 	technic.register_recipe("compressing", data) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local recipes = { | ||||||
|  | 	{"default:snowblock",          "default:ice"}, | ||||||
|  | 	{"default:desert_sand",        "default:desert_stone"}, | ||||||
|  | 	{"technic:mixed_metal_ingot",  "technic:composite_plate"}, | ||||||
|  | 	{"default:copper_ingot 5",     "technic:copper_plate"}, | ||||||
|  | 	{"technic:coal_dust 4",        "technic:graphite"}, | ||||||
|  | 	{"technic:carbon_cloth",       "technic:carbon_plate"}, | ||||||
|  | 	{"technic:enriched_uranium 4", "technic:uranium_fuel"}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | for _, data in pairs(recipes) do | ||||||
|  | 	technic.register_compressor_recipe({input = {data[1]}, output = data[2]}) | ||||||
|  | end | ||||||
|  |  | ||||||
| @@ -2,199 +2,8 @@ | |||||||
| local S = technic.getter | local S = technic.getter | ||||||
|  |  | ||||||
| function technic.register_electric_furnace(data) | function technic.register_electric_furnace(data) | ||||||
| 	local tier = data.tier | 	data.typename = "cooking" | ||||||
| 	local ltier = string.lower(tier) | 	data.machine_name = "electric_furnace" | ||||||
|  | 	data.machine_desc = S("%s Furnace") | ||||||
| 	local tube_side_texture = data.tube and "technic_"..ltier.."_electric_furnace_side_tube.png" | 	technic.register_base_machine(data) | ||||||
| 			or "technic_"..ltier.."_electric_furnace_side.png" |  | ||||||
|  |  | ||||||
| 	local tube = { |  | ||||||
| 		insert_object = function(pos, node, stack, direction) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:add_item("src",stack) |  | ||||||
| 		end, |  | ||||||
| 		can_insert = function(pos, node, stack, direction) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:room_for_item("src", stack) |  | ||||||
| 		end, |  | ||||||
| 		connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	local formspec = |  | ||||||
| 		"invsize[8,10;]".. |  | ||||||
| 		"list[current_name;src;3,1;1,1;]".. |  | ||||||
| 		"list[current_name;dst;5,1;2,2;]".. |  | ||||||
| 		"list[current_player;main;0,6;8,4;]".. |  | ||||||
| 		"label[0,0;"..S("%s Electric Furnace"):format(tier).."]" |  | ||||||
| 	if data.upgrade then |  | ||||||
| 		formspec = formspec.. |  | ||||||
| 			"list[current_name;upgrade1;1,4;1,1;]".. |  | ||||||
| 			"list[current_name;upgrade2;2,4;1,1;]".. |  | ||||||
| 			"label[1,5;Upgrade Slots]" |  | ||||||
| end | end | ||||||
|  |  | ||||||
| 	data.formspec = formspec |  | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:"..ltier.."_electric_furnace", { |  | ||||||
| 		description = S("%s Electric furnace"):format(tier), |  | ||||||
| 		tiles = {"technic_"..ltier.."_electric_furnace_top.png", |  | ||||||
| 		         "technic_"..ltier.."_electric_furnace_bottom.png", |  | ||||||
| 		         tube_side_texture, |  | ||||||
| 			 tube_side_texture, |  | ||||||
| 			 "technic_"..ltier.."_electric_furnace_side.png", |  | ||||||
| 		         "technic_"..ltier.."_electric_furnace_front.png"}, |  | ||||||
| 		paramtype2 = "facedir", |  | ||||||
| 		groups = {cracky=2, tubedevice=1, tubedevice_receiver=1}, |  | ||||||
| 		legacy_facedir_simple = true, |  | ||||||
| 		sounds = default.node_sound_stone_defaults(), |  | ||||||
| 		tube = tube, |  | ||||||
| 		technic = data, |  | ||||||
| 		on_construct = function(pos) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local name = minetest.get_node(pos).name |  | ||||||
| 			local data = minetest.registered_nodes[name].technic |  | ||||||
| 			meta:set_string("infotext", S("%s Electric furnace"):format(data.tier)) |  | ||||||
| 			meta:set_int("tube_time",  0) |  | ||||||
| 			meta:set_string("formspec", data.formspec) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			inv:set_size("src", 1) |  | ||||||
| 			inv:set_size("dst", 4) |  | ||||||
| 			inv:set_size("upgrade1", 1) |  | ||||||
| 			inv:set_size("upgrade2", 1) |  | ||||||
| 		end, |  | ||||||
| 		can_dig = function(pos, player) |  | ||||||
| 			local meta = minetest.get_meta(pos); |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			if not inv:is_empty("src") or not inv:is_empty("dst") or |  | ||||||
| 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |  | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:"..ltier.."_electric_furnace_active", { |  | ||||||
| 		description = tier.." Electric furnace", |  | ||||||
| 		tiles = {"technic_"..ltier.."_electric_furnace_top.png", |  | ||||||
| 		         "technic_"..ltier.."_electric_furnace_bottom.png", |  | ||||||
| 		         tube_side_texture, |  | ||||||
| 		         tube_side_texture, |  | ||||||
| 		         "technic_"..ltier.."_electric_furnace_side.png", |  | ||||||
| 		         "technic_"..ltier.."_electric_furnace_front_active.png"}, |  | ||||||
| 		paramtype2 = "facedir", |  | ||||||
| 		groups = {cracky=2, tubedevice=1, tubedevice_receiver=1, not_in_creative_inventory=1}, |  | ||||||
| 		light_source = 8, |  | ||||||
| 		legacy_facedir_simple = true, |  | ||||||
| 		sounds = default.node_sound_stone_defaults(), |  | ||||||
| 		tube = tube, |  | ||||||
| 		technic = data, |  | ||||||
| 		on_construct = function(pos) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local name = minetest.get_node(pos).name |  | ||||||
| 			local data = minetest.registered_nodes[name].technic |  | ||||||
| 			meta:set_string("infotext", S("%s Electric furnace", data.tier)) |  | ||||||
| 			meta:set_int("tube_time",  0) |  | ||||||
| 			meta:set_string("formspec", data.formspec) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			inv:set_size("src", 1) |  | ||||||
| 			inv:set_size("dst", 4) |  | ||||||
| 			inv:set_size("upgrade1", 1) |  | ||||||
| 			inv:set_size("upgrade2", 1) |  | ||||||
| 		end, |  | ||||||
| 		can_dig = function(pos, player) |  | ||||||
| 			local meta = minetest.get_meta(pos); |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			if not inv:is_empty("src") or not inv:is_empty("dst") or |  | ||||||
| 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |  | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		-- These three makes sure upgrades are not moved in or out while the furnace is active. |  | ||||||
| 		allow_metadata_inventory_put = function(pos, listname, index, stack, player) |  | ||||||
| 			if listname == "src" or listname == "dst" then |  | ||||||
| 				return stack:get_stack_max() |  | ||||||
| 			else |  | ||||||
| 				return 0 -- Disallow the move |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		allow_metadata_inventory_take = function(pos, listname, index, stack, player) |  | ||||||
| 			if listname == "src" or listname == "dst" then |  | ||||||
| 				return stack:get_stack_max() |  | ||||||
| 			else |  | ||||||
| 				return 0 -- Disallow the move |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player) |  | ||||||
| 			return 0 |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_abm({ |  | ||||||
| 		nodenames = {"technic:"..ltier.."_electric_furnace", |  | ||||||
| 		             "technic:"..ltier.."_electric_furnace_active"}, |  | ||||||
| 		interval = 1, |  | ||||||
| 		chance   = 1, |  | ||||||
| 		action = function(pos, node, active_object_count, active_object_count_wider) |  | ||||||
| 			local data     = minetest.registered_nodes[node.name].technic |  | ||||||
| 			local meta     = minetest.get_meta(pos) |  | ||||||
| 			local inv      = meta:get_inventory() |  | ||||||
| 			local eu_input = meta:get_int(data.tier.."_EU_input") |  | ||||||
|  |  | ||||||
| 			-- Machine information |  | ||||||
| 			local machine_name   = S("%s Electric Furnace"):format(data.tier) |  | ||||||
| 			local machine_node   = "technic:"..string.lower(data.tier).."_electric_furnace" |  | ||||||
| 			local machine_demand = data.demand |  | ||||||
|  |  | ||||||
| 			-- Power off automatically if no longer connected to a switching station |  | ||||||
| 			technic.switching_station_timeout_count(pos, data.tier) |  | ||||||
|  |  | ||||||
| 			-- Check upgrade slots |  | ||||||
| 			local EU_upgrade, tube_upgrade = 0, 0 |  | ||||||
| 			if data.upgrade then |  | ||||||
| 				EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta) |  | ||||||
| 			end |  | ||||||
| 			if data.tube then |  | ||||||
| 				technic.handle_machine_pipeworks(pos, tube_upgrade) |  | ||||||
| 			end |  | ||||||
|  |  | ||||||
| 			local result = minetest.get_craft_result({ |  | ||||||
| 					method = "cooking", |  | ||||||
| 					width = 1, |  | ||||||
| 					items = inv:get_list("src")}) |  | ||||||
| 			if not result or result.time == 0 or |  | ||||||
| 			   not inv:room_for_item("dst", result.item) then |  | ||||||
| 				meta:set_int(data.tier.."_EU_demand", 0) |  | ||||||
| 				hacky_swap_node(pos, machine_node) |  | ||||||
| 				meta:set_string("infotext", S("%s Idle"):format(machine_name)) |  | ||||||
| 				return |  | ||||||
| 			end |  | ||||||
|  |  | ||||||
| 			if eu_input < machine_demand[EU_upgrade+1] then |  | ||||||
| 				-- Unpowered - go idle |  | ||||||
| 				hacky_swap_node(pos, machine_node) |  | ||||||
| 				meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |  | ||||||
| 			elseif eu_input >= machine_demand[EU_upgrade+1] then |  | ||||||
| 				-- Powered |  | ||||||
| 				hacky_swap_node(pos, machine_node.."_active") |  | ||||||
| 				meta:set_string("infotext", S("%s Active"):format(machine_name)) |  | ||||||
| 				technic.smelt_item(meta, result, data.speed) |  | ||||||
|  |  | ||||||
| 			end |  | ||||||
| 			meta:set_int(data.tier.."_EU_demand", machine_demand[EU_upgrade+1]) |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	technic.register_machine(tier, "technic:"..ltier.."_electric_furnace",        technic.receiver) |  | ||||||
| 	technic.register_machine(tier, "technic:"..ltier.."_electric_furnace_active", technic.receiver) |  | ||||||
|  |  | ||||||
| end -- End registration |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								technic/machines/register/extractor.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,9 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
|  | function technic.register_extractor(data) | ||||||
|  | 	data.typename = "extracting" | ||||||
|  | 	data.machine_name = "extractor" | ||||||
|  | 	data.machine_desc = S("%s Extractor") | ||||||
|  | 	technic.register_base_machine(data) | ||||||
|  | end | ||||||
							
								
								
									
										35
									
								
								technic/machines/register/extractor_recipes.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,35 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
|  | technic.register_recipe_type("extracting", S("Extracting")) | ||||||
|  |  | ||||||
|  | function technic.register_extractor_recipe(data) | ||||||
|  | 	data.time = data.time or 4 | ||||||
|  | 	technic.register_recipe("extracting", data) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local recipes = { | ||||||
|  | 	-- Dyes | ||||||
|  | 	{"technic:coal_dust",                 "dye:black 2"}, | ||||||
|  | 	{"default:cactus",                    "dye:green 2"}, | ||||||
|  | 	{"default:dry_shrub",                 "dye:brown 2"}, | ||||||
|  | 	{"flowers:geranium",                  "dye:blue 2"}, | ||||||
|  | 	{"flowers:dandelion_white",           "dye:white 2"}, | ||||||
|  | 	{"flowers:dandelion_yellow",          "dye:yellow 2"}, | ||||||
|  | 	{"flowers:tulip",                     "dye:orange 2"}, | ||||||
|  | 	{"flowers:rose",                      "dye:red 2"}, | ||||||
|  | 	{"flowers:viola",                     "dye:violet 2"}, | ||||||
|  | 	 | ||||||
|  | 	-- Rubber | ||||||
|  | 	{"technic:raw_latex",                 "technic:rubber 3"}, | ||||||
|  | 	{"moretrees:rubber_tree_trunk_empty", "technic:rubber"}, | ||||||
|  | 	{"moretrees:rubber_tree_trunk",       "technic:rubber"}, | ||||||
|  | 	 | ||||||
|  | 	-- Other | ||||||
|  | 	{"technic:uranium 5",                 "technic:enriched_uranium"}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | for _, data in pairs(recipes) do | ||||||
|  | 	technic.register_extractor_recipe({input = {data[1]}, output = data[2]}) | ||||||
|  | end | ||||||
|  |  | ||||||
| @@ -1,70 +1,81 @@ | |||||||
|  |  | ||||||
| local S = technic.getter | local S = technic.getter | ||||||
|  |  | ||||||
|  | local tube = { | ||||||
|  | 	insert_object = function(pos, node, stack, direction) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		return inv:add_item("src", stack) | ||||||
|  | 	end, | ||||||
|  | 	can_insert = function(pos, node, stack, direction) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		return inv:room_for_item("src", stack) | ||||||
|  | 	end, | ||||||
|  | 	connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, | ||||||
|  | } | ||||||
|  |  | ||||||
| function technic.register_generator(data)  | function technic.register_generator(data)  | ||||||
| 	local tier = data.tier | 	local tier = data.tier | ||||||
| 	local ltier = string.lower(tier) | 	local ltier = string.lower(tier) | ||||||
|  |  | ||||||
|  | 	local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2} | ||||||
|  | 	local active_groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1} | ||||||
|  | 	if data.tube then | ||||||
|  | 		groups.tubedevice = 1 | ||||||
|  | 		groups.tubedevice_receiver = 1 | ||||||
|  | 		active_groups.tubedevice = 1 | ||||||
|  | 		active_groups.tubedevice_receiver = 1 | ||||||
|  | 	end | ||||||
|  |  | ||||||
| 	local generator_formspec = | 	local generator_formspec = | ||||||
| 		"invsize[8,9;]".. | 		"invsize[8,9;]".. | ||||||
| 		"label[0,0;"..S("%s Generator"):format(tier).."]".. | 		"label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]".. | ||||||
| 		"list[current_name;src;3,1;1,1;]".. | 		"list[current_name;src;3,1;1,1;]".. | ||||||
| 		"image[4,1;1,1;default_furnace_fire_bg.png]".. | 		"image[4,1;1,1;default_furnace_fire_bg.png]".. | ||||||
| 		"list[current_player;main;0,5;8,4;]" | 		"list[current_player;main;0,5;8,4;]" | ||||||
| 	 | 	 | ||||||
| 	local desc = S("%s Generator"):format(tier) | 	local desc = S("Fuel-Fired %s Generator"):format(tier) | ||||||
| 	minetest.register_node("technic:"..ltier.."_generator", { | 	minetest.register_node("technic:"..ltier.."_generator", { | ||||||
| 		description = desc, | 		description = desc, | ||||||
| 		tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", | 		tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", | ||||||
| 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", | 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", | ||||||
| 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"},  | 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"},  | ||||||
| 		paramtype2 = "facedir", | 		paramtype2 = "facedir", | ||||||
| 		groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, | 		groups = groups, | ||||||
| 		legacy_facedir_simple = true, | 		legacy_facedir_simple = true, | ||||||
| 		sounds = default.node_sound_wood_defaults(), | 		sounds = default.node_sound_wood_defaults(), | ||||||
|  | 		tube = data.tube and tube or nil, | ||||||
| 		on_construct = function(pos) | 		on_construct = function(pos) | ||||||
| 			local meta = minetest.get_meta(pos) | 			local meta = minetest.get_meta(pos) | ||||||
| 			meta:set_string("infotext", desc) | 			meta:set_string("infotext", desc) | ||||||
| 			meta:set_int(data.tier.."_EU_supply", 0) | 			meta:set_int(data.tier.."_EU_supply", 0) | ||||||
| 			meta:set_int("burn_time", 0) | 			meta:set_int("burn_time", 0) | ||||||
|  | 			meta:set_int("tube_time",  0) | ||||||
| 			meta:set_string("formspec", generator_formspec) | 			meta:set_string("formspec", generator_formspec) | ||||||
| 			local inv = meta:get_inventory() | 			local inv = meta:get_inventory() | ||||||
| 			inv:set_size("src", 1) | 			inv:set_size("src", 1) | ||||||
| 		end, | 		end, | ||||||
| 		can_dig = function(pos, player) | 		can_dig = technic.machine_can_dig, | ||||||
| 			local meta = minetest.get_meta(pos) | 		allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 			local inv = meta:get_inventory() | 		allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 			if not inv:is_empty("src") then | 		allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:"..ltier.."_generator_active", { | 	minetest.register_node("technic:"..ltier.."_generator_active", { | ||||||
| 		description = desc, | 		description = desc, | ||||||
| 		tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", | 		tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", | ||||||
| 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", | 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", | ||||||
| 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"}, | 		         "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"}, | ||||||
| 		paramtype2 = "facedir", | 		paramtype2 = "facedir", | ||||||
| 		groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, | 		groups = active_groups, | ||||||
| 			not_in_creative_inventory=1}, |  | ||||||
| 		legacy_facedir_simple = true, | 		legacy_facedir_simple = true, | ||||||
| 		sounds = default.node_sound_wood_defaults(), | 		sounds = default.node_sound_wood_defaults(), | ||||||
|  | 		tube = data.tube and tube or nil, | ||||||
| 		drop = "technic:"..ltier.."_generator", | 		drop = "technic:"..ltier.."_generator", | ||||||
| 		can_dig = function(pos, player) | 		can_dig = technic.machine_can_dig, | ||||||
| 			local meta = minetest.get_meta(pos) | 		allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
| 			local inv = meta:get_inventory() | 		allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
| 			if not inv:is_empty("src") then | 		allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 					S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 	}) | 	}) | ||||||
| 	minetest.register_abm({ | 	minetest.register_abm({ | ||||||
| 		nodenames = {"technic:"..ltier.."_generator", "technic:"..ltier.."_generator_active"}, | 		nodenames = {"technic:"..ltier.."_generator", "technic:"..ltier.."_generator_active"}, | ||||||
| @@ -76,7 +87,7 @@ function technic.register_generator(data) | |||||||
| 			local burn_totaltime = meta:get_int("burn_totaltime") | 			local burn_totaltime = meta:get_int("burn_totaltime") | ||||||
| 			-- If more to burn and the energy produced was used: produce some more | 			-- If more to burn and the energy produced was used: produce some more | ||||||
| 			if burn_time > 0 then | 			if burn_time > 0 then | ||||||
| 				meta:set_int(data.tier.."_EU_supply", data.supply) | 				meta:set_int(tier.."_EU_supply", data.supply) | ||||||
| 				burn_time = burn_time - 1 | 				burn_time = burn_time - 1 | ||||||
| 				meta:set_int("burn_time", burn_time) | 				meta:set_int("burn_time", burn_time) | ||||||
| 			end | 			end | ||||||
| @@ -85,10 +96,12 @@ function technic.register_generator(data) | |||||||
| 				local inv = meta:get_inventory() | 				local inv = meta:get_inventory() | ||||||
| 				if not inv:is_empty("src") then  | 				if not inv:is_empty("src") then  | ||||||
| 					local fuellist = inv:get_list("src") | 					local fuellist = inv:get_list("src") | ||||||
| 					fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) | 					local fuel = minetest.get_craft_result( | ||||||
|  | 							{method = "fuel", width = 1, | ||||||
|  | 							items = fuellist}) | ||||||
| 					if not fuel or fuel.time == 0 then | 					if not fuel or fuel.time == 0 then | ||||||
| 						meta:set_string("infotext", S("%s Out Of Fuel"):format(desc)) | 						meta:set_string("infotext", S("%s Out Of Fuel"):format(desc)) | ||||||
| 						hacky_swap_node(pos, "technic:"..ltier.."_generator") | 						technic.swap_node(pos, "technic:"..ltier.."_generator") | ||||||
| 						return | 						return | ||||||
| 					end | 					end | ||||||
| 					meta:set_int("burn_time", fuel.time) | 					meta:set_int("burn_time", fuel.time) | ||||||
| @@ -96,11 +109,11 @@ function technic.register_generator(data) | |||||||
| 					local stack = inv:get_stack("src", 1) | 					local stack = inv:get_stack("src", 1) | ||||||
| 					stack:take_item() | 					stack:take_item() | ||||||
| 					inv:set_stack("src", 1, stack) | 					inv:set_stack("src", 1, stack) | ||||||
| 					hacky_swap_node(pos, "technic:"..ltier.."_generator_active") | 					technic.swap_node(pos, "technic:"..ltier.."_generator_active") | ||||||
| 					meta:set_int(data.tier.."_EU_supply", data.supply) | 					meta:set_int(tier.."_EU_supply", data.supply) | ||||||
| 				else | 				else | ||||||
| 					hacky_swap_node(pos, "technic:"..ltier.."_generator") | 					technic.swap_node(pos, "technic:"..ltier.."_generator") | ||||||
| 					meta:set_int(data.tier.."_EU_supply", 0) | 					meta:set_int(tier.."_EU_supply", 0) | ||||||
| 				end | 				end | ||||||
| 			end | 			end | ||||||
| 			if burn_totaltime == 0 then burn_totaltime = 1 end | 			if burn_totaltime == 0 then burn_totaltime = 1 end | ||||||
| @@ -108,14 +121,14 @@ function technic.register_generator(data) | |||||||
| 			meta:set_string("infotext", desc.." ("..percent.."%)") | 			meta:set_string("infotext", desc.." ("..percent.."%)") | ||||||
| 				meta:set_string("formspec",  | 				meta:set_string("formspec",  | ||||||
| 					"size[8, 9]".. | 					"size[8, 9]".. | ||||||
| 					"label[0, 0;Generator]".. | 					"label[0, 0;"..minetest.formspec_escape(desc).."]".. | ||||||
| 					"list[current_name;src;3, 1;1, 1;]".. | 					"list[current_name;src;3, 1;1, 1;]".. | ||||||
| 					"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. | 					"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. | ||||||
| 					(percent)..":default_furnace_fire_fg.png]".. | 					(percent)..":default_furnace_fire_fg.png]".. | ||||||
| 					"list[current_player;main;0, 5;8, 4;]") | 					"list[current_player;main;0, 5;8, 4;]") | ||||||
| 		end | 		end | ||||||
| 	}) | 	}) | ||||||
| 	technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer) | 	technic.register_machine(tier, "technic:"..ltier.."_generator",        technic.producer) | ||||||
| 	technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer) | 	technic.register_machine(tier, "technic:"..ltier.."_generator_active", technic.producer) | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,185 +2,8 @@ | |||||||
| local S = technic.getter | local S = technic.getter | ||||||
|  |  | ||||||
| function technic.register_grinder(data) | function technic.register_grinder(data) | ||||||
| 	local tier = data.tier | 	data.typename = "grinding" | ||||||
| 	local ltier = string.lower(tier) | 	data.machine_name = "grinder" | ||||||
| 	local tube = { | 	data.machine_desc = S("%s Grinder") | ||||||
| 		insert_object = function(pos, node, stack, direction) | 	technic.register_base_machine(data) | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:add_item("src", stack) |  | ||||||
| 		end, |  | ||||||
| 		can_insert = function(pos, node, stack, direction) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:room_for_item("src", stack) |  | ||||||
| 		end, |  | ||||||
| 		connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	local formspec = |  | ||||||
| 		"invsize[8,10;]".. |  | ||||||
| 		"list[current_name;src;3,1;1,1;]".. |  | ||||||
| 		"list[current_name;dst;5,1;2,2;]".. |  | ||||||
| 		"list[current_player;main;0,6;8,4;]".. |  | ||||||
| 		"label[0,0;"..tier.." Grinder]" |  | ||||||
| 	if data.upgrade then |  | ||||||
| 		formspec = formspec.. |  | ||||||
| 			"list[current_name;upgrade1;1,4;1,1;]".. |  | ||||||
| 			"list[current_name;upgrade2;2,4;1,1;]".. |  | ||||||
| 			"label[1,5;Upgrade Slots]" |  | ||||||
| end | end | ||||||
| 	data.formspec = formspec |  | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:"..ltier.."_grinder", { |  | ||||||
| 		description = S("%s Grinder"):format(tier), |  | ||||||
| 		tiles = {"technic_"..ltier.."_grinder_top.png",  "technic_"..ltier.."_grinder_bottom.png", |  | ||||||
| 			 "technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_side.png", |  | ||||||
| 			 "technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front.png"}, |  | ||||||
| 		paramtype2 = "facedir", |  | ||||||
| 		groups = {cracky=2, tubedevice=1, tubedevice_receiver=1}, |  | ||||||
| 		technic = data, |  | ||||||
| 		tube = tube, |  | ||||||
| 		legacy_facedir_simple = true, |  | ||||||
| 		sounds = default.node_sound_wood_defaults(), |  | ||||||
| 		on_construct = function(pos) |  | ||||||
| 			local node = minetest.get_node(pos) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local data = minetest.registered_nodes[node.name].technic |  | ||||||
| 			meta:set_string("infotext", S("%s Grinder"):format(data.tier)) |  | ||||||
| 			meta:set_int("tube_time",  0) |  | ||||||
| 			meta:set_string("formspec", data.formspec) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			inv:set_size("src", 1) |  | ||||||
| 			inv:set_size("dst", 4) |  | ||||||
| 			inv:set_size("upgrade1", 1) |  | ||||||
| 			inv:set_size("upgrade2", 1) |  | ||||||
| 		end, |  | ||||||
| 		can_dig = function(pos,player) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			if not inv:is_empty("src") or not inv:is_empty("dst") or  |  | ||||||
| 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |  | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 						S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_node("technic:"..ltier.."_grinder_active",{ |  | ||||||
| 		description = S("%s Grinder"):format(tier), |  | ||||||
| 		tiles = {"technic_"..ltier.."_grinder_top.png",  "technic_"..ltier.."_grinder_bottom.png", |  | ||||||
| 			 "technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_side.png", |  | ||||||
| 			 "technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front_active.png"}, |  | ||||||
| 		paramtype2 = "facedir", |  | ||||||
| 		groups = {cracky=2, tubedevice=1, tubedevice_receiver=1, not_in_creative_inventory=1}, |  | ||||||
| 		legacy_facedir_simple = true, |  | ||||||
| 		sounds = default.node_sound_wood_defaults(), |  | ||||||
| 		technic = data, |  | ||||||
| 		tube = tube, |  | ||||||
| 		can_dig = function(pos,player) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			if not inv:is_empty("src") or not inv:is_empty("dst") or |  | ||||||
| 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |  | ||||||
| 				minetest.chat_send_player(player:get_player_name(), |  | ||||||
| 						S("Machine cannot be removed because it is not empty")) |  | ||||||
| 				return false |  | ||||||
| 			else |  | ||||||
| 				return true |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		-- These three makes sure upgrades are not moved in or out while the grinder is active. |  | ||||||
| 		allow_metadata_inventory_put = function(pos, listname, index, stack, player) |  | ||||||
| 			if listname == "src" or listname == "dst" then |  | ||||||
| 				return stack:get_stack_max() |  | ||||||
| 			else |  | ||||||
| 				return 0 -- Disallow the move |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		allow_metadata_inventory_take = function(pos, listname, index, stack, player) |  | ||||||
| 			if listname == "src" or listname == "dst" then |  | ||||||
| 				return stack:get_stack_max() |  | ||||||
| 			else |  | ||||||
| 				return 0 -- Disallow the move |  | ||||||
| 			end |  | ||||||
| 		end, |  | ||||||
| 		allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player) |  | ||||||
| 			return 0 |  | ||||||
| 		end, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_abm({ |  | ||||||
| 		nodenames = {"technic:"..ltier.."_grinder","technic:"..ltier.."_grinder_active"}, |  | ||||||
| 		interval = 1, |  | ||||||
| 		chance   = 1, |  | ||||||
| 		action = function(pos, node, active_object_count, active_object_count_wider) |  | ||||||
| 			local data     = minetest.registered_nodes[node.name].technic |  | ||||||
| 			local meta     = minetest.get_meta(pos) |  | ||||||
| 			local inv      = meta:get_inventory() |  | ||||||
| 			local eu_input = meta:get_int(data.tier.."_EU_input") |  | ||||||
|  |  | ||||||
| 			local machine_name   = S("%s Grinder"):format(data.tier) |  | ||||||
| 			local machine_node   = "technic:"..string.lower(data.tier).."_grinder" |  | ||||||
| 			local machine_demand = data.demand |  | ||||||
|  |  | ||||||
| 			-- Setup meta data if it does not exist. |  | ||||||
| 			if not eu_input then |  | ||||||
| 				meta:set_int(data.tier.."_EU_demand", machine_demand[1]) |  | ||||||
| 				meta:set_int(data.tier.."_EU_input", 0) |  | ||||||
| 				return |  | ||||||
| 			end |  | ||||||
| 		 |  | ||||||
| 			-- Power off automatically if no longer connected to a switching station |  | ||||||
| 			technic.switching_station_timeout_count(pos, data.tier) |  | ||||||
|  |  | ||||||
| 			local EU_upgrade, tube_upgrade = 0, 0 |  | ||||||
| 			if data.upgrade then |  | ||||||
| 				EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta) |  | ||||||
| 			end |  | ||||||
| 			if data.tube then |  | ||||||
| 				technic.handle_machine_pipeworks(pos, tube_upgrade) |  | ||||||
| 			end |  | ||||||
|  |  | ||||||
| 			local result = technic.get_grinder_recipe(inv:get_stack("src", 1)) |  | ||||||
|  |  | ||||||
| 			if not result then |  | ||||||
| 				hacky_swap_node(pos, machine_node) |  | ||||||
| 				meta:set_string("infotext", S("%s Idle"):format(machine_name)) |  | ||||||
| 				meta:set_int(data.tier.."_EU_demand", 0) |  | ||||||
| 				return |  | ||||||
| 			end |  | ||||||
| 		 |  | ||||||
| 			if eu_input < machine_demand[EU_upgrade+1] then |  | ||||||
| 				-- Unpowered - go idle |  | ||||||
| 				hacky_swap_node(pos, machine_node) |  | ||||||
| 				meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |  | ||||||
| 			elseif eu_input >= machine_demand[EU_upgrade+1] then |  | ||||||
| 				-- Powered	 |  | ||||||
| 				hacky_swap_node(pos, machine_node.."_active") |  | ||||||
| 				meta:set_string("infotext", S("%s Active"):format(machine_name)) |  | ||||||
|  |  | ||||||
| 				meta:set_int("src_time", meta:get_int("src_time") + 1) |  | ||||||
| 				if meta:get_int("src_time") >= result.time / data.speed then |  | ||||||
| 					meta:set_int("src_time", 0) |  | ||||||
| 					local result_stack = ItemStack(result.output) |  | ||||||
| 					if inv:room_for_item("dst", result_stack) then |  | ||||||
| 						srcstack = inv:get_stack("src", 1) |  | ||||||
| 						srcstack:take_item() |  | ||||||
| 						inv:set_stack("src", 1, srcstack) |  | ||||||
| 						inv:add_item("dst", result_stack) |  | ||||||
| 					end |  | ||||||
| 				end |  | ||||||
| 			end |  | ||||||
| 			meta:set_int(data.tier.."_EU_demand", machine_demand[EU_upgrade+1]) |  | ||||||
| 		end |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	technic.register_machine(tier, "technic:"..ltier.."_grinder",        technic.receiver) |  | ||||||
| 	technic.register_machine(tier, "technic:"..ltier.."_grinder_active", technic.receiver) |  | ||||||
|  |  | ||||||
| end -- End registration |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,64 +1,46 @@ | |||||||
|  |  | ||||||
| local S = technic.getter | local S = technic.getter | ||||||
|  |  | ||||||
| technic.grinder_recipes = {} | technic.register_recipe_type("grinding", S("Grinding")) | ||||||
|  |  | ||||||
| function technic.register_grinder_recipe(data) | function technic.register_grinder_recipe(data) | ||||||
| 	data.time = data.time or 3 | 	data.time = data.time or 3 | ||||||
| 	technic.grinder_recipes[data.input] = data | 	technic.register_recipe("grinding", data) | ||||||
| 	if unified_inventory then |  | ||||||
| 		unified_inventory.register_craft({ |  | ||||||
| 			type = "grinding", |  | ||||||
| 			output = data.output, |  | ||||||
| 			items = {data.input}, |  | ||||||
| 			width = 0, |  | ||||||
| 		}) |  | ||||||
| 	end |  | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Receive an ItemStack of result by an ItemStack input |  | ||||||
| function technic.get_grinder_recipe(itemstack) |  | ||||||
| 	return technic.grinder_recipes[itemstack:get_name()] |  | ||||||
| end |  | ||||||
|  |  | ||||||
| -- Sorted alphebeticaly |  | ||||||
| local recipes = { | local recipes = { | ||||||
| 	{"default:bronze_ingot",    "technic:bronze_dust 1"}, | 	-- Dusts | ||||||
| 	{"default:coal_lump",       "technic:coal_dust 2"}, | 	{"default:coal_lump",       "technic:coal_dust 2"}, | ||||||
| 	{"default:cobble",          "default:gravel"}, |  | ||||||
| 	{"default:copper_ingot",    "technic:copper_dust 1"}, |  | ||||||
| 	{"default:copper_lump",     "technic:copper_dust 2"}, | 	{"default:copper_lump",     "technic:copper_dust 2"}, | ||||||
| 	{"default:desert_stone",    "default:desert_sand"}, | 	{"default:desert_stone",    "default:desert_sand"}, | ||||||
| 	{"default:gold_ingot",      "technic:gold_dust 1"}, |  | ||||||
| 	{"default:gold_lump",       "technic:gold_dust 2"}, | 	{"default:gold_lump",       "technic:gold_dust 2"}, | ||||||
| 	{"default:gravel",          "default:dirt"}, | 	{"default:iron_lump",       "technic:wrought_iron_dust 2"}, | ||||||
| 	{"default:iron_lump",       "technic:iron_dust 2"}, |  | ||||||
| 	{"default:steel_ingot",     "technic:iron_dust 1"}, |  | ||||||
| 	{"default:stone",           "default:sand"}, |  | ||||||
| 	{"gloopores:alatro_lump",   "technic:alatro_dust 2"}, |  | ||||||
| 	{"gloopores:kalite_lump",   "technic:kalite_dust 2"}, |  | ||||||
| 	{"gloopores:arol_lump",     "technic:arol_dust 2"}, |  | ||||||
| 	{"gloopores:talinite_lump", "technic:talinite_dust 2"}, |  | ||||||
| 	{"gloopores:akalin_lump",   "technic:akalin_dust 2"}, |  | ||||||
| 	{"moreores:mithril_ingot",  "technic:mithril_dust 1"}, |  | ||||||
| 	{"moreores:mithril_lump",   "technic:mithril_dust 2"}, | 	{"moreores:mithril_lump",   "technic:mithril_dust 2"}, | ||||||
| 	{"moreores:silver_ingot",   "technic:silver_dust 1"}, |  | ||||||
| 	{"moreores:silver_lump",    "technic:silver_dust 2"}, | 	{"moreores:silver_lump",    "technic:silver_dust 2"}, | ||||||
| 	{"moreores:tin_ingot",      "technic:tin_dust 1"}, |  | ||||||
| 	{"moreores:tin_lump",       "technic:tin_dust 2"}, | 	{"moreores:tin_lump",       "technic:tin_dust 2"}, | ||||||
| 	{"technic:chromium_ingot",  "technic:chromium_dust 1"}, |  | ||||||
| 	{"technic:chromium_lump",   "technic:chromium_dust 2"}, | 	{"technic:chromium_lump",   "technic:chromium_dust 2"}, | ||||||
| 	{"technic:zinc_ingot",      "technic:zinc_dust 1"}, |  | ||||||
| 	{"technic:zinc_lump",       "technic:zinc_dust 2"}, | 	{"technic:zinc_lump",       "technic:zinc_dust 2"}, | ||||||
| 	{"technic:brass_ingot",     "technic:brass_dust 1"}, | 	 | ||||||
|  | 	-- Other | ||||||
|  | 	{"default:cobble",          "default:gravel"}, | ||||||
|  | 	{"default:gravel",          "default:dirt"}, | ||||||
|  | 	{"default:stone",           "default:sand"}, | ||||||
| } | } | ||||||
|  |  | ||||||
|  | if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then | ||||||
|  | 	table.insert(recipes, {"gloopores:alatro_lump",   "technic:alatro_dust 2"}) | ||||||
|  | 	table.insert(recipes, {"gloopores:kalite_lump",   "technic:kalite_dust 2"}) | ||||||
|  | 	table.insert(recipes, {"gloopores:arol_lump",     "technic:arol_dust 2"}) | ||||||
|  | 	table.insert(recipes, {"gloopores:talinite_lump", "technic:talinite_dust 2"}) | ||||||
|  | 	table.insert(recipes, {"gloopores:akalin_lump",   "technic:akalin_dust 2"}) | ||||||
|  | end | ||||||
|  |  | ||||||
| if minetest.get_modpath("homedecor") then | if minetest.get_modpath("homedecor") then | ||||||
| 	table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"}) | 	table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"}) | ||||||
| end | end | ||||||
|  |  | ||||||
| for _, data in pairs(recipes) do | for _, data in pairs(recipes) do | ||||||
| 	technic.register_grinder_recipe({input=data[1], output=data[2]}) | 	technic.register_grinder_recipe({input = {data[1]}, output = data[2]}) | ||||||
| end | end | ||||||
|  |  | ||||||
| local function register_dust(name, ingot) | local function register_dust(name, ingot) | ||||||
| @@ -75,26 +57,32 @@ local function register_dust(name, ingot) | |||||||
| 			recipe = "technic:"..lname.."_dust", | 			recipe = "technic:"..lname.."_dust", | ||||||
| 			output = ingot, | 			output = ingot, | ||||||
| 		}) | 		}) | ||||||
|  | 		technic.register_grinder_recipe({ input = {ingot}, output = "technic:"..lname.."_dust 1" }) | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Sorted alphibeticaly | -- Sorted alphibeticaly | ||||||
| register_dust("Akalin",          "glooptest:akalin_ingot") |  | ||||||
| register_dust("Alatro",          "glooptest:alatro_ingot") |  | ||||||
| register_dust("Arol",            "glooptest:arol_ingot") |  | ||||||
| register_dust("Brass",           "technic:brass_ingot") | register_dust("Brass",           "technic:brass_ingot") | ||||||
| register_dust("Bronze",          "default:bronze_ingot") | register_dust("Bronze",          "default:bronze_ingot") | ||||||
|  | register_dust("Carbon Steel",    "technic:carbon_steel_ingot") | ||||||
|  | register_dust("Cast Iron",       "technic:cast_iron_ingot") | ||||||
| register_dust("Chromium",        "technic:chromium_ingot") | register_dust("Chromium",        "technic:chromium_ingot") | ||||||
| register_dust("Coal",            nil) | register_dust("Coal",            nil) | ||||||
| register_dust("Copper",          "default:copper_ingot") | register_dust("Copper",          "default:copper_ingot") | ||||||
| register_dust("Gold",            "default:gold_ingot") | register_dust("Gold",            "default:gold_ingot") | ||||||
| register_dust("Iron",            "default:steel_ingot") |  | ||||||
| register_dust("Mithril",         "moreores:mithril_ingot") | register_dust("Mithril",         "moreores:mithril_ingot") | ||||||
| register_dust("Silver",          "moreores:silver_ingot") | register_dust("Silver",          "moreores:silver_ingot") | ||||||
| register_dust("Stainless Steel", "technic:stainless_steel_ingot") | register_dust("Stainless Steel", "technic:stainless_steel_ingot") | ||||||
| register_dust("Talinite",        "glooptest:talinite_ingot") |  | ||||||
| register_dust("Tin",             "moreores:tin_ingot") | register_dust("Tin",             "moreores:tin_ingot") | ||||||
|  | register_dust("Wrought Iron",    "technic:wrought_iron_ingot") | ||||||
| register_dust("Zinc",            "technic:zinc_ingot") | register_dust("Zinc",            "technic:zinc_ingot") | ||||||
|  | if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then | ||||||
|  | 	register_dust("Akalin",          "glooptest:akalin_ingot") | ||||||
|  | 	register_dust("Alatro",          "glooptest:alatro_ingot") | ||||||
|  | 	register_dust("Arol",            "glooptest:arol_ingot") | ||||||
|  | 	register_dust("Kalite",          nil) | ||||||
|  | 	register_dust("Talinite",        "glooptest:talinite_ingot") | ||||||
|  | end | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	type = "fuel", | 	type = "fuel", | ||||||
|   | |||||||
| @@ -1,12 +1,29 @@ | |||||||
| local path = technic.modpath.."/machines/register" | local path = technic.modpath.."/machines/register" | ||||||
|  |  | ||||||
| dofile(path.."/alloy_furnace.lua") |  | ||||||
| dofile(path.."/battery_box.lua") |  | ||||||
| dofile(path.."/cables.lua") |  | ||||||
| dofile(path.."/common.lua") | dofile(path.."/common.lua") | ||||||
| dofile(path.."/electric_furnace.lua") |  | ||||||
| dofile(path.."/grinder.lua") | -- Wiring stuff | ||||||
| dofile(path.."/grinder_recipes.lua") | dofile(path.."/cables.lua") | ||||||
|  | dofile(path.."/battery_box.lua") | ||||||
|  |  | ||||||
|  | -- Generators | ||||||
| dofile(path.."/solar_array.lua") | dofile(path.."/solar_array.lua") | ||||||
| dofile(path.."/generator.lua") | dofile(path.."/generator.lua") | ||||||
|  |  | ||||||
|  | -- API for machines | ||||||
|  | dofile(path.."/recipes.lua") | ||||||
|  | dofile(path.."/machine_base.lua") | ||||||
|  |  | ||||||
|  | -- Recipes | ||||||
|  | dofile(path.."/alloy_recipes.lua") | ||||||
|  | dofile(path.."/grinder_recipes.lua") | ||||||
|  | dofile(path.."/extractor_recipes.lua") | ||||||
|  | dofile(path.."/compressor_recipes.lua") | ||||||
|  |  | ||||||
|  | -- Machines | ||||||
|  | dofile(path.."/alloy_furnace.lua") | ||||||
|  | dofile(path.."/electric_furnace.lua") | ||||||
|  | dofile(path.."/grinder.lua") | ||||||
|  | dofile(path.."/extractor.lua") | ||||||
|  | dofile(path.."/compressor.lua") | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										168
									
								
								technic/machines/register/machine_base.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,168 @@ | |||||||
|  |  | ||||||
|  | local S = technic.getter | ||||||
|  |  | ||||||
|  | local tube = { | ||||||
|  | 	insert_object = function(pos, node, stack, direction) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		return inv:add_item("src", stack) | ||||||
|  | 	end, | ||||||
|  | 	can_insert = function(pos, node, stack, direction) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		return inv:room_for_item("src", stack) | ||||||
|  | 	end, | ||||||
|  | 	connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function technic.register_base_machine(data) | ||||||
|  | 	local typename = data.typename | ||||||
|  | 	local numitems = technic.recipes[typename].numitems | ||||||
|  | 	local machine_name = data.machine_name | ||||||
|  | 	local machine_desc = data.machine_desc | ||||||
|  | 	local tier = data.tier | ||||||
|  | 	local ltier = string.lower(tier) | ||||||
|  |  | ||||||
|  | 	local groups = {cracky = 2} | ||||||
|  | 	local active_groups = {cracky = 2, not_in_creative_inventory = 1} | ||||||
|  | 	if data.tube then | ||||||
|  | 		groups.tubedevice = 1 | ||||||
|  | 		groups.tubedevice_receiver = 1 | ||||||
|  | 		active_groups.tubedevice = 1 | ||||||
|  | 		active_groups.tubedevice_receiver = 1 | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	local formspec = | ||||||
|  | 		"invsize[8,9;]".. | ||||||
|  | 		"list[current_name;src;"..(4-numitems)..",1;"..numitems..",1;]".. | ||||||
|  | 		"list[current_name;dst;5,1;2,2;]".. | ||||||
|  | 		"list[current_player;main;0,5;8,4;]".. | ||||||
|  | 		"label[0,0;"..machine_desc:format(tier).."]" | ||||||
|  | 	if data.upgrade then | ||||||
|  | 		formspec = formspec.. | ||||||
|  | 			"list[current_name;upgrade1;1,3;1,1;]".. | ||||||
|  | 			"list[current_name;upgrade2;2,3;1,1;]".. | ||||||
|  | 			"label[1,4;"..S("Upgrade Slots").."]" | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	minetest.register_node("technic:"..ltier.."_"..machine_name, { | ||||||
|  | 		description = machine_desc:format(tier), | ||||||
|  | 		tiles = {"technic_"..ltier.."_"..machine_name.."_top.png",  | ||||||
|  | 	                 "technic_"..ltier.."_"..machine_name.."_bottom.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_side.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_side.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_side.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_front.png"}, | ||||||
|  | 		paramtype2 = "facedir", | ||||||
|  | 		groups = groups, | ||||||
|  | 		tube = data.tube and tube or nil, | ||||||
|  | 		legacy_facedir_simple = true, | ||||||
|  | 		sounds = default.node_sound_wood_defaults(), | ||||||
|  | 		on_construct = function(pos) | ||||||
|  | 			local node = minetest.get_node(pos) | ||||||
|  | 			local meta = minetest.get_meta(pos) | ||||||
|  | 			meta:set_string("infotext", machine_desc:format(tier)) | ||||||
|  | 			meta:set_int("tube_time",  0) | ||||||
|  | 			meta:set_string("formspec", formspec) | ||||||
|  | 			local inv = meta:get_inventory() | ||||||
|  | 			inv:set_size("src", numitems) | ||||||
|  | 			inv:set_size("dst", 4) | ||||||
|  | 			inv:set_size("upgrade1", 1) | ||||||
|  | 			inv:set_size("upgrade2", 1) | ||||||
|  | 		end, | ||||||
|  | 		can_dig = technic.machine_can_dig, | ||||||
|  | 		allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 		allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 		allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | 	minetest.register_node("technic:"..ltier.."_"..machine_name.."_active",{ | ||||||
|  | 		description = machine_desc:format(tier), | ||||||
|  | 		tiles = {"technic_"..ltier.."_"..machine_name.."_top.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_bottom.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_side.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_side.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_side.png", | ||||||
|  | 		         "technic_"..ltier.."_"..machine_name.."_front_active.png"}, | ||||||
|  | 		paramtype2 = "facedir", | ||||||
|  | 		drop = "technic:"..ltier.."_"..machine_name, | ||||||
|  | 		groups = active_groups, | ||||||
|  | 		legacy_facedir_simple = true, | ||||||
|  | 		sounds = default.node_sound_wood_defaults(), | ||||||
|  | 		tube = data.tube and tube or nil, | ||||||
|  | 		can_dig = technic.machine_can_dig, | ||||||
|  | 		allow_metadata_inventory_put = technic.machine_inventory_put, | ||||||
|  | 		allow_metadata_inventory_take = technic.machine_inventory_take, | ||||||
|  | 		allow_metadata_inventory_move = technic.machine_inventory_move, | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | 	minetest.register_abm({ | ||||||
|  | 		nodenames = {"technic:"..ltier.."_"..machine_name, | ||||||
|  | 		             "technic:"..ltier.."_"..machine_name.."_active"}, | ||||||
|  | 		interval = 1, | ||||||
|  | 		chance   = 1, | ||||||
|  | 		action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
|  | 			local meta     = minetest.get_meta(pos) | ||||||
|  | 			local inv      = meta:get_inventory() | ||||||
|  | 			local eu_input = meta:get_int(tier.."_EU_input") | ||||||
|  |  | ||||||
|  | 			local machine_desc_tier = machine_desc:format(tier) | ||||||
|  | 			local machine_node      = "technic:"..ltier.."_"..machine_name | ||||||
|  | 			local machine_demand    = data.demand | ||||||
|  |  | ||||||
|  | 			-- Setup meta data if it does not exist. | ||||||
|  | 			if not eu_input then | ||||||
|  | 				meta:set_int(tier.."_EU_demand", machine_demand[1]) | ||||||
|  | 				meta:set_int(tier.."_EU_input", 0) | ||||||
|  | 				return | ||||||
|  | 			end | ||||||
|  | 		 | ||||||
|  | 			-- Power off automatically if no longer connected to a switching station | ||||||
|  | 			technic.switching_station_timeout_count(pos, tier) | ||||||
|  |  | ||||||
|  | 			local EU_upgrade, tube_upgrade = 0, 0 | ||||||
|  | 			if data.upgrade then | ||||||
|  | 				EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta) | ||||||
|  | 			end | ||||||
|  | 			if data.tube then | ||||||
|  | 				technic.handle_machine_pipeworks(pos, tube_upgrade) | ||||||
|  | 			end | ||||||
|  |  | ||||||
|  | 			local result = technic.get_recipe(typename, inv:get_list("src")) | ||||||
|  |  | ||||||
|  | 			if not result then | ||||||
|  | 				technic.swap_node(pos, machine_node) | ||||||
|  | 				meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier)) | ||||||
|  | 				meta:set_int(tier.."_EU_demand", 0) | ||||||
|  | 				return | ||||||
|  | 			end | ||||||
|  | 		 | ||||||
|  | 			if eu_input < machine_demand[EU_upgrade+1] then | ||||||
|  | 				-- Unpowered - go idle | ||||||
|  | 				technic.swap_node(pos, machine_node) | ||||||
|  | 				meta:set_string("infotext", S("%s Unpowered"):format(machine_desc_tier)) | ||||||
|  | 			elseif eu_input >= machine_demand[EU_upgrade+1] then | ||||||
|  | 				-- Powered	 | ||||||
|  | 				technic.swap_node(pos, machine_node.."_active") | ||||||
|  | 				meta:set_string("infotext", S("%s Active"):format(machine_desc_tier)) | ||||||
|  |  | ||||||
|  | 				meta:set_int("src_time", meta:get_int("src_time") + 1) | ||||||
|  | 				if meta:get_int("src_time") >= result.time / data.speed then | ||||||
|  | 					meta:set_int("src_time", 0) | ||||||
|  | 					local result_stack = ItemStack(result.output) | ||||||
|  | 					if inv:room_for_item("dst", result_stack) then | ||||||
|  | 						inv:set_list("src", result.new_input) | ||||||
|  | 						inv:add_item("dst", result_stack) | ||||||
|  | 					end | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 			meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade+1]) | ||||||
|  | 		end | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | 	technic.register_machine(tier, "technic:"..ltier.."_"..machine_name,            technic.receiver) | ||||||
|  | 	technic.register_machine(tier, "technic:"..ltier.."_"..machine_name.."_active", technic.receiver) | ||||||
|  |  | ||||||
|  | end -- End registration | ||||||
|  |  | ||||||
							
								
								
									
										88
									
								
								technic/machines/register/recipes.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,88 @@ | |||||||
|  |  | ||||||
|  | technic.recipes = {cooking = {numitems = 1}} | ||||||
|  | function technic.register_recipe_type(typename, desc, numitems) | ||||||
|  | 	numitems = numitems or 1 | ||||||
|  | 	if unified_inventory and unified_inventory.register_craft_type then | ||||||
|  | 		unified_inventory.register_craft_type(typename, { | ||||||
|  | 			description = desc, | ||||||
|  | 			height = numitems, | ||||||
|  | 			width = 1, | ||||||
|  | 		}) | ||||||
|  | 	end | ||||||
|  | 	technic.recipes[typename] = {numitems = numitems, recipes = {}} | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function get_recipe_index(items) | ||||||
|  | 	local l = {} | ||||||
|  | 	for i, stack in ipairs(items) do | ||||||
|  | 		l[i] = ItemStack(stack):get_name() | ||||||
|  | 	end | ||||||
|  | 	table.sort(l) | ||||||
|  | 	return table.concat(l, "/") | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function register_recipe(typename, data) | ||||||
|  | 	-- Handle aliases | ||||||
|  | 	for i, stack in ipairs(data.input) do | ||||||
|  | 		data.input[i] = ItemStack(stack):to_string() | ||||||
|  | 	end | ||||||
|  | 	data.output = ItemStack(data.output):to_string() | ||||||
|  | 	 | ||||||
|  | 	local recipe = {time = data.time, input = {}, output = data.output} | ||||||
|  | 	local index = get_recipe_index(data.input) | ||||||
|  | 	for _, stack in ipairs(data.input) do | ||||||
|  | 		recipe.input[ItemStack(stack):get_name()] = ItemStack(stack):get_count() | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | 	technic.recipes[typename].recipes[index] = recipe | ||||||
|  | 	if unified_inventory then | ||||||
|  | 		unified_inventory.register_craft({ | ||||||
|  | 			type = typename, | ||||||
|  | 			output = data.output, | ||||||
|  | 			items = data.input, | ||||||
|  | 			width = 0, | ||||||
|  | 		}) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function technic.register_recipe(typename, data) | ||||||
|  | 	minetest.after(0.01, register_recipe, typename, data) -- Handle aliases | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function technic.get_recipe(typename, items) | ||||||
|  | 	if typename == "cooking" then -- Already builtin in Minetest, so use that | ||||||
|  | 		local result, new_input = minetest.get_craft_result({ | ||||||
|  | 			method = "cooking", | ||||||
|  | 			width = 1, | ||||||
|  | 			items = items}) | ||||||
|  | 		-- Compatibility layer | ||||||
|  | 		if not result or result.time == 0 then | ||||||
|  | 			return nil | ||||||
|  | 		else | ||||||
|  | 			return {time = result.time, | ||||||
|  | 			        new_input = new_input.items, | ||||||
|  | 			        output = result.item} | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	local index = get_recipe_index(items) | ||||||
|  | 	local recipe = technic.recipes[typename].recipes[index] | ||||||
|  | 	if recipe then | ||||||
|  | 		local new_input = {} | ||||||
|  | 		for i, stack in ipairs(items) do | ||||||
|  | 			if stack:get_count() < recipe.input[stack:get_name()] then | ||||||
|  | 				print(stack:get_name()) | ||||||
|  | 				return nil | ||||||
|  | 			else | ||||||
|  | 				new_input[i] = ItemStack(stack) | ||||||
|  | 				new_input[i]:take_item(recipe.input[stack:get_name()]) | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		return {time = recipe.time, | ||||||
|  | 		        new_input = new_input, | ||||||
|  | 		        output = recipe.output} | ||||||
|  | 	else | ||||||
|  | 		return nil | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -11,7 +11,7 @@ function technic.register_solar_array(data) | |||||||
| 			 "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"}, | 			 "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"}, | ||||||
| 		groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, | 		groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, | ||||||
| 		sounds = default.node_sound_wood_defaults(), | 		sounds = default.node_sound_wood_defaults(), | ||||||
| 		description = S("%s Solar Array"):format(tier), | 		description = S("Arrayed Solar %s Generator"):format(tier), | ||||||
| 		active = false, | 		active = false, | ||||||
| 		drawtype = "nodebox", | 		drawtype = "nodebox", | ||||||
| 		paramtype = "light", | 		paramtype = "light", | ||||||
| @@ -19,11 +19,9 @@ function technic.register_solar_array(data) | |||||||
| 			type = "fixed", | 			type = "fixed", | ||||||
| 			fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, | 			fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, | ||||||
| 		}, | 		}, | ||||||
| 		technic = data, |  | ||||||
| 		on_construct = function(pos) | 		on_construct = function(pos) | ||||||
| 			local meta = minetest.get_meta(pos) | 			local meta = minetest.get_meta(pos) | ||||||
| 			local name = minetest.get_node(pos).name | 			local name = minetest.get_node(pos).name | ||||||
| 			local tier = minetest.registered_nodes[name].technic.tier |  | ||||||
| 			meta:set_int(tier.."_EU_supply", 0) | 			meta:set_int(tier.."_EU_supply", 0) | ||||||
| 		end, | 		end, | ||||||
| 	}) | 	}) | ||||||
| @@ -42,8 +40,7 @@ function technic.register_solar_array(data) | |||||||
| 			-- To take care of some of it solar panels do not work outside daylight hours or if | 			-- To take care of some of it solar panels do not work outside daylight hours or if | ||||||
| 			-- built below -10m | 			-- built below -10m | ||||||
| 			local pos1 = {} | 			local pos1 = {} | ||||||
| 			local data = minetest.registered_nodes[node.name].technic | 			local machine_name = S("Arrayed Solar %s Generator"):format(tier) | ||||||
| 			local machine_name = S("%s Solar Array"):format(data.tier) |  | ||||||
| 			pos1.y = pos.y + 1 | 			pos1.y = pos.y + 1 | ||||||
| 			pos1.x = pos.x | 			pos1.x = pos.x | ||||||
| 			pos1.z = pos.z | 			pos1.z = pos.z | ||||||
| @@ -60,10 +57,10 @@ function technic.register_solar_array(data) | |||||||
| 				charge_to_give = math.max(charge_to_give, 0) | 				charge_to_give = math.max(charge_to_give, 0) | ||||||
| 				charge_to_give = math.min(charge_to_give, data.power * 50) | 				charge_to_give = math.min(charge_to_give, data.power * 50) | ||||||
| 				meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..charge_to_give.."EU)") | 				meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..charge_to_give.."EU)") | ||||||
| 				meta:set_int(data.tier.."_EU_supply", charge_to_give) | 				meta:set_int(tier.."_EU_supply", charge_to_give) | ||||||
| 			else | 			else | ||||||
| 				meta:set_string("infotext", S("%s Idle"):format(machine_name)) | 				meta:set_string("infotext", S("%s Idle"):format(machine_name)) | ||||||
| 				meta:set_int(data.tier.."_EU_supply", 0) | 				meta:set_int(tier.."_EU_supply", 0) | ||||||
| 			end | 			end | ||||||
| 		end, | 		end, | ||||||
| 	}) | 	}) | ||||||
|   | |||||||
| @@ -32,8 +32,8 @@ minetest.register_node("technic:supply_converter", { | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'technic:supply_converter 1', | 	output = 'technic:supply_converter 1', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, | 		{'technic:stainless_steel_ingot', 'technic:rubber',         'technic:stainless_steel_ingot'}, | ||||||
| 		{'technic:mv_transformer',        'technic:mv_cable0',             'technic:lv_transformer'}, | 		{'technic:mv_transformer',        'technic:machine_casing', 'technic:lv_transformer'}, | ||||||
| 		{'technic:mv_cable0',             'technic:rubber',         'technic:lv_cable0'}, | 		{'technic:mv_cable0',             'technic:rubber',         'technic:lv_cable0'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
| @@ -76,6 +76,6 @@ minetest.register_abm({ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| for tier, machines in pairs(technic.machines) do | for tier, machines in pairs(technic.machines) do | ||||||
| 	technic.register_machine(tier, "technic:supply_converter", technic.battery) | 	technic.register_machine(tier, "technic:supply_converter", technic.producer_receiver) | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -35,9 +35,9 @@ local S = technic.getter | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = "technic:switching_station", | 	output = "technic:switching_station", | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{"default:steel_ingot",  "technic:lv_transformer", "default:steel_ingot"}, | 		{"",                        "technic:lv_transformer", ""}, | ||||||
| 		{"default:copper_ingot", "technic:lv_cable0",      "default:copper_ingot"}, | 		{"default:copper_ingot",    "technic:machine_casing", "default:copper_ingot"}, | ||||||
| 		{"default:steel_ingot",  "technic:lv_cable0",      "default:steel_ingot"} | 		{"technic:lv_cable0",       "technic:lv_cable0",      "technic:lv_cable0"} | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -67,7 +67,7 @@ minetest.register_node("technic:switching_station",{ | |||||||
| -- A node must be touched by the station continuously in order to function | -- A node must be touched by the station continuously in order to function | ||||||
| function technic.switching_station_timeout_count(pos, tier) | function technic.switching_station_timeout_count(pos, tier) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	timeout = meta:get_int(tier.."_EU_timeout") | 	local timeout = meta:get_int(tier.."_EU_timeout") | ||||||
| 	if timeout == 0 then | 	if timeout == 0 then | ||||||
| 		meta:set_int(tier.."_EU_input", 0) | 		meta:set_int(tier.."_EU_input", 0) | ||||||
| 	else | 	else | ||||||
| @@ -106,6 +106,9 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, all_nodes, pos, m | |||||||
| 			add_new_cable_node(PR_nodes, pos) | 			add_new_cable_node(PR_nodes, pos) | ||||||
| 		elseif machines[name] == technic.receiver then | 		elseif machines[name] == technic.receiver then | ||||||
| 			add_new_cable_node(RE_nodes, pos) | 			add_new_cable_node(RE_nodes, pos) | ||||||
|  | 		elseif machines[name] == technic.producer_receiver then | ||||||
|  | 			add_new_cable_node(PR_nodes, pos) | ||||||
|  | 			add_new_cable_node(RE_nodes, pos) | ||||||
| 		elseif machines[name] == technic.battery then | 		elseif machines[name] == technic.battery then | ||||||
| 			add_new_cable_node(BA_nodes, pos) | 			add_new_cable_node(BA_nodes, pos) | ||||||
| 		end | 		end | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
|  |  | ||||||
| technic.receiver = "RE" | technic.receiver = "RE" | ||||||
| technic.producer = "PR" | technic.producer = "PR" | ||||||
|  | technic.producer_receiver = "PR_RE" | ||||||
| technic.battery  = "BA" | technic.battery  = "BA" | ||||||
|  |  | ||||||
| technic.machines    = {} | technic.machines    = {} | ||||||
| @@ -44,7 +45,15 @@ end | |||||||
|  |  | ||||||
| -- Wear down a tool depending on the remaining charge. | -- Wear down a tool depending on the remaining charge. | ||||||
| function technic.set_RE_wear(itemstack, item_load, max_load) | function technic.set_RE_wear(itemstack, item_load, max_load) | ||||||
| 	local temp = 65536 - math.floor(item_load / max_load * 65535) | 	if (minetest.registered_items[itemstack:get_name()].wear_represents or "mechanical_wear") ~= "technic_RE_charge" then return itemstack end | ||||||
|  | 	local temp | ||||||
|  | 	if item_load == 0 then | ||||||
|  | 		temp = 0 | ||||||
|  | 	else | ||||||
|  | 		temp = 65536 - math.floor(item_load / max_load * 65535) | ||||||
|  | 		if temp > 65535 then temp = 65535 end | ||||||
|  | 		if temp < 1 then temp = 1 end | ||||||
|  | 	end | ||||||
| 	itemstack:set_wear(temp) | 	itemstack:set_wear(temp) | ||||||
| 	return itemstack | 	return itemstack | ||||||
| end | end | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								technic/sounds/technic_prospector_hit.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								technic/sounds/technic_prospector_miss.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_akalin_dust.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 240 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_alatro_dust.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 241 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_arol_dust.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 227 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_carbon_steel_dust.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 416 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_cast_iron_dust.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 420 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_fine_gold_wire.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 474 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_fine_silver_wire.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 546 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_kalite_dust.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 191 B | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB | 
| Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB | 
| Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB | 
| Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_lv_extractor_bottom.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 738 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_lv_extractor_front.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 745 B | 
							
								
								
									
										
											BIN
										
									
								
								technic/textures/technic_lv_extractor_front_active.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 770 B |