130 Commits

Author SHA1 Message Date
9004ab3322 Handheld prospecting tool
The new tool will say whether a target block type is present in a
specified region, to allow for more targeted digging.  It is deliberately
quite weak, with several limitations: only stores enough charge for a
small number of shots; target can only be set by pointing at an example
node; range is limited; accuracy is less than 100%.  Some of these
limitations should probably be ameliorated, but not entirely eliminated,
in the future when we have a better idea of game balance.

The inventory image is only a placeholder.
2014-07-07 15:15:30 +02:00
01b475c7cc Fine gold and silver wire items
Not used in any recipes yet.
2014-07-07 15:15:30 +02:00
63ab5ef5d4 Tweak supply converter recipe
The casing is now in the center of the grid, as it is for all other
machines.
2014-07-07 15:15:30 +02:00
74d54eb0b4 Consistently use cable in electric machine recipes
All electric machine recipes now include cable of the appropriate tier
as the bottom-middle ingredient, immediately below the casing ingredient.
Many LV machines were using a copper ingot in that location.
2014-07-07 15:15:30 +02:00
d9fc156960 Use machine casing in most machine recipes 2014-07-07 15:15:30 +02:00
c26f45c962 Machine casing item
The casing is intended to be an ingredient in craft recipes for machines.
It isn't actually used in any recipes yet.  Although mainly a craft
item, it is defined as a node type, mainly to get an appropriately cubic
inventory image.  It is incidentally possible to place it as a node:
this makes some sense, although the empty machine casing isn't actually
useful as a node.
2014-07-07 15:15:30 +02:00
775cb9d132 Fix fuel-fired alloy furnace
Commit ee0765804c broke the fuel-fired alloy
furnace, by removing the definition of its formspec that it requires to
set up the form upon construction.
2014-07-07 15:15:30 +02:00
fb15df52e2 Fix craft guide for alloy cooking et al
A typo in commit d55ecc39f9 made recipes
for alloy cooking, compressing, and all other craft types sharing that
machine code, to be shown with three ingredient slots instead of the
correct one or two.
2014-07-07 15:15:30 +02:00
43295b5b7f Fix brass alloying recipe
Commit d55ecc39f9 introduced a bogus
reference to "technic:copper_ingot".
2014-07-07 15:15:30 +02:00
0e6b3ce86b Add snippet to check if function exists. 2014-07-03 17:40:06 +02:00
5727a84bd8 Add missing entry to template 2014-07-03 17:24:01 +02:00
8f1c202eaa Remove most tube crafting recipes 2014-07-03 16:48:47 +02:00
d55ecc39f9 Change the recipe code to be able to handle recipes with more than one input, and use it for the alloy furnace.
Reorganize the init.lua files.
2014-07-03 15:57:39 +02:00
95fcc435f1 Make MV extractor/compressor work 2014-07-03 08:18:41 +02:00
5f2d09b8a9 Fix machine description 2014-07-03 08:17:20 +02:00
2d6f34df15 Better forcefield control dialog
The size configuration is no longer cleared when exiting the dialog with
<esc>.  The enable/disable toggle button now indicates the current state.
The name of the toggle button now varies according to state, so that
pressing the button multiple times in one state (which can arise due
to lag making the user unsure about whether the first press registered)
only makes the state change that the user requested, rather than toggling
repeatedly.
2014-07-02 21:43:34 -04:00
c0a17396bf Add MV version of compressor too, remove infinite sand-producing compressor recipe. 2014-07-02 22:45:46 +02:00
aa8af0c871 Refactor a lot of code: make only one registration function for grinder, extractor and electric furnace (compressor will follow soon) 2014-07-02 22:24:38 +02:00
88cbc6c2a7 Add MV extractor 2014-07-02 19:43:24 +02:00
2a23587445 Add registration code for extractor 2014-07-02 19:43:13 +02:00
4ea213c1e0 Reduce mithril chest to gold chest size
Due to concerns about form appearance, reduce mithril chest size to avoid
its form exceeding screen height.  This reduces it to the same size as
the gold chest.  Having two chest types of the same size looks silly now,
but will be reasonable as soon as mithril chests get their long-planned
special features.
2014-06-27 18:48:10 +02:00
96ad67b9ef Buff chest sizes
Make the inventory sizes of all the technic chests larger, to provide
a more appreciable benefit from upgrading chests, more in keeping with
the resources spent on the upgrades.

Currently the game engine doesn't handle large forms well.  The size
of an inventory slot is fixed relative to the screen height, and a
form that exceeds either screen dimension will extend off the screen,
making parts of it inaccessible.  The tallest a form can get and remain
usable is 13 slots, and even that slightly overspills the screen height.
The maximum usable width depends on the screen aspect ratio.  For the
narrowest common ratio, 5:4, the widest a form can usably get is 15 slots,
again slightly overspilling.  Combined with the layout of the chest forms,
this implies a maximum practical chest inventory size of 15x7 (= 105),
slightly smaller than the largest Minecraft chests.

To provide roughly equal size steps in the five upgrades from wooden
chest (staying at 8x4 = 32) to mithril chest, the steps need to be of
about 15 slots instead of the former 4.  The new sizes are:

    wooden   8x4  32
    iron     9x5  45
    copper  12x5  60
    silver  12x6  72
    gold    15x6  90
    mithril 15x7 105

To make upgrading from the old chest sizes to the new sizes more
convenient, the inventory size is now set not only upon chest construction
but also when accepting form input, at the same time as rewriting
the formspec.  So after upgrading the technic mod, viewing an existing
chest upgrades it to the new size.  The first time a pre-existing chest
is viewed its form will have the old dimensions, looking broken due
to the inventory background image now having the new number of slots.
The second time it is viewed the form will have the new dimensions,
and the full new number of slots will be usable.
2014-06-27 18:48:10 +02:00
51c02e9c8a Fix the chainsaw's protection check 2014-06-26 16:53:38 -04:00
9019ebe496 Clean up and improve chainsaw 2014-06-26 11:13:30 -04:00
c636582707 Make sure chainsaw drops appear above ground
A fix for https://github.com/minetest-technic/technic/issues/137
Chainsaw drops are forced to pop above ground. Also, as asl suggested,
they must not end up too high on a ledge or a pillar.

This also cleans up the code style of chainsaw.lua.
2014-06-23 18:36:43 -04:00
c394984ae5 Handle lag better in drill
If a mining drill is apparently applied to a non-pointable node, do
nothing rather than drilling as normal.  This situation usually arises
from lag, where the news of a node having been drilled didn't reach the
user quickly enough and the user thereby applied the drill twice to the
same node.  The second drill attempt would formerly consume charge and
then find that all the nodes it wanted to dig had already been removed.
2014-06-21 01:22:40 +02:00
7c4b7046cc Rationalise machine terminology
All electrically-powered machines now consistently indicate their
tier (supply voltage) in their names.  As this implies that they are
electrically powered, the furnaces no longer have "Electric" in their
names.  The fuel-fired equivalents of electric machines, which exist
for alloy furnace and furnace, now say "Fuel-Fired" to distinguish them.
(The fuel-fired alloy furnace used to say "Coal", which was inaccurate
because it uses any fuel.  The fuel-fired furnace, from the default mod,
used to just be called "Furnace", which is ambiguous.)

Electric power generators now consistently indicate their tier and have
the word "Generator" in their names.  This makes their purpose much
clearer, and makes obvious craft guide searches produce useful results.
The fuel-fired generators, previously just (ambiguously) called
"Generator", are now explicitly "Fuel-Fired".
2014-06-21 01:21:52 +02:00
f7d103cd96 Rename default chest to "Wooden Chest"
All the chests added by technic specify their material in their
description, so the description "Chest" for the default chest looks
ambiguous.  Rename it to seamlessly fit into the range of chest types.
2014-06-21 01:20:30 +02:00
23603e7f41 Full glooptest support
To support the glooptest mod (successor of gloopores), define the
gloopores lump->dust grinding recipes if either of the mods is available.
(Formerly only "gloopores" was supported.)  Define kalite dust item,
which was previously missing.  Make gloop ingots grindable to dust as the
non-gloop ingots already are; incidentally refactor this to automatically
make ingots grindable whenever the ingot can be made by cooking dust.
Add textures for all the gloop dusts.  Do the "Steel"->"Iron" renaming
for glooptest-defined tools and items.
2014-06-21 01:19:26 +02:00
c2bc4e9d56 Proper x32 texture for coal dust 2014-06-21 00:51:08 +02:00
9181666cdc Chainsaw should dig jungle leaves too. 2014-06-08 09:46:44 +02:00
799c1b3409 Fix wear_represents logic 2014-05-30 21:13:14 -04:00
ebc122fb35 Remove unused parameter to is_empty() 2014-05-30 21:00:58 -04:00
7c2f2d9630 Fix crash when trying to repair unknown items 2014-05-30 20:59:59 -04:00
b74c2d38b9 Better quarry control dialog
The size configuration is no longer cleared when exiting the dialog with
<esc>.  The enable/disable toggle button now indicates the current state.
The name of the toggle button now varies according to state, so that
pressing the button multiple times in one state (which can arise due
to lag making the user unsure about whether the first press registered)
only makes the state change that the user requested, rather than toggling
repeatedly.
2014-05-24 00:26:24 +02:00
4d20e4473e Stop quarry duplicating items
The quarry was digging via dig_node and also manually putting the node's
drops into the tube system.  This assumed that dig_node would attempt
to put the drops in the player's inventory, doing nothing if there is
no such inventory.  With the item_drop mod installed, dig_node would
instead turn the node into an item entity, so the quarry's strategy would
duplicate the item, making it appear both as an item entity in situ and
as an item in the tube.  Instead, the quarry must use remove_node when
it manually processes the drops, just like the pipeworks node breaker.
2014-05-24 00:25:19 +02:00
623fcae4a4 Fix supply converter
Its registration as a battery (BA) node didn't work.  It needs to be
registered as both a producer (PR) and a receiver (RE).
2014-05-24 00:24:30 +02:00
29429f636e Only make gloop dusts if gloopores is present 2014-05-24 00:23:48 +02:00
a5fc7ac41e Make stainless steel ingot grindable to dust
Consistent with all the other ingot/dust pairs.
2014-05-24 00:22:11 +02:00
6a08071d86 Upgrades to battery boxes too, prevent frames from moving too often (one move every second max) 2014-05-23 19:58:41 +02:00
68b7bcc28e split default iron/steel into three metals
Override the default mod's iron/steel substance, replacing it with three
metals: wrought iron (pure iron), carbon steel (iron alloyed with a little
carbon), and cast iron (iron alloyed with lots of carbon).  Wrought iron
is easiest to refine, then cast iron, and carbon steel the most difficult,
matching the historical progression.  Recipes that used default steel are
changed to use one of the three, the choice of alloy for each application
being both somewhat realistic and also matching up with game progression.

The default:steel{_ingot,block} items are identified specifically with
wrought iron.  This makes the default refining recipes work appropriately.
Iron-using recipes defined outside technic are thus necessarily
reinterpreted to use wrought iron, which is mostly appropriate.
Some objects are renamed accordingly.

Rather than use the default steel textures for wrought iron, with technic
providing textures for the other two, technic now provides textures for
all three metals.  This avoids problems that would occur with texture
packs that provide default_steel_{ingot,block} textures that are not
intended to support this wrought-iron/carbon-steel/cast-iron distinction.
A texture pack can provide a distinct set of three textures specifically
for the situation where this distinction is required.

Incidentally make grinding and alloy cooking recipes work correctly when
ingredients are specified by alias.
2014-05-22 20:57:50 +02:00
ecb53e9717 Mining lasers: don't dig the node the player is in. 2014-05-18 16:11:06 +02:00
b204090acc Fix errors when trying to charge buckets of water. 2014-05-18 14:47:05 +02:00
c7a4c05860 Fix invalid check for UI. 2014-05-06 22:11:04 +02:00
45e1f05ffc Move checking of node that should be ignore above protection checking
firing a laser into a sky while in someone land without hitting anything but air shouldn't get anyone ban
2014-05-06 04:22:51 +02:00
30adc3b651 86400 ticks is one week, not 24h 2014-05-04 15:23:34 -04:00
67b709744f Improve italian translation 2014-05-01 19:09:24 -04:00
5c689acc22 Chests sorting by Zefram_Fysh 2014-05-01 09:32:01 +02:00
00d7c9bdea Refill behaviour for power tools and cans
Supply the on_refill hook for power tools and cans, to perform appropriate
charging.  This is to be used by unified_inventory's creative-mode
refill slot.
2014-04-30 10:49:54 +01:00
0294fc8f3a various backward-compatibility aliases 2014-04-30 00:26:45 +01:00
9b64ffea8c Register craft types with unified_inventory 2014-04-30 00:22:48 +01:00
c9bf799e32 Declare unified_inventory optional dependency
Make sure unified_inventory is loaded before us if present, so that we
successfully register crafts with it.
2014-04-30 00:22:08 +01:00
03a5375e55 Fix can wear following tool workshop change
The cans used set_RE_wear() to manage their wear bars.  As that now only
sets wear for power tools, the cans need a separate function.
2014-04-30 00:22:02 +01:00
99fd5dfee5 Genericise handling of multiple meanings of wear
The tool workshop is meant to repair mechanical damage to tools, so
is at risk of `repairing' tools that use the wear bar to represent
something other than mechanical wear.  It had special-case recognition
of the water and lava cans, which use the wear bar to represent how much
content they're carrying, and wouldn't repair them.  But it didn't avoid
`repairing' RE chargeable items, which use the wear bar to represent
how much energy they have stored.  It would modify the wear bar without
actually affecting the charge, so the wear bar would jump back to the
correct place when the next charging or discharging event occurred.

To genericise, introduce a new item property, "wear_represents", which
indicates how the wear bar is used for this item.  Currently defined
values are "mechanical_wear" (straightforward damage to tools that
start out perfect), "technic_RE_charge" (electrical energy, canonically
represented in the meta rather than the wear bar), and "content_level"
(how full a container is).  For backcompat, nil is interpreted as
"mechanical_wear".  The tool workshop will only repair "mechanical_wear"
tools.  As a bonus, set_RE_wear() will only set the wear bar for
"technic_RE_charge" items: this means developers will notice if they
forget to declare wear_represents, but also means that with no further
changes it's possible to have an RE chargeable item that uses its wear
bar to represent something else.
2014-04-30 00:21:55 +01:00
ca69473664 fix tube properties for injector
By relying on another no-longer-extant definition, the injector didn't
visually connect to the tube below it.
2014-04-30 00:21:36 +01:00
1a94fdc601 fix groups for injector
The injector was in no groups, and therefore not breakable by ordinary
means.  This was because the code referred to a defined variable that
went away in the course of a rewrite of the chests code.
2014-04-30 00:21:13 +01:00
70fb21ef36 Fix search for operating flashlight
Having a never-charged flashlight in the hotbar earlier than a charged
flashlight prevented the charged flashlight being found.
2014-04-27 14:43:31 -04:00
5c59d97070 Fix discharge of flashlight and sonic screwdriver
These two tools wouldn't discharge all the way to zero through use,
unlike most chargeable items.

Incidentally remove a duplicate of the check_for_flashlight() function.
2014-04-27 14:43:31 -04:00
db79675570 Fix flashlight's light generation
The flashlight was lighting the wrong node, 1 m east of the player's lower
half, thus getting no light if the player is adjacent to an eastern wall.
Restore the old 1 m above, that coincides with the player's hands.

There was a problem with light from the flashlight getting stuck in
the map.  This arises because the flashlight's light value was 15, the
reserved value that the engine uses for sunlight.  Moving the flashlight
upwards, by jumping while it is equipped, would cause the node below it to
acquire a bogus sunlit state.  Fix this by reducing the flashlight's light
value to 14 (LIGHT_MAX), which is the maximum permitted for non-sunlight.

The light_off node type is not required.  With the light value limited
to 14, mere removal of the light node suffices to correctly recalculate
lighting.
2014-04-27 14:43:31 -04:00
60c75bce74 Fix flashlight light node declarations
The light and light_off node types should be not_in_creative_inventory,
and should drop nothing.
2014-04-27 14:43:31 -04:00
e10335e952 Fix chest log messages
All log messages about moving stuff in/into/from chests described them
as "locked", whether the chests are locked or not.  Remove that word,
so the messages make no claim about lockedness.
2014-04-27 14:43:25 -04:00
f504178421 Fix drops for active machines
Active machine nodes need to drop their inactive counterpart.  Some were
missing that declaration.
2014-04-27 14:43:00 -04:00
e748af927a Fix drill charge usage
The drills weren't taking the variable usage cost into account (either
the per-type base cost or the per-mode multiplier) when deciding whether
they have sufficient charge to use.  This could cause them to overshoot in
charge usage, although they would then clamp to zero rather than record
negative charge.  Also, for the Mk1 drill where the cost was assessed
correctly, the drill would refuse to discharge to exactly zero charge.
2014-04-27 14:43:00 -04:00
04c6f5bea3 Improve message about drill control
The message to "hold shift" makes an unwarranted assumption about the
user's keybindings.  Messages from the server should refer to a key's
game function, rather than its extragame identity.
2014-04-27 14:42:59 -04:00
18cae761af The code to connect an electrical machine to cables would only consider
the first-seen tier for which the machine was registered.  So the
switching station, which is uniquely registered for all tiers, would
only visually connect to LV cable when placed, not to MV or HV cable.
(It would function nevertheless, and cable would connect to the switching
station if placed later.)  Change to consider all tiers.  Incidentally
avoid a gratuitous iteration through all registered machines.
2014-04-27 15:57:11 +02:00
593972b156 Save chest label when exiting formspec
When using the form to edit a chest label, apply the edited label whenever the
form is submitted with the text field included, rather than only if the form's
specific "finished editing" button is used.  This supports the natural use of
<ret> to indicate that text editing is complete, which works with other text
editing forms such as that for signs.
2014-04-24 16:35:41 -04:00
628a18977b Add fir leaves to the chainsaw's timber_nodenames 2014-04-22 16:34:14 -04:00
39c41a06f4 Add german translations for all mods 2014-04-22 16:30:27 -04:00
db20250371 Fix laser discharging
Commit a6dae893d6 introduced per-version
charge cost for firing mining lasers, but applies this in addition to
the old fixed cost which it was meant to replace.  Fix by removing the
application of the fixed cost.

The same commit did successfully change the check for a laser having
sufficient charge to fire, so that's based purely on the variable cost.
As a consequence, firing a laser that has just enough charge to cover the
variable cost could cause its charge to go negative.  (For example, by
fully charging a Mk1 laser and then firing it until it empties, resulting
in a charge of -400.)  It turned out that set_RE_wear handled that badly,
producing an over-100% wear value that would wrap to a *low* wear value,
leading to the laser's wear bar looking as if it's fully charged.

To protect against silly wear values, make set_RE_wear clamp the wear
value to avoid wrapping.  Handle specially the case of a fully-discharged
tool, where there was desirable wrapping to zero.
2014-04-22 12:48:55 -04:00
44dbc75b61 Fix typo in frame and template motor recipes 2014-04-14 20:54:28 -04:00
061d1a3ab4 Fix crash when using the template tool 2014-04-14 20:52:57 -04:00
7dc21cec40 Fix steel ingot item name in laser Mk1 crafting recipe 2014-04-02 23:03:51 -04:00
179364ff8f Add translation support to technic_chests 2014-03-30 19:32:13 -04:00
5dd09aeff4 Modify mining drill charges and power usage. Also fix bug with mk3 power usage. 2014-03-30 17:40:54 -04:00
9ab5846d56 Make the charge stored by every battery box consistent with the input ingredients. 2014-03-30 17:40:54 -04:00
1b7fa38082 Reduce the charge stored by each type of crystal. 2014-03-30 17:40:54 -04:00
a6dae893d6 Modify the cost, range, and cost-per-shot of all 3 lasers. 2014-03-30 17:40:54 -04:00
49052d6f4a Revised recipe for mk1 laser and added mk2 & mk3 laser recipes. 2014-03-30 17:40:54 -04:00
Tim
252156d653 Fix CNC steel block groups 2014-03-30 14:13:11 -04:00
Tim
8684fa1733 Fix constructor description 2014-03-30 14:13:04 -04:00
Tim
8a88812b8b Make marble, granite, bronze and stainless steel blocks CNC-millable 2014-03-30 14:12:34 -04:00
Tim
0201135231 Remove duplicate CNC registration of default:tree 2014-03-30 14:09:24 -04:00
Tim
8bdbe1e451 Fix steel block node name in the CNC 2014-03-30 14:08:56 -04:00
821fba9b02 Fix CNC power drain 2014-03-26 22:34:17 -04:00
187fd90a7c Make some headers smaller in the READMEs 2014-02-27 00:32:37 -05:00
2db9121bdb Update READMEs 2014-02-27 00:30:29 -05:00
b28001e36f Infinite stacks fix 2014-01-18 13:29:06 +01:00
e1c995f654 Actually call the mvps callback 2014-01-18 13:29:06 +01:00
52e7014b7c Mesecons mvps support, better frames 2014-01-18 13:29:06 +01:00
8c1be3b48e A few fixes 2014-01-18 13:29:06 +01:00
8fba5e1140 Make those frames able to move 2014-01-18 13:29:06 +01:00
68f7d34e1b First tests 2014-01-18 13:29:06 +01:00
ebc114df71 Fixed music player 2014-01-11 12:30:10 -05:00
dc324816db fix a few more tube-based recipes 2014-01-03 22:05:35 -05:00
749df3b581 Fix all recipes that use pipeworks pneumatic tubes to follow latest changes
in pipeworks node namining conventions.
2014-01-01 23:27:51 -05:00
93b0d25cbc Use get_string for owner string 2013-12-29 10:59:04 -05:00
8e2cb0121b Fix mining drill digging in the wrong direction 2013-12-23 16:54:21 -05:00
2df417feb7 Localize generator fuel 2013-12-23 16:38:05 -05:00
018b248d51 fix crash in constructor 2013-12-21 02:26:19 -05:00
c5a2f0facc Add wrench serialization format version 2013-12-20 18:48:46 -05:00
731a82169b Rewrite wrench. INCOMPATIBLE WITH OLD ITEMS
You must place all of your picked up nodes before
updating and pick them back up after.
2013-12-20 17:07:39 -05:00
0d32e05b52 Fix stack count fetching 2013-12-20 14:38:16 -05:00
82f4862e73 Rename wrench variable 2013-12-19 22:57:25 -05:00
f3bba0aaac move inject_items to top of file (so that it's above the abm that calls it) 2013-12-18 20:41:08 -05:00
92db8e1f76 Remove config file creation
This made it difficult to change default settings
2013-12-17 20:01:01 -05:00
dd2962aba6 Rewrite flashlight 2013-12-17 19:57:24 -05:00
d8437faebc More global localiztions 2013-12-17 19:56:01 -05:00
78cacdcbc6 Rewrite chests 2013-12-17 19:15:20 -05:00
c5d287f5f5 Make tube sending faster 2013-12-17 14:37:02 -05:00
64db3d14d8 Remove duplicate ABM 2013-12-17 14:24:06 -05:00
bab8517b2a Add protection support to tools
This adds support to the chainsaw, mining drill, mining laser,
sonic screwdriver, and tree tap.
2013-12-17 14:22:10 -05:00
5cf765b2f1 Localize most variables 2013-12-17 13:56:37 -05:00
0ea1bd1fa2 Fix music player
Sounds not included
2013-12-16 18:57:56 -05:00
ae235ee8f3 more pipeworks API-change updates 2013-12-15 15:49:28 -05:00
8ef3f20c3c adapt to changes in Pipeworks API 2013-12-15 15:03:41 -05:00
f3d8b47b20 Add support for minetest.swap_node 2013-12-10 20:14:39 -05:00
818a0e5ff0 Add protection support to the sonic screwdriver 2013-12-10 19:52:40 -05:00
47b0b59884 Generators don't send items 2013-12-03 15:30:09 -05:00
7a3cd49597 Add pipeworks support to generators 2013-12-03 11:22:48 -05:00
ef70cbfbf2 Fix lava can being able to hold 16 sources 2013-12-03 11:00:41 -05:00
37acdc77f7 Move production percentage for geothermal generators to infotext 2013-12-03 10:57:16 -05:00
163457ed9a Drop full rubber tree nodes 2013-11-27 17:24:01 -05:00
05b28f553e Don't regenerate placed rubber tree trunks 2013-11-27 17:14:34 -05:00
a35db449b3 Fix generators 2013-11-27 16:56:09 -05:00
354ee6f313 Add missing translations 2013-11-27 16:18:52 -05:00
0809dd747e Externalize common functions and protect inventories 2013-11-27 12:28:56 -05:00
76a8acbe5b Use upvalues in registrations 2013-11-26 16:53:52 -05:00
08db41ee4d Don't allow tubing items into LV machines 2013-11-26 16:33:27 -05:00
bde49aca61 Fix crash when quarrying a protected area 2013-11-18 15:27:17 -05:00
2d8ff45d9a Fix crash with invalid radius 2013-11-15 00:54:17 -05:00
286 changed files with 4336 additions and 3909 deletions

View File

@ -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:
Nekogloop
ShadowNinja
VanessaE
Nore/Novatux
kpoppel
And many others for ideas/inspiring
FAQ
---
1. My technic circuit doesn't work. No power is distrubuted.
* A: Make sure you have a switching station connected.
License
-------
See mod folders for their licences
License:
LGPLv2+

View File

@ -1 +1,3 @@
default
intllib?

View File

@ -4,18 +4,33 @@
local technic = technic or {}
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_post32", "technic:concrete_post12")
minetest.register_alias("technic:concrete_post33", "technic:concrete_post3")
minetest.register_alias("technic:concrete_post34", "technic:concrete_post28")
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({
output = 'technic:rebar 6',
recipe = {
{'','', 'default:steel_ingot'},
{'','default:steel_ingot',''},
{'default:steel_ingot', '', ''},
{'','', steel_ingot},
{'',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}
minetest.register_craftitem(":technic:rebar", {
description = "Rebar",
description = S("Rebar"),
inventory_image = "technic_rebar.png",
})
minetest.register_node(":technic:concrete", {
description = "Concrete Block",
description = S("Concrete Block"),
tile_images = {"technic_concrete_block.png",},
groups = {cracky=1, level=2, concrete=1},
sounds = default.node_sound_stone_defaults(),
@ -79,7 +94,7 @@ minetest.register_node(":technic: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",},
groups={cracky=1, level=3, concrete=1},
sounds = default.node_sound_stone_defaults(),
@ -92,7 +107,7 @@ minetest.register_node(":technic:blast_resistant_concrete", {
})
minetest.register_node(":technic:concrete_post_platform", {
description = "Concrete Post Platform",
description = S("Concrete Post Platform"),
tile_images = {"technic_concrete_block.png",},
groups={cracky=1, level=2},
sounds = default.node_sound_stone_defaults(),
@ -222,7 +237,7 @@ for platform = 0, 1 do
end
minetest.register_node(":technic:concrete_post"..id, {
description = "Concrete Post",
description = S("Concrete Post"),
tiles = {"technic_concrete_block.png"},
groups = groups,
sounds = default.node_sound_stone_defaults(),

10
concrete/locale/de.txt Normal file
View 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

View File

@ -0,0 +1,8 @@
# technic_concrete translation template
Rebar =
Concrete Block =
Blast-resistant Concrete Block =
Concrete Post Platform =
Concrete Post =

View File

@ -2,3 +2,5 @@ default
moreblocks
technic_worldgen
concrete
intllib?

View File

@ -1,11 +1,17 @@
-- Minetest 0.4.6 mod: extranodes
-- 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_stair_slab_panel_micro("technic", "marble", "technic:marble",
{cracky=2, not_in_creative_inventory=1},
{"technic_marble.png"},
"Marble",
S("Marble"),
"marble",
"facedir",
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",
{cracky=2, not_in_creative_inventory=1},
{"technic_marble_bricks.png"},
"Marble Bricks",
S("Marble Bricks"),
"marble_bricks",
"facedir",
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",
{cracky=3, not_in_creative_inventory=1},
{"technic_granite.png"},
"Granite",
S("Granite"),
"granite",
"facedir",
0)
@ -29,7 +35,7 @@ register_stair_slab_panel_micro("technic", "granite", "technic:granite",
register_stair_slab_panel_micro("technic", "concrete", "technic:concrete",
{cracky=3, not_in_creative_inventory=1},
{"technic_concrete_block.png"},
"Concrete",
S("Concrete"),
"concrete",
"facedir",
0)

9
extranodes/locale/de.txt Normal file
View 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

View File

@ -0,0 +1,7 @@
# technic_extranodes translation template
Marble =
Marble Bricks =
Granite =
Concrete =

68
notes_on_iron Normal file
View 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
View 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.

View File

@ -21,6 +21,3 @@ for k, v in pairs(defaults) do
end
end
-- Create the config file if it doesn't exist
technic.config:write()

View File

@ -1,53 +1,17 @@
-- tubes crafting recipes
minetest.register_craft({
output = 'pipeworks:tube_000000 9',
recipe = {
{'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'},
{'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({
output = 'pipeworks:accelerator_tube_000000',
output = 'pipeworks:accelerator_tube_1',
recipe = {
{'technic:copper_coil', 'pipeworks:tube_000000', 'technic:copper_coil'},
{'technic:copper_coil', 'pipeworks:tube_1', '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',
output = 'pipeworks:teleport_tube_1',
recipe = {
{'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'},
}
})
@ -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({
output = 'technic:copper_coil 1',
recipe = {
{'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'},
{'default:steel_ingot', '', 'default:steel_ingot'},
{'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'},
{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'},
{'technic:wrought_iron_ingot', '', 'technic:wrought_iron_ingot'},
{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'},
}
})
minetest.register_craft({
output = 'technic:motor',
recipe = {
{'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'},
{'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'},
{'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'},
{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'},
{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'},
{'technic:carbon_steel_ingot', 'default:copper_ingot', 'technic:carbon_steel_ingot'},
}
})
minetest.register_craft({
output = 'technic:lv_transformer',
recipe = {
{'default:iron_lump', 'default:iron_lump', 'default:iron_lump'},
{'technic:copper_coil', 'default:iron_lump', 'technic:copper_coil'},
{'default:iron_lump', 'default:iron_lump', 'default:iron_lump'},
{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'},
{'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil'},
{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'},
}
})
minetest.register_craft({
output = 'technic:mv_transformer',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'technic:copper_coil', 'default: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'},
{'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil'},
{'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", {
description = "",
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
minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv)
if itemstack:get_name() == "technic:nothing" then
@ -186,3 +172,30 @@ if minetest.register_craft_predict then
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" }
},
})

View File

@ -4,3 +4,4 @@ pipeworks
mesecons
mesecons_mvps?
intllib?
unified_inventory?

View File

@ -1,10 +1,45 @@
function get_item_meta (string)
if string.find(string, "return {") then
return minetest.deserialize(string)
else return nil
end
minetest.swap_node = minetest.swap_node or function(pos, node)
local oldmeta = minetest.get_meta(pos):to_table()
minetest.set_node(pos, node)
minetest.get_meta(pos):from_table(oldmeta)
end
function set_item_meta (table)
return minetest.serialize(table)
-- Only changes name, keeps other params
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
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
--------------------------------------------------------------------------------

View File

@ -40,27 +40,6 @@ dofile(modpath.."/tools/init.lua")
-- Aliases for legacy node/item names
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
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))
end

View File

@ -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"),
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
tool_capabilities = {
max_drop_level = 0,
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"),
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
tool_capabilities = {
max_drop_level = 0,
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"),
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
tool_capabilities = {
max_drop_level = 0,
groupcaps = {
@ -74,6 +80,16 @@ minetest.register_craftitem("technic:fine_copper_wire", {
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", {
description = S("Copper Coil"),
inventory_image = "technic_copper_coil.png",
@ -138,3 +154,12 @@ minetest.register_craftitem("technic:carbon_cloth", {
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(),
})

View File

@ -17,6 +17,10 @@ technic.legacy_nodenames = {
["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active",
["technic:grinder"] = "technic:lv_grinder",
["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_cable"] = "technic:hv_cable0",
["technic:lv_cable"] = "technic:lv_cable0",
@ -24,6 +28,7 @@ technic.legacy_nodenames = {
["technic:mv_battery_box"] = "technic:mv_battery_box0",
["technic:generator"] = "technic:lv_generator",
["technic:generator_active"] = "technic:lv_generator_active",
["technic:iron_dust"] = "technic:wrought_iron_dust",
}
for old, new in pairs(technic.legacy_nodenames) do

188
technic/locale/de.txt Normal file
View 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 =

View File

@ -1,4 +1,3 @@
# es.txt
# Spanish Translation for Technic Mod
# Traduccion al Español del Mod Technic
# Autor: Diego Martínez <kaeza>
@ -33,8 +32,10 @@ Rubber Fiber = Fibra de Hule
## Machine misc
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)
%s Active = %s Activo
%s Enabled =
%s Idle = %s Quieto
%s Unpowered = %s Sin Energia
%s Out Of Fuel = %s Sin Combustible
@ -51,29 +52,38 @@ Enable/Disable = Habilitar/Deshabilitar
%s Alloy Furnace = Horno de Aleacion %s
%s Battery Box = Caja de Bateria %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 Generator = Generador %s
%s Solar Array = Panel Solar %s
%s Music Player = Reproductor de Musica %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
Switching Station = Estacion de Conmutacion
Battery Box = Caja de Baterias
Quarry = Cantera
CNC Machine = Maquina CNC
Music Player = Reproductor de Musica
Extractor = Extractor
Coal Alloy Furnace = Horno de Aleacion a Carbon
Tool WorkShop = Taller de Herramientas
Fuel-Fired Alloy Furnace = Horno de Aleacion a Carbon
Fuel-Fired Furnace = Horno a Carbon
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 Core = Nucleo de Reactor Nuclear
Wind Mill = Molino de Viento
Wind Mill Frame = Armazon de Molino de Viento
Solar Panel = Panel Solar
## Machine-specific
# $1: Pruduced EU
@ -113,7 +123,6 @@ Slope Edge = Borde de Rampa
Slope = Rampa
Element T = Elemento T
Cylinder = Cilindro
Steel = Acero
Cobble = Adoquines
Stone = Piedra
Brick = Ladrillo
@ -130,19 +139,22 @@ Alatro = Alatro
Arol = Arol
Brass = Laton
Bronze = Bronce
Carbon Steel = Acero al Carbono
Cast Iron = Hierro Fundido
Chromium = Cromo
Coal = Carbon
Copper = Cobre
Gold = Oro
Iron = Hierro
Mithril = Mitrilo
Silver = Plata
Stainless Steel = Acero Inoxidable
Talinite = Talinita
Tin = Estanio
Wrought Iron = Hierro Forjado
Zinc = Zinc
## Tools
RE Battery =
Water Can = Bidon de Agua
Lava Can = Bidon de Lava
Chainsaw = Motosierra
@ -151,7 +163,7 @@ Flashlight = Linterna
3 nodes tall. = 3 nodos de alto.
3 nodes wide. = 3 nodos de ancho.
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 = Taladro 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
Tree Tap = Grifo de Arbol
## Craft descriptions
Alloy cooking =
Grinding =
Compressing =
Extracting =

View File

@ -29,9 +29,11 @@ Rubber Fiber = Fibra di gomma
## Machine misc
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)
%s Active = %s Attivo
%s Disabled = %s Disabilitato
%s Enabled =
%s Idle = %s Inattivo
%s Improperly Placed = %s Piazzato impropiamente
%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
Enable/Disable = Abilita/Disabilita
Range = Raggio
Upgrade Slots =
In: = Ingresso:
Out: = Uscita:
Slot %d =
Mode: %s = Modalità: %s
single items = Singolo elemento
whole stacks = pila completa
## Machine names
# $1: Tier
%s Alloy Furnace = %s Fornace per leghe
%s Battery Box = %s Box batterie
%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 Generator = %s Generatore
%s Solar Array = %s Pannello Solare
%s Music Player = Music Player %s
%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
Supply Converter = Trasformatore
Switching Station = Stazione di controllo
CNC Machine = Tornio CNC
Coal Alloy Furnace = Fornace per leghe 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
Fuel-Fired Alloy Furnace = Fornace per leghe a carbone
Fuel-Fired Furnace = Fornace a carbone
Wind Mill Frame = Pala eolica
Forcefield Emitter = Emettitore di campo di forza
Forcefield = Campo di forza
Nuclear Reactor Core = Reattore nucleare
Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare
Quarry = Cava
## Machine-specific
# $1: Pruduced EU
@ -82,39 +99,41 @@ Power level = Livello di potenza
# $1: Machine name $2: Supply $3: Demand
%s. Supply: %d Demand: %d = %s. Prodotto: %d Consumato: %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
Cylinder = Cilindro
Element Cross = Elemento a croce
Element Cross Double = Elemento a croce doppio
Element Edge =
Element Edge Double =
Element Edge = Elemento bordo
Element Edge Double = Elemento bordo doppio
Element End = Elemento finale
Element End Double = Elemento finale doppio
Element Straight =
Element Straight Double =
Element Straight = Elemento dritto
Element Straight Double = Elemento dritto doppio
Element T = Elemento a T
Element T Double = Elemento a T doppio
Horizontal Cylinder = Cilindro orizzontale
One Curved Edge Block =
One Curved Edge Block = Blocco con bordo curvo
Pyramid = Piramide
Slope =
Slope Edge =
Slope Inner Edge =
Slope Lying =
Slope Upside Down =
Slope Upside Down Edge =
Slope Upside Down Inner Edge =
Slope = Inclinato
Slope Edge = Bordo inclinato
Slope Inner Edge = Bordo interno inclinato
Slope Lying = Pendenza bugiarda
Slope Upside Down = Pendenza capovolta
Slope Upside Down Edge = Bordo inclinato capovolto
Slope Upside Down Inner Edge = Bordo interno inclinato capovolto
Sphere = Sfera
Spike =
Spike = Spuntone
Stick = Bastone
Two Curved Edge Block =
Two Curved Edge Block = Blocco con bordo a doppia curva
Brick = Mattone
Cobble = Ciottolato
Dirt = Terra
Leaves = Foglie
Sandstone = Arenaria
Steel = Acciaio
Stone = Pietra
Tree = Albero
Wooden = Legno
@ -127,19 +146,22 @@ Alatro = Alatro
Arol = Arol
Brass = Ottone
Bronze = Bronzo
Carbon Steel = Acciaio al Carbonio
Cast Iron = Ghisa
Chromium = Cromo
Coal = Carbone
Copper = Rame
Gold = Oro
Iron = Ferro
Mithril = Mithril
Silver = Argento
Stainless Steel = Acciaio Inossidabile
Talinite = Talinite
Tin = Stagno
Wrought Iron = Ferro Battuto
Zinc = Zinco
## Tools
RE Battery =
Water Can = Serbatoio d'acqua
Lava Can = Serbatoio di lava
Chainsaw = Motosega
@ -148,10 +170,16 @@ Flashlight = Torcia
3 nodes tall. = 3 nodi in altezza.
3 nodes wide. = 3 nodi in larghezza.
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 = Trivella da miniera mk%d
Mining Laser Mk%d = Laser da miniera mk%d
Single node. = Nodo singolo.
Sonic Screwdriver = Cacciavite sonico
Tree Tap = Batti albero
## Craft descriptions
Alloy cooking = Cottura lege
Grinding = Macinazione
Compressing = Compressione
Extracting = Estrazione

View File

@ -32,11 +32,14 @@ Rubber Fiber =
## Machine misc
Machine cannot be removed because it is not empty =
Inventory move disallowed due to protection =
# $1: Machine name (Includes tier)
%s Active =
%s Disabled =
%s Enabled =
%s Idle =
%s Improperly Placed =
%s is empty =
%s Unpowered =
%s Out Of Fuel =
%s Has Bad Cabling =
@ -44,36 +47,51 @@ Machine cannot be removed because it is not empty =
%s Finished =
Enable/Disable =
Range =
Upgrade Slots =
In: =
Out: =
Slot %d =
Mode: %s =
single items =
whole stacks =
## Machine names
# $1: Tier
%s Alloy Furnace =
%s Battery Box =
%s Cable =
%s Electric Furnace =
%s CNC Machine =
%s Compressor =
%s Extractor =
%s Forcefield Emitter =
%s Furnace =
%s Grinder =
%s Generator =
%s Solar Array =
%s Music Player =
%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 =
Supply Converter =
Switching Station =
CNC Machine =
Coal Alloy Furnace =
Extractor =
Compressor =
Solar Panel =
Geothermal Generator =
Music Player =
Water Mill =
Tool WorkShop =
Wind Mill =
Fuel-Fired Alloy Furnace =
Fuel-Fired Furnace =
Wind Mill Frame =
Forcefield Emitter =
Forcefield =
Nuclear Reactor Core =
Nuclear Reactor Rod Compartment =
Quarry =
## Machine-specific
# $1: Pruduced EU
@ -85,6 +103,9 @@ Power level =
# $1: Machine name $2: Supply $3: Demand
%s. Supply: %d Demand: %d =
Production at %d%% =
Choose Milling Program: =
Slim Elements half / normal height: =
Current track %s =
## CNC
Cylinder =
@ -117,7 +138,6 @@ Cobble =
Dirt =
Leaves =
Sandstone =
Steel =
Stone =
Tree =
Wooden =
@ -130,19 +150,22 @@ Alatro =
Arol =
Brass =
Bronze =
Carbon Steel =
Cast Iron =
Chromium =
Coal =
Copper =
Gold =
Iron =
Mithril =
Silver =
Stainless Steel =
Talinite =
Tin =
Wrought Iron =
Zinc =
## Tools
RE Battery =
Water Can =
Lava Can =
Chainsaw =
@ -151,7 +174,7 @@ Flashlight =
3 nodes tall. =
3 nodes wide. =
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 =
Mining Laser Mk%d =
@ -159,4 +182,8 @@ Single node. =
Sonic Screwdriver =
Tree Tap =
## Craft descriptions
Alloy cooking =
Grinding =
Compressing =
Extracting =

View File

@ -10,10 +10,12 @@ minetest.register_craft({
technic.register_battery_box({
tier = "HV",
max_charge = 1500000,
max_charge = 1000000,
charge_rate = 100000,
discharge_rate = 400000,
charge_step = 10000,
discharge_step = 40000,
upgrade = 1,
tube = 1,
})

View File

@ -14,9 +14,9 @@ local S = technic.getter
minetest.register_craft({
output = 'technic:forcefield_emitter_off',
recipe = {
{'default:mese', 'technic:deployer_off', 'default:mese' },
{'technic:deployer_off', 'technic:motor', 'technic:deployer_off'},
{'default:mese', 'technic:deployer_off', 'default:mese' },
{'default:mese', 'technic:motor', 'default:mese' },
{'technic:deployer_off', 'technic:machine_casing', 'technic:deployer_off'},
{'default:mese', 'technic:hv_cable0', 'default:mese' },
}
})
@ -62,35 +62,34 @@ local function update_forcefield(pos, range, active)
vm:update_map()
end
local get_forcefield_formspec = function(range)
return "size[3,1.5]"..
"field[1,0.5;2,1;range;"..S("Range")..";"..range.."]"..
"button[0,1;3,1;toggle;"..S("Enable/Disable").."]"
local function set_forcefield_formspec(meta)
local formspec = "size[5,1.5]"..
"field[2,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]"
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
local forcefield_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
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)
if fields.range then
local range = tonumber(fields.range) or 0
-- Smallest field is 5. Anything less is asking for trouble.
-- Largest is 20. It is a matter of pratical node handling.
-- At the maximim range updating the forcefield takes about 0.2s
range = math.max(range, 5)
range = math.min(range, 20)
if meta:get_int("range") ~= range then
update_forcefield(pos, meta:get_int("range"), false)
meta:set_int("range", range)
end
end
-- Smallest field is 5. Anything less is asking for trouble.
-- Largest is 20. It is a matter of pratical node handling.
-- At the maximim range updating the forcefield takes about 0.2s
range = math.max(range, 5)
range = math.min(range, 20)
if meta:get_int("range") ~= range then
update_forcefield(pos, meta:get_int("range"), false)
meta:set_int("range", range)
meta:set_string("formspec", get_forcefield_formspec(range))
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 = {
@ -105,7 +104,7 @@ local mesecons = {
}
minetest.register_node("technic:forcefield_emitter_off", {
description = S("Forcefield Emitter"),
description = S("%s Forcefield Emitter"):format("HV"),
tiles = {"technic_forcefield_emitter_off.png"},
groups = {cracky = 1},
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("range", 10)
meta:set_int("enabled", 0)
meta:set_string("formspec", get_forcefield_formspec(10))
meta:set_string("infotext", S("Forcefield Emitter"))
meta:set_string("infotext", S("%s Forcefield Emitter"):format("HV"))
set_forcefield_formspec(meta)
end,
mesecons = mesecons
})
minetest.register_node("technic:forcefield_emitter_on", {
description = S("Forcefield Emitter"),
description = S("%s Forcefield Emitter"):format("HV"),
tiles = {"technic_forcefield_emitter_on.png"},
groups = {cracky = 1, not_in_creative_inventory=1},
drop = "technic:forcefield_emitter_off",
@ -140,7 +139,7 @@ minetest.register_node("technic:forcefield_emitter_on", {
})
minetest.register_node("technic:forcefield", {
description = S("Forcefield"),
description = S("%s Forcefield"):format("HV"),
sunlight_propagates = true,
drawtype = "glasslike",
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_demand = meta:get_int("HV_EU_demand")
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
technic.switching_station_timeout_count(pos, "HV")
@ -178,7 +177,7 @@ minetest.register_abm({
if node.name == "technic:forcefield_emitter_on" then
meta:set_int("HV_EU_demand", 0)
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))
return
end
@ -186,11 +185,11 @@ minetest.register_abm({
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
if node.name == "technic:forcefield_emitter_on" then
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
elseif eu_input >= power_requirement 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))
end
update_forcefield(pos, meta:get_int("range"), true)

View File

@ -1,14 +1,13 @@
minetest.register_alias("hv_generator", "technic:hv_generator")
minetest.register_craft({
output = 'technic:hv_generator',
recipe = {
{'technic:stainless_steel_ingot', 'technic:mv_generator', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_000000', 'technic:hv_transformer', 'pipeworks:tube_000000'},
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'},
{'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})

View File

@ -3,11 +3,16 @@ technic.register_tier("HV", "High Voltage")
local path = technic.modpath.."/machines/HV"
-- Wiring stuff
dofile(path.."/cables.lua")
dofile(path.."/quarry.lua")
dofile(path.."/forcefield.lua")
dofile(path.."/battery_box.lua")
-- Generators
dofile(path.."/solar_array.lua")
dofile(path.."/nuclear_reactor.lua")
dofile(path.."/generator.lua")
-- Machines
dofile(path.."/quarry.lua")
dofile(path.."/forcefield.lua")

View File

@ -1,6 +1,6 @@
-- The enriched uranium rod driven EU generator.
-- 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.
--
-- 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',
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:hv_cable', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', 'technic:machine_casing', '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", {
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",
"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)
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)
-- Signal to the switching station that this device burns some
-- sort of fuel and needs special handling
@ -75,17 +75,10 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
local inv = meta:get_inventory()
inv:set_size("src", 6)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
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
else
return true
end
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:hv_nuclear_reactor_core_active", {
@ -103,17 +96,10 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
type = "fixed",
fixed = nodebox
},
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
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
else
return true
end
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,
})
local check_reactor_structure = function(pos)
@ -208,7 +194,7 @@ minetest.register_abm({
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
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
if burn_time >= burn_ticks or burn_time == 0 then
@ -228,7 +214,7 @@ minetest.register_abm({
if correct_fuel_count == 6 and
check_reactor_structure(pos) then
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)
for idx, srcstack in pairs(srclist) do
srcstack:take_item()
@ -240,7 +226,7 @@ minetest.register_abm({
meta:set_int("HV_EU_supply", 0)
meta:set_int("burn_time", 0)
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
damage_nearby_players(pos)
if not check_reactor_structure(pos) then

View File

@ -3,42 +3,37 @@ local S = technic.getter
minetest.register_craft({
recipe = {
{"default:steelblock", "pipeworks:filter", "default:steelblock"},
{"default:steelblock", "technic:motor", "default:steelblock"},
{"default:steelblock", "technic:diamond_drill_head", "default:steelblock"}},
{"technic:carbon_steel_block", "pipeworks:filter", "technic:carbon_steel_block"},
{"technic:motor", "technic:machine_casing", "technic:diamond_drill_head"},
{"technic:carbon_steel_block", "technic:hv_cable0", "technic:carbon_steel_block"}},
output = "technic:quarry",
})
local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes
local quarry_max_depth = 100
local function get_quarry_formspec(size)
return "size[3,1.5]"..
"field[1,0.5;2,1;size;Radius;"..size.."]"..
"button[0,1;3,1;toggle;"..S("Enable/Disable").."]"
local function set_quarry_formspec(meta)
local formspec = "size[3,1.5]"..
"field[1,0.5;2,1;size;Radius;"..meta:get_int("size").."]"
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
local function quarry_receive_fields(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local size = tonumber(fields.size)
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.min(size, 8)
if meta:get_int("size") ~= size then
if fields.size then
local size = tonumber(fields.size) or 0
size = math.max(size, 2)
size = math.min(size, 8)
meta:set_int("size", size)
meta:set_string("formspec", get_quarry_formspec(size))
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
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 drops = {}
local dig_y = meta:get_int("dig_y")
local owner = meta:get_int("owner")
local owner = meta:get_string("owner")
local vm = VoxelManip()
local p1 = vector.new(
@ -104,19 +99,15 @@ local function quarry_dig(pos, center, size)
end
if minetest.is_protected and minetest.is_protected(digpos, owner) then
meta:set_int("enabled", 0)
return
set_quarry_formspec(meta)
return {}
end
dig_y = digpos.y
local node = minetest.get_node(digpos)
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 = {}
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, "")
end
elseif not (dig_y < pos.y - quarry_max_depth) then
dig_y = dig_y - 16
@ -128,7 +119,7 @@ end
local function send_items(items, pos, node)
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:setvelocity(vector.new(0, 1, 0))
tube_item:setacceleration({x=0, y=0, z=0})
@ -136,29 +127,28 @@ local function send_items(items, pos, node)
end
minetest.register_node("technic:quarry", {
description = S("Quarry"),
tiles = {"default_steel_block.png", "default_steel_block.png",
"default_steel_block.png", "default_steel_block.png",
"default_steel_block.png^default_tool_mesepick.png", "default_steel_block.png"},
description = S("%s Quarry"):format("HV"),
tiles = {"technic_carbon_steel_block.png", "technic_carbon_steel_block.png",
"technic_carbon_steel_block.png", "technic_carbon_steel_block.png",
"technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png"},
paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1},
tube = {
connect_sides = {top = 1},
},
on_construct = function(pos)
local size = 4
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Quarry"))
meta:set_string("formspec", get_quarry_formspec(4))
meta:set_int("size", size)
meta:set_string("infotext", S("%s Quarry"):format("HV"))
meta:set_int("size", 4)
set_quarry_formspec(meta)
meta:set_int("dig_y", pos.y)
end,
after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name())
tube_scanforobjects(pos)
pipeworks.scan_for_tube_objects(pos)
end,
after_dig_node = tube_scanforobjects,
after_dig_node = pipeworks.scan_for_tube_objects,
on_receive_fields = quarry_receive_fields,
})
@ -173,7 +163,7 @@ minetest.register_abm({
local demand = 10000
local center = get_quarry_center(pos, size)
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")

View File

@ -4,9 +4,9 @@
minetest.register_craft({
output = 'technic:solar_array_hv 1',
recipe = {
{'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'},
{'default:steel_ingot', 'technic:hv_transformer', 'default:steel_ingot'},
{'', 'technic:hv_cable0', ''},
{'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'},
{'technic:carbon_steel_ingot', 'technic:hv_transformer', 'technic:carbon_steel_ingot'},
{'', 'technic:hv_cable0', ''},
}
})

View File

@ -4,11 +4,11 @@
minetest.register_craft({
output = 'technic:lv_alloy_furnace',
recipe = {
{'default:brick', 'default:brick', 'default:brick'},
{'default:brick', '', 'default:brick'},
{'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'},
{'default:brick', 'default:brick', 'default:brick'},
{'default:brick', 'technic:machine_casing', 'default:brick'},
{'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}})

View File

@ -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({
output = 'technic:lv_battery_box0',
recipe = {
{'technic:battery', 'group:wood', 'technic:battery'},
{'technic:battery', 'default:copper_ingot', 'technic:battery'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'group:wood', 'group:wood', 'group:wood'},
{'technic:battery', 'technic:machine_casing', 'technic:battery'},
{'technic:battery', 'technic:lv_cable0', 'technic:battery'},
}
})
technic.register_battery_box({
tier = "LV",
max_charge = 50000,
max_charge = 40000,
charge_rate = 1000,
discharge_rate = 4000,
charge_step = 500,

View File

@ -37,7 +37,7 @@ local twosize_products = {
local cnc_formspec =
"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[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; ]"..
@ -56,7 +56,7 @@ local cnc_formspec =
"image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]"..
"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.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[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;]"..
"label[4, 5.5;Out:]"..
"label[4, 5.5;"..S("Out:").."]"..
"list[current_name;dst;5,5.5;4,1;]"..
"list[current_player;main;0,7;8,4;]"
@ -127,7 +127,7 @@ end
-- The actual block inactive state
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",
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
drawtype = "nodebox",
@ -143,45 +143,33 @@ minetest.register_node("technic:cnc", {
legacy_facedir_simple = true,
on_construct = function(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_string("formspec", cnc_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,
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,
on_receive_fields = form_handler,
})
-- Active state block
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",
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"},
paramtype2 = "facedir",
drop = "technic:cnc",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
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
end
return true
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,
on_receive_fields = form_handler,
})
@ -194,36 +182,29 @@ minetest.register_abm({
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
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 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
technic.switching_station_timeout_count(pos, "LV")
local result = meta:get_string("cnc_product")
if inv:is_empty("src") or
(not minetest.registered_nodes[result]) or
(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("cnc_product", "")
meta:set_int("LV_EU_demand", 0)
return
end
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))
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_int("src_time", meta:get_int("src_time") + 1)
if meta:get_int("src_time") >= 3 then -- 3 ticks per output
@ -248,8 +229,8 @@ minetest.register_craft({
output = 'technic:cnc',
recipe = {
{'default:glass', 'technic:diamond_drill_head', 'default:glass'},
{'technic:control_logic_unit', 'technic:motor', 'default:steel_ingot'},
{'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'},
{'technic:control_logic_unit', 'technic:machine_casing', 'technic:motor'},
{'technic:carbon_steel_ingot', 'technic:lv_cable0', 'technic:carbon_steel_ingot'},
},
})

View File

@ -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_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
-------
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},
{"default_tree.png"},
S("Tree"))
-- STEEL
--------
technic.cnc.register_all("default:steel",
{snappy=1, bendy=2, cracky=1, melty=2, level=2, not_in_creative_inventory=1},
{"default_steel_block.png"},
S("Steel"))
-- WROUGHT IRON
---------------
technic.cnc.register_all("default:steelblock",
{cracky=1, level=2, not_in_creative_inventory=1},
{"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"))

View File

@ -1,5 +1,5 @@
-- Coal driven alloy furnace. This uses no EUs:
-- Fuel driven alloy furnace. This uses no EUs:
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", {
description = S("Coal Alloy Furnace"),
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_side.png", "technic_coal_alloy_furnace_front.png"},
description = machine_name,
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_side.png", "technic_coal_alloy_furnace_front.png"},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", coal_alloy_furnace_formspec)
meta:set_string("infotext", S("Coal Alloy Furnace"))
meta:set_string("formspec", formspec)
meta:set_string("infotext", machine_name)
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("src2", 1)
inv:set_size("src", 2)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not (inv:is_empty("fuel") or inv:is_empty("dst") or inv:is_empty("src") or inv:is_empty("src2") )then
return false
end
return true
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:coal_alloy_furnace_active", {
description = "Alloy Furnace",
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_side.png", "technic_coal_alloy_furnace_front_active.png"},
description = machine_name,
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_side.png", "technic_coal_alloy_furnace_front_active.png"},
paramtype2 = "facedir",
light_source = 8,
drop = "technic:coal_alloy_furnace",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not (inv:is_empty("fuel") or inv:is_empty("dst") or
inv:is_empty("src") or inv:is_empty("src2")) then
return false
end
return true
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_abm({
@ -68,17 +70,14 @@ minetest.register_abm({
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
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 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({
"fuel_totaltime",
@ -91,33 +90,22 @@ minetest.register_abm({
end
-- Get what to cook if anything
local srcstack = inv:get_stack("src", 1)
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 result = technic.get_recipe("alloy", inv:get_list("src"))
local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
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)
if meta:get_int("src_time") == 6 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
if meta:get_int("src_time") >= result.time 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
else
meta:set_int("src_time", 0)
@ -128,30 +116,25 @@ minetest.register_abm({
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
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",
"size[8,9]"..
"label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100 - percent)..":default_furnace_fire_fg.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;src;2,1;2,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]")
return
end
-- FIXME: Make this look more like the electrical version.
-- 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)
local recipe = technic.get_recipe("alloy", inv:get_list("src"))
if recipe then
if not recipe then
if was_active then
meta:set_string("infotext", "Furnace is empty")
hacky_swap_node(pos, "technic:coal_alloy_furnace")
meta:set_string("infotext", S("%s is empty"):format(machine_name))
technic.swap_node(pos, "technic:coal_alloy_furnace")
meta:set_string("formspec", formspec)
end
return
@ -167,7 +150,7 @@ minetest.register_abm({
if fuel.time <= 0 then
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)
return
end

View 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

View File

@ -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({
output = 'technic:compressor',
output = 'technic:lv_compressor',
recipe = {
{'default:stone', 'default:stone', 'default:stone'},
{'mesecons:piston', 'technic:motor', 'mesecons:piston'},
{'default:stone', 'technic:lv_cable0', 'default:stone'},
{'default:stone', 'technic:motor', 'default:stone'},
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'},
{'default:stone', 'technic:lv_cable0', 'default:stone'},
}
})
local compressor_formspec =
"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)
technic.register_compressor({tier = "LV", demand = {300}, speed = 1})

View File

@ -5,9 +5,9 @@
minetest.register_craft({
output = 'technic:electric_furnace',
recipe = {
{'default:cobble', 'default:cobble', 'default:cobble'},
{'default:cobble', '', 'default:cobble'},
{'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'},
{'default:cobble', 'default:cobble', 'default:cobble'},
{'default:cobble', 'technic:machine_casing', 'default:cobble'},
{'default:cobble', 'technic:lv_cable0', 'default:cobble'},
}
})

View File

@ -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({
output = 'technic:extractor',
output = 'technic:lv_extractor',
recipe = {
{'technic:treetap', 'technic:motor', 'technic:treetap'},
{'technic:treetap', 'technic:lv_cable0', 'technic:treetap'},
{'', '', ''},
{'technic:treetap', 'technic:motor', 'technic:treetap'},
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
{'', 'technic:lv_cable0', ''},
}
})
local extractor_formspec =
"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)
technic.register_extractor({tier = "LV", demand = {300}, speed = 1})

View File

@ -8,9 +8,9 @@ minetest.register_alias("lv_generator", "technic:lv_generator")
minetest.register_craft({
output = 'technic:lv_generator',
recipe = {
{'default:stone', 'default:stone', 'default:stone'},
{'default:stone', '', 'default:stone'},
{'default:stone', 'default:copper_ingot', 'default:stone'},
{'default:stone', 'default:stone', 'default:stone'},
{'default:stone', 'technic:machine_casing', 'default:stone'},
{'default:stone', 'technic:lv_cable0', 'default:stone'},
}
})

View File

@ -10,24 +10,18 @@ local S = technic.getter
minetest.register_craft({
output = 'technic:geothermal',
recipe = {
{'default:stone', 'default:stone', 'default:stone'},
{'default:copper_ingot', 'default:diamond', 'default:copper_ingot'},
{'default:stone', 'default:copper_ingot', 'default:stone'},
{'default:stone', 'default:diamond', 'default:stone'},
{'default:copper_ingot', 'technic:machine_casing', 'default:copper_ingot'},
{'default:stone', 'technic:lv_cable0', 'default:stone'},
}
})
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", {
description = S("Geothermal Generator"),
description = S("Geothermal %s Generator"):format("LV"),
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"},
paramtype2 = "facedir",
@ -36,14 +30,13 @@ minetest.register_node("technic:geothermal", {
sounds = default.node_sound_wood_defaults(),
on_construct = function(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_string("formspec", geothermal_formspec)
end,
})
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",
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
paramtype2 = "facedir",
@ -102,17 +95,15 @@ minetest.register_abm({
meta:set_int("LV_EU_supply", eu_supply)
end
meta:set_string("formspec",
"invsize[8,4;]"..
"label[0,0;"..S("Geothermal Generator").."]"..
"label[4,0;"..S("Production at %d%%"):format(production_level).."]")
meta:set_string("infotext",
S("Geothermal %s Generator"):format("LV").." ("..production_level.."%)")
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
end
if production_level == 0 then
hacky_swap_node(pos, "technic:geothermal")
technic.swap_node(pos, "technic:geothermal")
meta:set_int("LV_EU_supply", 0)
end
end

View File

@ -3,9 +3,9 @@ minetest.register_alias("grinder", "technic:grinder")
minetest.register_craft({
output = 'technic:grinder',
recipe = {
{'default:desert_stone', 'default:desert_stone', 'default:desert_stone'},
{'default:desert_stone', 'default:diamond', 'default:desert_stone'},
{'default:stone', 'moreores:copper_ingot', 'default:stone'},
{'default:desert_stone', 'default:diamond', 'default:desert_stone'},
{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'},
{'default:stone', 'technic:lv_cable0', 'default:stone'},
}
})

View File

@ -3,20 +3,31 @@ technic.register_tier("LV", "Low Voltage")
local path = technic.modpath.."/machines/LV"
-- Wiring stuff
dofile(path.."/cables.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_array.lua")
dofile(path.."/geothermal.lua")
dofile(path.."/water_mill.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.."/music_player.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_api.lua")
dofile(path.."/cnc_nodes.lua")
dofile(path.."/extractor.lua")
dofile(path.."/compressor.lua")

View File

@ -7,15 +7,17 @@ minetest.register_alias("music_player", "technic:music_player")
minetest.register_craft({
output = 'technic:music_player',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'default:diamond', 'default:diamond', 'default:diamond'},
{'default:stone', 'default:copper_ingot', 'default:stone'},
{'group:wood', 'default:diamond', 'group:wood'},
{'default:diamond', 'technic:machine_casing', 'default:diamond'},
{'default:stone', 'technic:lv_cable0', 'default:stone'},
}
})
local music_handles = {}
local music_player_formspec =
"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[5,1;1,1;track2;2]"..
"button[6,1;1,1;track3;3]"..
@ -27,24 +29,30 @@ local music_player_formspec =
"button[6,3;1,1;track9;9]"..
"button[4,4;1,2;play;Play]"..
"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", {
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",
"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},
sounds = default.node_sound_wood_defaults(),
on_construct = function(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("current_track", 1)
meta:set_string("formspec", music_player_formspec)
end,
on_receive_fields = function(pos, formanme, fields, sender)
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")
if fields.track1 then current_track = 1 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_string("formspec",
"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[5,1;1,1;track2;2]"..
"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[4,4;1,2;play;Play]"..
"button[6,4;1,2;stop;Stop]"..
"label[4,0;Current track "
..current_track.."]")
"label[4,0;"..S("Current track %s")
:format(current_track).."]")
if fields.play then
if music_handle then
minetest.sound_stop(music_handle)
end
music_handle = play_track(pos, current_track)
meta:set_int("active", 1)
end
if fields.stop then
@ -84,7 +93,7 @@ minetest.register_node("technic:music_player", {
minetest.sound_stop(music_handle)
end
end
meta:set_int("music_handle", music_handle)
music_handles[pos_hash] = music_handle
end,
})
@ -95,12 +104,13 @@ minetest.register_abm({
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("Music Player")
local machine_name = S("%s Music Player"):format("LV")
local machine_node = "technic:music_player"
local demand = 150
local music_handle = meta:get_int("music_handle")
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.
if not eu_input then
@ -115,9 +125,6 @@ minetest.register_abm({
if meta:get_int("active") == 0 then
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int("LV_EU_demand", 0)
if music_handle then
minetest.sound_stop(music_handle)
end
return
end
@ -125,13 +132,15 @@ minetest.register_abm({
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
if music_handle then
minetest.sound_stop(music_handle)
music_handle = nil
end
elseif eu_input >= demand then
meta:set_string("infotext", S("%s Active"):format(machine_name))
music_handle = minetest.sound_play("technic_track"..current_track,
{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,})
meta:set_int("music_handle", music_handle)
if not music_handle then
music_handle = play_track(pos, current_track)
end
end
music_handles[pos_hash] = music_handle
meta:set_int("LV_EU_demand", demand)
end
})

View File

@ -8,9 +8,9 @@
minetest.register_craft({
output = 'technic:solar_array_lv 1',
recipe = {
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'},
{'default:steel_ingot', 'technic:lv_transformer', 'default:steel_ingot'},
{'', 'technic:lv_cable0', ''},
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'},
{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'},
{'', 'technic:lv_cable0', ''},
}
})

View File

@ -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"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
description = S("Solar Panel"),
description = S("Small Solar %s Generator"):format("LV"),
active = false,
drawtype = "nodebox",
paramtype = "light",
@ -21,7 +21,7 @@ minetest.register_node("technic:solar_panel", {
on_construct = function(pos)
local meta = minetest.get_meta(pos)
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,
})
@ -29,7 +29,7 @@ minetest.register_craft({
output = 'technic:solar_panel',
recipe = {
{'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
-- built below -10m
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 time_of_day = minetest.get_timeofday()

View File

@ -9,14 +9,14 @@ minetest.register_alias("water_mill", "technic:water_mill")
minetest.register_craft({
output = 'technic:water_mill',
recipe = {
{'default:stone', 'default:stone', 'default:stone'},
{'group:wood', 'default:diamond', 'group:wood'},
{'default:stone', 'default:copper_ingot', 'default:stone'},
{'default:stone', 'default:diamond', 'default:stone'},
{'group:wood', 'technic:machine_casing', 'group:wood'},
{'default:stone', 'technic:lv_cable0', 'default:stone'},
}
})
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",
"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(),
on_construct = function(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)
end,
})
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",
"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
meta:set_string("infotext",
S("Water Mill").." ("..production_level.."%)")
S("Hydro %s Generator"):format("LV").." ("..production_level.."%)")
if production_level > 0 and
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)
return
end
if production_level == 0 then
hacky_swap_node(pos, "technic:water_mill")
technic.swap_node(pos, "technic:water_mill")
end
end
})

View File

@ -4,11 +4,11 @@ minetest.register_craft({
output = 'technic:mv_alloy_furnace',
recipe = {
{'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.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}})

View File

@ -11,10 +11,12 @@ minetest.register_craft({
technic.register_battery_box({
tier = "MV",
max_charge = 300000,
max_charge = 200000,
charge_rate = 20000,
discharge_rate = 80000,
charge_step = 2000,
discharge_step = 8000,
upgrade = 1,
tube = 1,
})

View 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})

View File

@ -9,7 +9,7 @@ minetest.register_craft({
output = 'technic:mv_electric_furnace',
recipe = {
{'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'},
}
})

View 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})

View File

@ -1,14 +1,13 @@
minetest.register_alias("generator_mv", "technic:generator_mv")
minetest.register_craft({
output = 'technic:mv_generator',
recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_generator', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_000000', 'technic:mv_transformer', 'pipeworks:tube_000000'},
{'technic:stainless_steel_ingot', 'technic:mv_cable', '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_generator({tier="MV", supply=600})
technic.register_generator({tier="MV", tube=1, supply=600})

View File

@ -4,7 +4,7 @@ minetest.register_craft({
output = 'technic:mv_grinder',
recipe = {
{'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'},
}
})

View File

@ -3,20 +3,29 @@ technic.register_tier("MV", "Medium Voltage")
local path = technic.modpath.."/machines/MV"
dofile(path.."/alloy_furnace.lua")
dofile(path.."/battery_box.lua")
-- Wiring stuff
dofile(path.."/cables.lua")
dofile(path.."/electric_furnace.lua")
dofile(path.."/grinder.lua")
dofile(path.."/solar_array.lua")
dofile(path.."/tool_workshop.lua")
dofile(path.."/battery_box.lua")
-- Generators
if technic.config:get_bool("enable_wind_mill") then
dofile(path.."/wind_mill.lua")
end
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:
-- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric.
dofile(path.."/power_radiator.lua")
dofile(path.."/lighting.lua")
-- This is currently useless, slow, and mostly copied
--dofile(path.."/power_radiator.lua")
--dofile(path.."/lighting.lua")

View File

@ -43,7 +43,7 @@ end
technic.inductive_on_punch_off = function(pos, eu_charge, swapnode)
local meta = minetest.get_meta(pos)
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("EU_charge",eu_charge)
--print("-----------")
@ -56,7 +56,7 @@ end
technic.inductive_on_punch_on = function(pos, eu_charge, swapnode)
local meta = minetest.get_meta(pos)
hacky_swap_node(pos, swapnode)
technic.swap_node(pos, swapnode)
meta:set_int("active", 0)
meta:set_int("EU_charge",eu_charge)
--print("-----------")
@ -82,7 +82,7 @@ local shutdown_inductive_appliances = function(pos)
local nodename = minetest.get_node(pos1).name
-- Swap the node and make sure it is off and unpowered
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("EU_charge", 0)
end
@ -108,7 +108,7 @@ local toggle_on_off_inductive_appliances = function(pos, node, puncher)
end
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",
"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"},
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)
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_string("infotext", "Power Radiator")
meta:set_string("infotext", "MV Power Radiator")
end,
on_dig = function(pos, node, digger)
shutdown_inductive_appliances(pos)
@ -138,9 +138,9 @@ minetest.register_node("technic:power_radiator", {
minetest.register_craft({
output = 'technic:power_radiator 1',
recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'technic:copper_coil', 'technic:mv_transformer', 'technic:copper_coil'},
{'technic:rubber', 'technic:mv_cable0', 'technic:rubber'},
{'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'},
{'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil'},
{'technic:rubber', 'technic:mv_cable0', 'technic:rubber'},
}
})
@ -158,7 +158,7 @@ minetest.register_abm({
if eu_input == 0 then
-- 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
shutdown_inductive_appliances(pos)
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.
used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor)
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)
.."% of maximum power)");
if used_charge == 0 then

View File

@ -2,11 +2,13 @@
minetest.register_craft({
output = 'technic:solar_array_mv 1',
recipe = {
{'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'},
{'default:steel_ingot', 'technic:mv_transformer', 'default:steel_ingot'},
{'', 'technic:mv_cable0', ''},
{'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'},
{'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'},
{'', 'technic:mv_cable0', ''},
}
})
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")

View File

@ -8,41 +8,34 @@ local S = technic.getter
minetest.register_craft({
output = 'technic:tool_workshop',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'default:diamond', 'group:wood'},
{'default:stone', 'default:copper_ingot', 'default:stone'},
{'group:wood', 'default:diamond', 'group:wood'},
{'group:wood', 'technic:machine_casing', 'group:wood'},
{'default:stone', 'technic:mv_cable0', 'default:stone'},
}
})
local workshop_formspec =
"invsize[8,9;]"..
"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;]"
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",
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
on_construct = function(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)
local inv = meta:get_inventory()
inv:set_size("src", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
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,
can_dig = technic.machine_can_dig,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
})
minetest.register_abm({
@ -53,7 +46,7 @@ minetest.register_abm({
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
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 demand = 5000
@ -67,11 +60,18 @@ minetest.register_abm({
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "MV")
srcstack = inv:get_stack("src", 1)
if inv:is_empty("src") or
srcstack:get_wear() == 0 or
srcstack:get_name() == "technic:water_can" or
srcstack:get_name() == "technic:lava_can" then
local repairable = false
local srcstack = inv:get_stack("src", 1)
if not srcstack:is_empty() then
local itemdef = minetest.registered_items[srcstack:get_name()]
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_int("MV_EU_demand", 0)
return

View File

@ -4,25 +4,25 @@ local S = technic.getter
minetest.register_craft({
output = 'technic:wind_mill_frame 5',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', '', 'default:steel_ingot'},
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'},
{'', 'technic:carbon_steel_ingot', ''},
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'},
}
})
minetest.register_craft({
output = 'technic:wind_mill',
recipe = {
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', 'technic:motor', 'default:steel_ingot'},
{'', 'default:steelblock', ''},
{'', 'technic:motor', ''},
{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'},
{'', 'technic:mv_cable0', ''},
}
})
minetest.register_node("technic:wind_mill_frame", {
description = S("Wind Mill Frame"),
drawtype = "glasslike_framed",
tiles = {"default_steel_block.png", "default_glass.png"},
tiles = {"technic_carbon_steel_block.png", "default_glass.png"},
sunlight_propagates = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -30,8 +30,8 @@ minetest.register_node("technic:wind_mill_frame", {
})
minetest.register_node("technic:wind_mill", {
description = S("Wind Mill"),
tiles = {"default_steel_block.png"},
description = S("Wind %s Generator"):format("MV"),
tiles = {"technic_carbon_steel_block.png"},
paramtype2 = "facedir",
groups = {cracky=1},
sounds = default.node_sound_stone_defaults(),
@ -48,7 +48,7 @@ minetest.register_node("technic:wind_mill", {
},
on_construct = function(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)
end,
})
@ -72,7 +72,7 @@ minetest.register_abm({
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
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)
if not check_wind_mill(pos) then

View File

@ -1,278 +1,7 @@
minetest.register_craft({
type = "shapeless",
output = 'technic:constructor_mk1_off 1',
recipe = {'technic:nodebreaker_off', 'technic:deployer_off'},
local S = technic.getter
})
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)
local function deploy_node(inv, slot_name, pos1, node1, node)
if node1.name == "air" then
if not inv:is_empty(slot_name) then
stack1=inv:get_list(slot_name)
@ -342,3 +71,294 @@ deploy_node =function (inv, slot_name, pos1, node1, node)
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,
})

View File

@ -1,3 +1,6 @@
local S = technic.getter
frames = {}
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
function lines(str)
local function lines(str)
local t = {}
local function helper(line) table.insert(t, line) return "" end
helper((str:gsub("(.-)\r?\n", helper)))
@ -204,7 +207,7 @@ local nodeboxes= {
minetest.register_node("technic:frame_"..nameext,{
description = "Frame",
description = S("Frame"),
tiles = {"technic_frame.png"},
groups=groups,
drawtype = "nodebox",
@ -539,15 +542,19 @@ local function frame_motor_on(pos, node)
nnode.name = frames_pos[pos_to_string(nnodepos)]
end
local meta = minetest.get_meta(pos)
if meta:get_int("last_moved") == minetest.get_gametime() then
return
end
local owner = meta:get_string("owner")
if minetest.registered_nodes[nnode.name].frame==1 then
local connected_nodes=get_connected_nodes(nnodepos)
move_nodes_vect(connected_nodes,dir,pos,owner)
end
minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime())
end
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",
"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"},
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 saved_node = meta:get_string("saved_node")
meta:set_string("saved_node", "")
hacky_swap_node(pos, new)
technic.swap_node(pos, new)
local meta = minetest.get_meta(pos)
meta:set_string("saved_node", saved_node)
end
@ -738,7 +745,7 @@ local function template_on_destruct(pos, node)
end
minetest.register_node("technic:template",{
description = "Template",
description = S("Template"),
tiles = {"technic_mv_cable.png"},
drop = "",
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",{
description = "Template",
description = S("Template"),
tiles = {"technic_hv_cable.png"},
drop = "",
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",{
description = "Template",
description = S("Template"),
tiles = {"technic_lv_cable.png"},
drop = "",
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",{
description = "Template (replacing)",
description = S("Template (replacing)"),
inventory_image = "technic_template_replacer.png",
on_place = function(itemstack, placer, pointed_thing)
local p = pointed_thing.under
@ -795,11 +802,11 @@ minetest.register_craftitem("technic:template_replacer",{
})
minetest.register_tool("technic:template_tool",{
description = "Template tool",
description = S("Template Tool"),
inventory_image = "technic_template_tool.png",
on_use = function(itemstack, puncher, pointed_thing)
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
end
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 nnode=minetest.get_node(nnodepos)
local meta = minetest.get_meta(pos)
if meta:get_int("last_moved") == minetest.get_gametime() then
return
end
local owner = meta:get_string("owner")
if nnode.name == "technic:template" then
local connected_nodes=get_template_nodes(nnodepos)
move_nodes_vect(connected_nodes,dir,pos,owner)
end
minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime())
end
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",
"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2},
@ -874,7 +885,7 @@ minetest.register_craft({
output = 'technic:frame_motor',
recipe = {
{'', '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', ''},
}
})
@ -902,7 +913,7 @@ minetest.register_craft({
output = 'technic:template_motor',
recipe = {
{'', 'technic:template', ''},
{'group:mesecons_conductor_craftable', 'technic:motor', 'group:mesecons_conductor_craftable'},
{'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable'},
{'', 'technic:template', ''},
}
})

View File

@ -1,78 +1,7 @@
minetest.register_craftitem("technic:injector", {
description = "Injector",
stack_max = 99,
})
minetest.register_craft({
output = 'technic:injector 1',
recipe = {
{'', 'technic:control_logic_unit',''},
{'', 'default:chest',''},
{'', 'pipeworks:tube_000000',''},
}
})
local S = technic.getter
minetest.register_node("technic:injector", {
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 function inject_items (pos)
local meta=minetest.env:get_meta(pos)
local inv = meta:get_inventory()
local mode=meta:get_string("mode")
@ -84,7 +13,7 @@ function inject_items (pos)
local item0=stack:to_table()
if item0 then
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:setvelocity({x=0, y=-1, z=0})
item1:setacceleration({x=0, y=0, z=0})
@ -102,7 +31,7 @@ function inject_items (pos)
if stack then
local item0=stack:to_table()
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:setvelocity({x=0, y=-1, z=0})
item1:setacceleration({x=0, y=0, z=0})
@ -115,3 +44,77 @@ function inject_items (pos)
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,
})

View File

@ -1,287 +1,10 @@
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)
local tier = data.tier
local ltier = string.lower(tier)
local tube_side_texture = data.tube and "technic_"..ltier.."_alloy_furnace_side_tube.png"
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
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
data.typename = "alloy"
data.machine_name = "alloy_furnace"
data.machine_desc = S("%s Alloy Furnace")
technic.register_base_machine(data)
end

View 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

View File

@ -1,11 +1,67 @@
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)
local tier = data.tier
local ltier = string.lower(tier)
data.formspec =
local formspec =
"invsize[8,9;]"..
"image[1,1;1,2;technic_power_meter_bg.png]"..
"list[current_name;src;3,1;1,1;]"..
@ -16,12 +72,25 @@ function technic.register_battery_box(data)
"label[5,0;"..S("Discharge").."]"..
"label[1,3;"..S("Power level").."]"..
"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
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
if i ~= 0 then
groups.not_in_creative_inventory = 1
end
if data.tube then
groups.tubedevice = 1
groups.tubedevice_receiver = 1
end
minetest.register_node("technic:"..ltier.."_battery_box"..i, {
description = S("%s Battery Box"):format(tier),
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"},
groups = groups,
tube = data.tube and tube or nil,
paramtype2 = "facedir",
sounds = default.node_sound_wood_defaults(),
drop = "technic:"..ltier.."_battery_box0",
technic = data,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
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("formspec", data.formspec)
meta:set_int(data.tier.."_EU_demand", 0)
meta:set_int(data.tier.."_EU_supply", 0)
meta:set_int(data.tier.."_EU_input", 0)
meta:set_string("infotext", S("%s Battery Box"):format(tier))
meta:set_string("formspec", formspec)
meta:set_int(tier.."_EU_demand", 0)
meta:set_int(tier.."_EU_supply", 0)
meta:set_int(tier.."_EU_input", 0)
meta:set_float("internal_EU_charge", 0)
inv:set_size("src", 1)
inv:set_size("dst", 1)
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") 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,
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,
})
end
@ -73,17 +137,19 @@ function technic.register_battery_box(data)
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 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 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
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
if eu_input >= 0 then
current_charge = math.min(current_charge + eu_input, max_charge)
@ -92,16 +158,30 @@ function technic.register_battery_box(data)
end
-- 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 = technic.discharge_tools(meta,
current_charge, data.discharge_step, max_charge)
current_charge, tool_empty = technic.discharge_tools(meta,
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
meta:set_int(data.tier.."_EU_demand",
math.min(charge_rate, max_charge - current_charge))
meta:set_int(data.tier.."_EU_supply",
math.min(discharge_rate, current_charge))
meta:set_int(tier.."_EU_demand",
math.min(data.charge_rate, max_charge - current_charge))
meta:set_int(tier.."_EU_supply",
math.min(data.discharge_rate, 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)
local last_count = meta:get_float("last_side_shown")
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)
end
local charge_percent = math.floor(current_charge / max_charge * 100)
meta:set_string("formspec",
data.formspec..
formspec..
"image[1,1;1,2;technic_power_meter_bg.png"
.."^[lowpart:"..charge_percent
..":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
infotext = S("%s Idle"):format(infotext)
end
@ -142,17 +223,16 @@ end -- End registration
function technic.charge_tools(meta, batt_charge, charge_step)
local inv = meta:get_inventory()
if inv:is_empty("src") then
return batt_charge
return batt_charge, false
end
local srcstack = inv:get_stack("src", 1)
local src_meta = get_item_meta(srcstack:get_metadata())
local toolname = srcstack:get_name()
if not technic.power_tools[toolname] then
return batt_charge
return batt_charge, false
end
-- 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 {}
if not src_meta.charge then
src_meta.charge = 0
@ -160,8 +240,10 @@ function technic.charge_tools(meta, batt_charge, charge_step)
-- Do the charging
local item_max_charge = technic.power_tools[toolname]
local tool_charge = src_meta.charge
if tool_charge >= item_max_charge or batt_charge <= 0 then
return batt_charge
if tool_charge >= item_max_charge then
return batt_charge, true
elseif batt_charge <= 0 then
return batt_charge, false
end
charge_step = math.min(charge_step, batt_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
technic.set_RE_wear(srcstack, tool_charge, item_max_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)
return batt_charge
return batt_charge, (tool_charge == item_max_charge)
end
function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
local inv = meta:get_inventory()
if inv:is_empty("dst") then
return batt_charge
return batt_charge, false
end
srcstack = inv:get_stack("dst", 1)
local toolname = srcstack:get_name()
if technic.power_tools[toolname] == nil then
return batt_charge
return batt_charge, false
end
-- 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 {}
if not src_meta.charge then
src_meta.charge = 0
@ -195,8 +277,10 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
-- Do the discharging
local item_max_charge = technic.power_tools[toolname]
local tool_charge = src_meta.charge
if tool_charge <= 0 or batt_charge >= max_charge then
return batt_charge
if tool_charge <= 0 then
return batt_charge, true
elseif batt_charge >= max_charge then
return batt_charge, false
end
charge_step = math.min(charge_step, max_charge - batt_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
technic.set_RE_wear(srcstack, tool_charge, item_max_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)
return batt_charge
return batt_charge, (tool_charge == 0)
end

View File

@ -62,12 +62,9 @@ end
minetest.register_on_placenode(function(pos, node)
for tier, machine_list in pairs(technic.machines) do
for machine_name, _ in pairs(machine_list) do
if node.name == machine_name then
technic.update_cables(pos, tier, true)
technic.networks = {}
return
end
if machine_list[node.name] ~= nil then
technic.update_cables(pos, tier, true)
technic.networks = {}
end
end
end)
@ -75,12 +72,9 @@ end)
minetest.register_on_dignode(function(pos, node)
for tier, machine_list in pairs(technic.machines) do
for machine_name, _ in pairs(machine_list) do
if node.name == machine_name then
technic.update_cables(pos, tier, true)
technic.networks = {}
return
end
if machine_list[node.name] ~= nil then
technic.update_cables(pos, tier, true)
technic.networks = {}
end
end
end)

View File

@ -1,4 +1,6 @@
local S = technic.getter
function technic.handle_machine_upgrades(meta)
-- Get the names of the upgrades
local inv = meta:get_inventory()
@ -35,23 +37,27 @@ function technic.handle_machine_upgrades(meta)
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.
if output_name == nil then
output_name = "dst"
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
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
if stack then
local item0 = stack:to_table()
if item0 then
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:setvelocity({x=x_velocity, y=0, z=z_velocity})
item1:setacceleration({x=0, y=0, z=0})
stack:take_item(1)
inv:set_stack("dst", i, stack)
inv:set_stack(output_name, i, stack)
return
end
end
@ -79,7 +85,11 @@ function technic.smelt_item(meta, result, speed)
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 meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
@ -100,12 +110,48 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade)
end
tube_time = meta:get_int("tube_time")
tube_time = tube_time + tube_upgrade
if tube_time > 3 then
if tube_time >= 2 then
tube_time = 0
if output_tube_connected then
technic.send_items(pos, x_velocity, z_velocity)
send_function(pos, x_velocity, z_velocity)
end
end
meta:set_int("tube_time", tube_time)
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

View 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

View 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

View File

@ -2,199 +2,8 @@
local S = technic.getter
function technic.register_electric_furnace(data)
local tier = data.tier
local ltier = string.lower(tier)
local tube_side_texture = data.tube and "technic_"..ltier.."_electric_furnace_side_tube.png"
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
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
data.typename = "cooking"
data.machine_name = "electric_furnace"
data.machine_desc = S("%s Furnace")
technic.register_base_machine(data)
end

View 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

View 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

View File

@ -1,70 +1,81 @@
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)
local tier = data.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 =
"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;]"..
"image[4,1;1,1;default_furnace_fire_bg.png]"..
"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", {
description = desc,
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_front.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
groups = groups,
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", desc)
meta:set_int(data.tier.."_EU_supply", 0)
meta:set_int("burn_time", 0)
meta:set_int("tube_time", 0)
meta:set_string("formspec", generator_formspec)
local inv = meta:get_inventory()
inv:set_size("src", 1)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
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
else
return true
end
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.."_generator_active", {
description = desc,
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_front_active.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
not_in_creative_inventory=1},
groups = active_groups,
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil,
drop = "technic:"..ltier.."_generator",
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
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
else
return true
end
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_abm({
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")
-- If more to burn and the energy produced was used: produce some more
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
meta:set_int("burn_time", burn_time)
end
@ -85,10 +96,12 @@ function technic.register_generator(data)
local inv = meta:get_inventory()
if not inv:is_empty("src") then
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
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
end
meta:set_int("burn_time", fuel.time)
@ -96,11 +109,11 @@ function technic.register_generator(data)
local stack = inv:get_stack("src", 1)
stack:take_item()
inv:set_stack("src", 1, stack)
hacky_swap_node(pos, "technic:"..ltier.."_generator_active")
meta:set_int(data.tier.."_EU_supply", data.supply)
technic.swap_node(pos, "technic:"..ltier.."_generator_active")
meta:set_int(tier.."_EU_supply", data.supply)
else
hacky_swap_node(pos, "technic:"..ltier.."_generator")
meta:set_int(data.tier.."_EU_supply", 0)
technic.swap_node(pos, "technic:"..ltier.."_generator")
meta:set_int(tier.."_EU_supply", 0)
end
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("formspec",
"size[8, 9]"..
"label[0, 0;Generator]"..
"label[0, 0;"..minetest.formspec_escape(desc).."]"..
"list[current_name;src;3, 1;1, 1;]"..
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
(percent)..":default_furnace_fire_fg.png]"..
"list[current_player;main;0, 5;8, 4;]")
end
})
technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
technic.register_machine(tier, "technic:"..ltier.."_generator", technic.producer)
technic.register_machine(tier, "technic:"..ltier.."_generator_active", technic.producer)
end

View File

@ -2,185 +2,8 @@
local S = technic.getter
function technic.register_grinder(data)
local tier = data.tier
local ltier = string.lower(tier)
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;"..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
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
data.typename = "grinding"
data.machine_name = "grinder"
data.machine_desc = S("%s Grinder")
technic.register_base_machine(data)
end

View File

@ -1,64 +1,46 @@
local S = technic.getter
technic.grinder_recipes = {}
technic.register_recipe_type("grinding", S("Grinding"))
function technic.register_grinder_recipe(data)
data.time = data.time or 3
technic.grinder_recipes[data.input] = data
if unified_inventory then
unified_inventory.register_craft({
type = "grinding",
output = data.output,
items = {data.input},
width = 0,
})
end
technic.register_recipe("grinding", data)
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 = {
{"default:bronze_ingot", "technic:bronze_dust 1"},
-- Dusts
{"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:desert_stone", "default:desert_sand"},
{"default:gold_ingot", "technic:gold_dust 1"},
{"default:gold_lump", "technic:gold_dust 2"},
{"default:gravel", "default:dirt"},
{"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"},
{"default:iron_lump", "technic:wrought_iron_dust 2"},
{"moreores:mithril_lump", "technic:mithril_dust 2"},
{"moreores:silver_ingot", "technic:silver_dust 1"},
{"moreores:silver_lump", "technic:silver_dust 2"},
{"moreores:tin_ingot", "technic:tin_dust 1"},
{"moreores:tin_lump", "technic:tin_dust 2"},
{"technic:chromium_ingot", "technic:chromium_dust 1"},
{"technic:chromium_lump", "technic:chromium_dust 2"},
{"technic:zinc_ingot", "technic:zinc_dust 1"},
{"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
table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"})
end
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
local function register_dust(name, ingot)
@ -75,26 +57,32 @@ local function register_dust(name, ingot)
recipe = "technic:"..lname.."_dust",
output = ingot,
})
technic.register_grinder_recipe({ input = {ingot}, output = "technic:"..lname.."_dust 1" })
end
end
-- 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("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("Coal", nil)
register_dust("Copper", "default:copper_ingot")
register_dust("Gold", "default:gold_ingot")
register_dust("Iron", "default:steel_ingot")
register_dust("Mithril", "moreores:mithril_ingot")
register_dust("Silver", "moreores:silver_ingot")
register_dust("Stainless Steel", "technic:stainless_steel_ingot")
register_dust("Talinite", "glooptest:talinite_ingot")
register_dust("Tin", "moreores:tin_ingot")
register_dust("Wrought Iron", "technic:wrought_iron_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({
type = "fuel",

View File

@ -1,12 +1,29 @@
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.."/electric_furnace.lua")
dofile(path.."/grinder.lua")
dofile(path.."/grinder_recipes.lua")
-- Wiring stuff
dofile(path.."/cables.lua")
dofile(path.."/battery_box.lua")
-- Generators
dofile(path.."/solar_array.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")

View 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

View 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

View File

@ -11,7 +11,7 @@ function technic.register_solar_array(data)
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"},
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
description = S("%s Solar Array"):format(tier),
description = S("Arrayed Solar %s Generator"):format(tier),
active = false,
drawtype = "nodebox",
paramtype = "light",
@ -19,11 +19,9 @@ function technic.register_solar_array(data)
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
technic = data,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name
local tier = minetest.registered_nodes[name].technic.tier
meta:set_int(tier.."_EU_supply", 0)
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
-- built below -10m
local pos1 = {}
local data = minetest.registered_nodes[node.name].technic
local machine_name = S("%s Solar Array"):format(data.tier)
local machine_name = S("Arrayed Solar %s Generator"):format(tier)
pos1.y = pos.y + 1
pos1.x = pos.x
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.min(charge_to_give, data.power * 50)
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
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,
})

View File

@ -32,9 +32,9 @@ minetest.register_node("technic:supply_converter", {
minetest.register_craft({
output = 'technic:supply_converter 1',
recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'technic:mv_transformer', 'technic:mv_cable0', 'technic:lv_transformer'},
{'technic:mv_cable0', 'technic:rubber', 'technic:lv_cable0'},
{'technic:stainless_steel_ingot', 'technic:rubber', 'technic:stainless_steel_ingot'},
{'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'},
{'technic:mv_cable0', 'technic:rubber', 'technic:lv_cable0'},
}
})
@ -76,6 +76,6 @@ minetest.register_abm({
})
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

View File

@ -35,9 +35,9 @@ local S = technic.getter
minetest.register_craft({
output = "technic:switching_station",
recipe = {
{"default:steel_ingot", "technic:lv_transformer", "default:steel_ingot"},
{"default:copper_ingot", "technic:lv_cable0", "default:copper_ingot"},
{"default:steel_ingot", "technic:lv_cable0", "default:steel_ingot"}
{"", "technic:lv_transformer", ""},
{"default:copper_ingot", "technic:machine_casing", "default:copper_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
function technic.switching_station_timeout_count(pos, tier)
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
meta:set_int(tier.."_EU_input", 0)
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)
elseif machines[name] == technic.receiver then
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
add_new_cable_node(BA_nodes, pos)
end

View File

@ -3,6 +3,7 @@
technic.receiver = "RE"
technic.producer = "PR"
technic.producer_receiver = "PR_RE"
technic.battery = "BA"
technic.machines = {}
@ -44,7 +45,15 @@ end
-- Wear down a tool depending on the remaining charge.
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)
return itemstack
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Some files were not shown because too many files have changed in this diff Show More