Add "Doc" modpack support. Also fix up some bugs with crate marker entities, and make them show protected nodes.

master
FaceDeer 2017-01-17 19:57:20 -07:00
parent a3a1402e1b
commit 5a30fe40e3
14 changed files with 224 additions and 169 deletions

View File

@ -26,118 +26,6 @@ Several general concepts are important when building more sophisticated diggers.
* Shift-right-clicking - since most of the nodes of the digging machine have control screens associated with right-clicking, building additional nodes on top of them or rotating them with the screwdriver requires the shift key to be held down when right-clicking on them.
Detailed module guide
=====================
Control Module
--------------
Right-click on this module to make the digging machine go one step. The digging machine will go in the direction that the control module is oriented.
A control module can only trigger once per second. Gives you time to enjoy the scenery and smell the flowers (or their mulched remains, at any rate).
If you're standing within the digging machine's volume, or in a node adjacent to it, you will be pulled along with the machine when it moves.
Automatic Control Module
--------------
An Auto-control module can be set to run for an arbitrary number of cycles. Once it's running, right-click on it again to interrupt its rampage. If anything interrupts it - the player's click, an undiggable obstruction, running out of fuel - it will remember the number of remaining cycles so that you can fix the problem and set it running again to complete the original plan.
The digging machine will go in the direction that the control module is oriented.
Pusher Module
-------------
Aka the "can you rebuild it six inches to the left" module. This is a much simplified control module that does not trigger the digger or builder heads when right-clicked, it only moves the digging machine. It's up to you to ensure there's space for it to move into.
Since movement alone does not require fuel, a pusher module has no internal furnace.
Rotation Unit
-----------
This magical module can rotate a Digtron array in place around itself. Right-clicking on it will rotate the Digtron 90 degrees in the direction the orange arrows on its sides indicate (widdershins around the Y axis by default, use the screwdriver to change this) assuming there's space for the Digtron in its new orientation. Builders and diggers will not trigger on rotation.
Digger Head
-----------
Facing of a digger head is significant; it will excavate material from the node on the spinning grinder wheel face of the digger head. Generally speaking, you'll want these to face forward - though having them aimed to the sides can also be useful.
Digger heads come in both regular and "intermittent" versions, each of which is craftable from the other. The intermittent version can have a period and offset defined if you want them to punch regularly-spaced holes. Note that diggers aimed forward should generally always be the regular kind (or have a period of 1), otherwise the digging machine may be unable to move.
Be cautious around active digger heads when damage is enabled - they bite!
Soft Material Digger Head
----------------
This specialized digger head is designed to excavate only softer material such as sand or gravel. It has no period/offset settings; it will always attempt to dig sand when it's present in its target node. It leaves all other types of nodes alone. In technical terms, this digger digs nodes belonging to the "crumbly", "choppy", "snappy", "oddly_diggable_by_hand" and "fleshy" groups. It also comes in regular and "intermittent" versions.
The intended purpose of this digger is to be aimed at the ceiling or walls of a tunnel being dug, making spaces to allow shoring nodes to be inserted into unstable roofs but leaving the wall alone if it's composed of a more stable material.
It can also serve as part of a lawnmower or tree-harvester.
Builder Head
------------
A builder head is the most complex component of this system. It has period and offset properties, and also an inventory slot where you "program" it by placing an example of the node type that you want it to build. The builder doesn't keep a real copy of the item, it just reads what you drop in here.
When the "Save & Show" button is clicked the properties for period and offset will be saved, and markers will briefly be shown to indicate where the nearest spots corresponding to those values are. The builder will build its output at those locations provided it is moving along the matching axis.
The "output" side of a builder is the side with a black crosshair on it.
Builders also have a "facing" setting. If you haven't memorized the meaning of the 24 facing values yet, builder heads have a helpful "Read & Save" button to fill this value in for you. Simply build a temporary instance of the node in the output location in front of the builder, adjust it to the orientation you want using the screwdriver tool, and then when you click the "Read & Save" button the node's facing will be read and saved.
Inventory Module
----------------
Inventory modules have the same capacity as a chest. They're used both for storing the products of the digger heads and as the source of materials used by the builder heads. A digging machine whose builder heads are laying down cobble can automatically self-replenish in this way, but note that an inventory module is still required as buffer space even if the digger heads produced everything needed by the builder heads in a given cycle.
Inventory modules are not required for a digging-only machine. If there's not enough storage space to hold the materials produced by the digging heads the excess material will be ejected out the back of the control node. They're handy for accumulating ores and other building materials, though.
Digging machines can have multiple inventory modules added to expand their capacity.
Fuel Hopper Module
------------------
Digtrons have an appetite. Build operations and dig operations require a certain amount of fuel, and that fuel comes from fuel hopper modules. Note that movement does not require fuel, only digging and building.
When a control unit is triggered, it will tally up how much fuel is required for the next cycle and then burn items from the fuel hopper until a sufficient amount of heat has been generated to power the operation. Any leftover heat will be retained by the control unit for use in the next cycle; this is the "heat remaining in controller furnace". This means you don't have to worry too much about what kinds of fuel you put in the hopper, none will be wasted (unless you dig away a control unit with some heat remaining in it, that heat does get wasted).
The fuel costs for digging and building can be configured in the init.lua file. By default using one lump of coal as fuel a digtron can:
* Build 40 nodes
* Dig 40 stone nodes
* Dig 60 wood nodes
* Dig 80 dirt or sand nodes
Combined Storage Module
-----------------------
For smaller jobs the two dedicated modules may simply be too much of a good thing, wasting precious Digtron space to give unneeded capacity. The combined storage module is the best of both worlds, splitting its internal space between building material inventory and fuel storage. It has 3/4 building material capacity and 1/4 fuel storage capacity.
Structural Module
-----------------
These nodes allow otherwise-disconnected sections of digtron nodes to be linked together. They are not usually necessary for simple diggers but more elaborate builder arrays might have builder nodes that can't be placed directly adjacent to other digtron nodes and these nodes can serve to keep them connected to the controller.
They may also be used for providing additional traction if your digtron array is very tall compared to the terrain surface that it's touching.
You can also use them decoratively, or to build a platform to stand on as you ride your mighty mechanical leviathan through the landscape.
Panel pieces
------------
There are also three "panel" pieces; one flat panel, one edge panel, and one corner panel. They're basically decorative, you can use them to build a cabin or cover holes in the Digtron's structure.
Digtron Lamp
------------
A light source that moves along with the digging machine. Convenient if you're digging a tunnel that you don't intend to outfit with torches or other permanent light fixtures. Not quite as bright as a torch since the protective lens tends to get grimy while burrowing through the earth.
Digtron core
------------
The only non-node item in this mod is the Digtron core, a crafting item used to manufacture the various Digtron components. Each component recipe has a Digtron core in it. Some of the cheaper parts of a Digtron can be recycled to get the valuable core back out for use in other Digtron parts.
What Do These Noises Mean?
==========================

View File

@ -1,3 +1,4 @@
default
pipeworks?
doc?
hopper?

103
doc.lua Normal file
View File

@ -0,0 +1,103 @@
digtron.doc = {}
digtron.doc.core_longdesc = "A crafting component used in the manufacture of all Digtron node types."
digtron.doc.core_usagehelp = "Place the Digtron Core in the center of the crafting grid. All Digtron recipes consist of arranging various other materials around the central Digtron Core."
--------------------------------------------------------------------
digtron.doc.builder_longdesc = "A 'builder' module for a Digtron. By itself it does nothing, but as part of a Digtron it is used to construct user-defined nodes."
digtron.doc.builder_usagehelp = "A builder head is the most complex component of this system. It has period and offset properties, and also an inventory slot where you \"program\" it by placing an example of the node type that you want it to build.\n\n" ..
'When the "Save & Show" button is clicked the properties for period and offset will be saved, and markers will briefly be shown to indicate where the nearest spots corresponding to those values are. The builder will build its output at those locations provided it is moving along the matching axis.\n\n' ..
'The "output" side of a builder is the side with a black crosshair on it.\n\n' ..
'Builders also have a "facing" setting. If you haven\'t memorized the meaning of the 24 facing values yet, builder heads have a helpful "Read & Save" button to fill this value in for you. Simply build a temporary instance of the node in the output location in front of the builder, adjust it to the orientation you want using the screwdriver tool, and then when you click the "Read & Save" button the node\'s facing will be read and saved.'
--------------------------------------------------------------------
digtron.doc.inventory_longdesc = "Stores building materials for use by builder heads and materials dug up by digger heads."
digtron.doc.inventory_usagehelp = "Inventory modules have the same capacity as a chest. They're used both for storing the products of the digger heads and as the source of materials used by the builder heads. A digging machine whose builder heads are laying down cobble can automatically self-replenish in this way, but note that an inventory module is still required as buffer space even if the digger heads produced everything needed by the builder heads in a given cycle.\n\n"..
"Inventory modules are not required for a digging-only machine. If there's not enough storage space to hold the materials produced by the digging heads the excess material will be ejected out the back of the control node. They're handy for accumulating ores and other building materials, though.\n\n"..
"Digging machines can have multiple inventory modules added to expand their capacity."
digtron.doc.fuelstore_longdesc = "Stores fuel to run a Digtron"
digtron.doc.fuelstore_usagehelp = "Digtrons have an appetite. Build operations and dig operations require a certain amount of fuel, and that fuel comes from fuel hopper modules. Note that movement does not require fuel, only digging and building.\n\n"..
"When a control unit is triggered, it will tally up how much fuel is required for the next cycle and then burn items from the fuel hopper until a sufficient amount of heat has been generated to power the operation. Any leftover heat will be retained by the control unit for use in the next cycle; this is the \"heat remaining in controller furnace\". This means you don't have to worry too much about what kinds of fuel you put in the hopper, none will be wasted (unless you dig away a control unit with some heat remaining in it, that heat does get wasted).\n\n" ..
"The fuel costs for digging and building can be configured in the init.lua file. By default using one lump of coal as fuel a digtron can:\n"..
"\tBuild 40 nodes\n"..
"\tDig 40 stone nodes\n"..
"\tDig 60 wood nodes\n"..
"\tDig 80 dirt or sand nodes"
digtron.doc.combined_storage_longdesc = "Stores fuel for a Digtron and also has an inventory for building materials"
digtron.doc.combined_storage_usagehelp = "For smaller jobs the two dedicated modules may simply be too much of a good thing, wasting precious Digtron space to give unneeded capacity. The combined storage module is the best of both worlds, splitting its internal space between building material inventory and fuel storage. It has 3/4 building material capacity and 1/4 fuel storage capacity."
---------------------------------------------------------------------
digtron.doc.empty_crate_longdesc = "An empty crate that a Digtron can be stored in"
digtron.doc.empty_crate_usagehelp = "Digtrons can be pushed around and rotated, and that may be enough for getting them perfectly positioned for the start of a run. But once your digger is a kilometer down under a shaft filled with stairs, how to get it back to the surface to run another pass?\n\n" ..
"Place an empty Digtron crate next to a Digtron and right-click it to pack the Digtron (and all its inventory and settings) into the crate. You can then collect the crate, bring it somewhere else, build the crate, and then unpack the Digtron from it again. The Digtron will appear in the same relative location and orientation to the crate as when it was packed away inside it."
digtron.doc.loaded_crate_longdesc = "A crate containing a Digtron array"
digtron.doc.loaded_crate_usagehelp = "This crate contains a Digtron assembly that was stored in it earlier. Place it somewhere and right-click on it to access the label text that was applied to it. There's also a button that causes it to display the shape the deployed Digtron would take if you unpacked the crate, marking unbuildable nodes with a warning marker. And finally there's a button to actually deploy the Digtron, replacing this loaded crate with an empty that can be reused later."
----------------------------------------------------------------------
digtron.doc.controller_longdesc = "A basic controller to make a Digtron array move and operate."
digtron.doc.controller_usagehelp = "Right-click on this module to make the digging machine go one step. The digging machine will go in the direction that the control module is oriented.\n\n" ..
"A control module can only trigger once per second. Gives you time to enjoy the scenery and smell the flowers (or their mulched remains, at any rate).\n\n" ..
"If you're standing within the digging machine's volume, or in a node adjacent to it, you will be pulled along with the machine when it moves."
digtron.doc.auto_controller_longdesc = "A more sophisticated controller that includes the ability to set the number of cycles it will run for, as well as diagonal movement."
digtron.doc.auto_controller_usagehelp = "An Auto-control module can be set to run for an arbitrary number of cycles. Once it's running, right-click on it again to interrupt its rampage. If anything interrupts it - the player's click, an undiggable obstruction, running out of fuel - it will remember the number of remaining cycles so that you can fix the problem and set it running again to complete the original plan.\n\n" ..
"The digging machine will go in the direction that the control module is oriented.\n\n" ..
"Auto-controllers can also be set to move diagonally by setting the \"slope\" parameter to a non-zero value. The controller will then shunt the Digtron in the direction of the arrows painted on its sides every X steps it moves. The Digtron will trigger dig heads when it shunts to the side, but will not trigger builder modules or intermittent dig heads."
digtron.doc.pusher_longdesc = "A simplified controller that merely moves a Digtron around without triggering its builder or digger modules"
digtron.doc.pusher_usagehelp = "Aka the \"can you rebuild it six inches to the left\" module. This is a much simplified control module that does not trigger the digger or builder heads when right-clicked, it only moves the digging machine. It's up to you to ensure there's space for it to move into.\n\n"..
"Since movement alone does not require fuel, a pusher module has no internal furnace."
digtron.doc.axle_longdesc = "A device that allows one to rotate their Digtron into new orientations"
digtron.doc.axle_usagehelp = "This magical module can rotate a Digtron array in place around itself. Right-clicking on it will rotate the Digtron 90 degrees in the direction the orange arrows on its sides indicate (widdershins around the Y axis by default, use the screwdriver to change this) assuming there's space for the Digtron in its new orientation. Builders and diggers will not trigger on rotation."
---------------------------------------------------------------------
digtron.doc.digger_longdesc = "A standard Digtron digger head"
digtron.doc.digger_usagehelp = "Facing of a digger head is significant; it will excavate material from the node on the spinning grinder wheel face of the digger head. Generally speaking, you'll want these to face forward - though having them aimed to the sides can also be useful."
digtron.doc.dual_digger_longdesc = "Two standard Digtron digger heads merged at 90 degrees to each other"
digtron.doc.dual_digger_usagehelp = "This digger head is mainly of use when you want to build a Digtron capable of digging diagonal paths. A normal one-direction dig head would be unable to clear nodes in both of the directions it would be called upon to move, resulting in a stuck Digtron.\n\n" ..
"One can also make use of dual dig heads to simplify the size and layout of a Digtron, though this is generally not of practical use."
digtron.doc.dual_soft_digger_longdesc = "Two standard soft-material Digtron digger heads merged at 90 degrees to each other"
digtron.doc.dual_soft_digger_usagehelp = "This digger head is mainly of use when you want to build a Digtron capable of digging diagonal paths. A normal one-direction dig head would be unable to clear nodes in both of the directions it would be called upon to move, resulting in a stuck Digtron.\n\n" ..
"Like a normal single-direction soft digger head, this digger only excavates material belonging to groups softer than stone" ..
"One can make use of dual dig heads to simplify the size and layout of a Digtron, though this is generally not of practical use."
digtron.doc.intermittent_digger_longdesc = "A standard Digtron digger head that only triggers periodically"
digtron.doc.intermittent_digger_usagehelp = "This is a standard digger head capable of digging any material, but it will only trigger periodically as the Digtron moves. This can be useful for punching regularly-spaced holes in a tunnel wall, for example."
digtron.doc.intermittent_soft_digger_longdesc = "A standard soft-material Digtron digger head that only triggers periodically"
digtron.doc.intermittent_soft_digger_usagehelp = "This is a standard soft-material digger head capable of digging any material, but it will only trigger periodically as the Digtron moves. This can be useful for punching regularly-spaced holes in a tunnel wall, for example."
digtron.doc.soft_digger_longdesc = "A Digtron digger head that only excavates soft materials"
digtron.doc.soft_digger_usagehelp = 'This specialized digger head is designed to excavate only softer material such as sand or gravel. In technical terms, this digger digs nodes belonging to the "crumbly", "choppy", "snappy", "oddly_diggable_by_hand" and "fleshy" groups.\n\n'..
"The intended purpose of this digger is to be aimed at the ceiling or walls of a tunnel being dug, making spaces to allow shoring nodes to be inserted into unstable roofs but leaving the wall alone if it's composed of a more stable material.\n\n" ..
"It can also serve as part of a lawnmower or tree-harvester."
---------------------------------------------------------------------
digtron.doc.structure_longdesc = "Structural component for a Digtron array"
digtron.doc.structure_usagehelp = "These nodes allow otherwise-disconnected sections of digtron nodes to be linked together. They are not usually necessary for simple diggers but more elaborate builder arrays might have builder nodes that can't be placed directly adjacent to other digtron nodes and these nodes can serve to keep them connected to the controller.\n\n" ..
"They may also be used for providing additional traction if your digtron array is very tall compared to the terrain surface that it's touching.\n\n" ..
"You can also use them decoratively, or to build a platform to stand on as you ride your mighty mechanical leviathan through the landscape."
digtron.doc.light_longdesc = "Digtron light source"
digtron.doc.light_usagehelp = "A light source that moves along with the digging machine. Convenient if you're digging a tunnel that you don't intend to outfit with torches or other permanent light fixtures. Not quite as bright as a torch since the protective lens tends to get grimy while burrowing through the earth."
digtron.doc.panel_longdesc = "Digtron panel"
digtron.doc.panel_usagehelp = "A structural panel that can be made part of a Digtron to provide shelter for an operator, or just to look cool."
digtron.doc.edge_panel_longdesc = "Digtron edge panel"
digtron.doc.edge_panel_usagehelp = "A pair of structural panels that can be made part of a Digtron to provide shelter for an operator, or just to look cool."
digtron.doc.corner_panel_longdesc = "Digtron corner panel"
digtron.doc.corner_panel_usagehelp = "A trio of structural panels that can be made part of a Digtron to provide shelter for an operator, or just to look cool."

View File

@ -1,9 +1,9 @@
minetest.register_entity("digtron:marker", {
initial_properties = {
visual = "cube",
visual_size = {x=1.1, y=1.1},
visual_size = {x=1.05, y=1.05},
textures = {"digtron_marker_side.png","digtron_marker_side.png","digtron_marker.png","digtron_marker.png","digtron_marker_side.png","digtron_marker_side.png"},
collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
collisionbox = {-0.525, -0.525, -0.525, 0.525, 0.525, 0.525},
physical = false,
},
@ -27,9 +27,9 @@ minetest.register_entity("digtron:marker", {
minetest.register_entity("digtron:marker_vertical", {
initial_properties = {
visual = "cube",
visual_size = {x=1.1, y=1.1},
visual_size = {x=1.05, y=1.05},
textures = {"digtron_marker.png","digtron_marker.png","digtron_marker_side.png^[transformR90","digtron_marker_side.png^[transformR90","digtron_marker_side.png^[transformR90","digtron_marker_side.png^[transformR90"},
collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
collisionbox = {-0.525, -0.525, -0.525, 0.525, 0.525, 0.525},
physical = false,
},
@ -50,7 +50,7 @@ minetest.register_entity("digtron:marker_vertical", {
end,
})
minetest.register_entity("digtron:marker_crate", {
minetest.register_entity("digtron:marker_crate_good", {
initial_properties = {
visual = "cube",
visual_size = {x=1.05, y=1.05},
@ -60,15 +60,32 @@ minetest.register_entity("digtron:marker_crate", {
},
on_activate = function(self, staticdata)
local pos = self.object:getpos()
local node = minetest.get_node(pos)
local node_def = minetest.registered_nodes[node.name]
if not node_def.buildable_to then
local props = self.object:get_properties()
props.textures = {"digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png"}
self.object:set_properties(props)
end
minetest.after(5.0,
function(self)
self.object:remove()
end,
self)
end,
on_rightclick=function(self, clicker)
self.object:remove()
end,
on_punch = function(self, hitter)
self.object:remove()
end,
})
minetest.register_entity("digtron:marker_crate_bad", {
initial_properties = {
visual = "cube",
visual_size = {x=1.05, y=1.05},
textures = {"digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png", "digtron_no_entry.png"},
collisionbox = {-0.525, -0.525, -0.525, 0.525, 0.525, 0.525},
physical = false,
},
on_activate = function(self, staticdata)
minetest.after(5.0,
function(self)
self.object:remove()

View File

@ -1,4 +1,7 @@
digtron = {}
dofile( minetest.get_modpath( "digtron" ) .. "/util.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/doc.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/class_pointset.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/class_layout.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/entities.lua" )
@ -8,7 +11,7 @@ dofile( minetest.get_modpath( "digtron" ) .. "/node_diggers.lua" ) -- contains a
dofile( minetest.get_modpath( "digtron" ) .. "/node_builders.lua" ) -- contains all builders (there's just one currently)
dofile( minetest.get_modpath( "digtron" ) .. "/node_controllers.lua" ) -- controllers
dofile( minetest.get_modpath( "digtron" ) .. "/node_axle.lua" ) -- Rotation controller
dofile( minetest.get_modpath( "digtron" ) .. "/crate.lua" ) -- Digtron portability support
dofile( minetest.get_modpath( "digtron" ) .. "/node_crate.lua" ) -- Digtron portability support
dofile( minetest.get_modpath( "digtron" ) .. "/recipes.lua" )
digtron.creative_mode = false -- this causes digtrons to operate without consuming fuel or building materials.

View File

@ -1,5 +1,7 @@
minetest.register_node("digtron:axle", {
description = "Digtron Rotation Unit",
description = "Digtron Rotation Axle",
_doc_items_longdesc = digtron.doc.axle_longdesc,
_doc_items_usagehelp = digtron.doc.axle_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
drop = "digtron:axle",
sounds = digtron.metal_sounds,

View File

@ -2,7 +2,9 @@
-- Builds objects in the targeted node. This is a complicated beastie.
minetest.register_node("digtron:builder", {
description = "Builder Unit",
description = "Digtron Builder Module",
_doc_items_longdesc = digtron.doc.builder_longdesc,
_doc_items_usagehelp = digtron.doc.builder_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 4},
drop = "digtron:builder",
sounds = digtron.metal_sounds,

View File

@ -14,6 +14,8 @@ local controller_nodebox ={
-- Master controller. Most complicated part of the whole system. Determines which direction a digtron moves and triggers all of its component parts.
minetest.register_node("digtron:controller", {
description = "Digtron Control Unit",
_doc_items_longdesc = digtron.doc.controller_longdesc,
_doc_items_usagehelp = digtron.doc.controller_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
drop = "digtron:controller",
sounds = digtron.metal_sounds,
@ -149,6 +151,8 @@ end
minetest.register_node("digtron:auto_controller", {
description = "Digtron Automatic Control Unit",
_doc_items_longdesc = digtron.doc.auto_controller_longdesc,
_doc_items_usagehelp = digtron.doc.auto_controller_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
drop = "digtron:auto_controller",
sounds = digtron.metal_sounds,
@ -253,6 +257,8 @@ minetest.register_node("digtron:auto_controller", {
-- Handy for shoving a digtron to the side if it's been built a bit off.
minetest.register_node("digtron:pusher", {
description = "Digtron Pusher Unit",
_doc_items_longdesc = digtron.doc.pusher_longdesc,
_doc_items_usagehelp = digtron.doc.pusher_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
drop = "digtron:pusher",
sounds = digtron.metal_sounds,

View File

@ -8,7 +8,9 @@ minetest.register_craft({
})
minetest.register_node("digtron:empty_crate", {
description = "Empty Digtron Crate",
description = "Digtron Crate (Empty)",
_doc_items_longdesc = digtron.doc.empty_crate_longdesc,
_doc_items_usagehelp = digtron.doc.empty_crate_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3},
drop = "digtron:empty_crate",
sounds = default.node_sound_wood_defaults(),
@ -58,7 +60,9 @@ local loaded_formspec = "size[4,1.5]" ..
"tooltip[unpack;Attempts to unpack the Digtron on this location]"
minetest.register_node("digtron:loaded_crate", {
description = "Loaded Digtron Crate",
description = "Digtron Crate (Loaded)",
_doc_items_longdesc = digtron.doc.loaded_crate_longdesc,
_doc_items_usagehelp = digtron.doc.loaded_crate_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, not_in_creative_inventory=1, digtron=1},
stack_max = 1,
sounds = default.node_sound_wood_defaults(),
@ -78,7 +82,6 @@ minetest.register_node("digtron:loaded_crate", {
meta:set_string("infotext", fields.title)
end
if not (fields.unpack or fields.show) then
return
end
@ -93,9 +96,23 @@ minetest.register_node("digtron:loaded_crate", {
return
end
local protected_node = false
local obstructed_node = false
local pos_diff = vector.subtract(pos, layout.controller)
layout.controller = pos
for _, node_image in pairs(layout.all) do
node_image.pos = vector.add(pos_diff, node_image.pos)
if not vector.equals(pos, node_image.pos) then
minetest.add_entity(node_image.pos, "digtron:marker_crate")
if minetest.is_protected(node_image.pos, sender:get_player_name()) and not minetest.check_player_privs(sender, "protection_bypass") then
protected_node = true
minetest.add_entity(node_image.pos, "digtron:marker_crate_bad")
elseif not minetest.registered_nodes[minetest.get_node(node_image.pos).name].buildable_to then
obstructed_node = true
minetest.add_entity(node_image.pos, "digtron:marker_crate_bad")
else
minetest.add_entity(node_image.pos, "digtron:marker_crate_good")
end
end
end
@ -103,30 +120,21 @@ minetest.register_node("digtron:loaded_crate", {
return
end
local pos_diff = vector.subtract(pos, layout.controller)
layout.controller = pos
for _, node_image in pairs(layout.all) do
node_image.pos = vector.add(pos_diff, node_image.pos)
if minetest.is_protected(node_image.pos, sender:get_player_name()) and not minetest.check_player_privs(sender, "protection_bypass") then
meta:set_string("infotext", meta:get_string("title") .. "\nUnable to deploy Digtron due to protected nodes in target area")
minetest.sound_play("buzzer", {gain=0.5, pos=pos})
return
end
if not minetest.registered_nodes[minetest.get_node(node_image.pos).name].buildable_to
and not vector.equals(layout.controller, node_image.pos) then
meta:set_string("infotext", meta:get_string("title") .. "\nUnable to deploy Digtron due to obstruction in target area")
minetest.sound_play("buzzer", {gain=0.5, pos=pos})
return
end
if protected_node then
meta:set_string("infotext", meta:get_string("title") .. "\nUnable to deploy Digtron due to protected nodes in target area")
minetest.sound_play("buzzer", {gain=0.5, pos=pos})
return
end
if obstructed_node then
meta:set_string("infotext", meta:get_string("title") .. "\nUnable to deploy Digtron due to obstruction in target area")
minetest.sound_play("buzzer", {gain=0.5, pos=pos})
return
end
-- build digtron. Since the empty crate was included in the layout, that will overwrite this loaded crate and destroy it.
if layout then
minetest.sound_play("machine2", {gain=1.0, pos=pos})
layout:write_layout_image(sender)
end
minetest.sound_play("machine2", {gain=1.0, pos=pos})
layout:write_layout_image(sender)
end,
on_dig = function(pos, node, player)

View File

@ -53,7 +53,9 @@ end,
-- Digs out nodes that are "in front" of the digger head.
minetest.register_node("digtron:digger", {
description = "Digger Head",
description = "Digtron Digger Head",
_doc_items_longdesc = digtron.doc.digger_longdesc,
_doc_items_usagehelp = digtron.doc.digger_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
drop = "digtron:digger",
sounds = digtron.metal_sounds,
@ -104,7 +106,9 @@ minetest.register_node("digtron:digger", {
-- Digs out nodes that are "in front" of the digger head.
minetest.register_node("digtron:intermittent_digger", {
description = "Intermittent Digger Head",
description = "Digtron Intermittent Digger Head",
_doc_items_longdesc = digtron.doc.intermittent_digger_longdesc,
_doc_items_usagehelp = digtron.doc.intermittent_digger_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
drop = "digtron:intermittent_digger",
sounds = digtron.metal_sounds,
@ -172,7 +176,9 @@ minetest.register_node("digtron:intermittent_digger", {
-- A special-purpose digger to deal with stuff like sand and gravel in the ceiling. It always digs (no periodicity or offset), but it only digs falling_block nodes
minetest.register_node("digtron:soft_digger", {
description = "Soft Material Digger Head",
description = "Digtron Soft Material Digger Head",
_doc_items_longdesc = digtron.doc.soft_digger_longdesc,
_doc_items_usagehelp = digtron.doc.soft_digger_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
drop = "digtron:soft_digger",
sounds = digtron.metal_sounds,
@ -225,7 +231,9 @@ minetest.register_node("digtron:soft_digger", {
})
minetest.register_node("digtron:intermittent_soft_digger", {
description = "Intermittent Soft Material Digger Head",
description = "Digtron Intermittent Soft Material Digger Head",
_doc_items_longdesc = digtron.doc.intermittent_soft_digger_longdesc,
_doc_items_usagehelp = digtron.doc.intermittent_soft_digger_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
drop = "digtron:intermittent_soft_digger",
sounds = digtron.metal_sounds,
@ -296,7 +304,9 @@ minetest.register_node("digtron:intermittent_soft_digger", {
-- Digs out nodes that are "in front" of the digger head and "below" the digger head (can be rotated).
minetest.register_node("digtron:dual_digger", {
description = "Dual Digger Head",
description = "Digtron Dual Digger Head",
_doc_items_longdesc = digtron.doc.dual_digger_longdesc,
_doc_items_usagehelp = digtron.doc.dual_digger_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
drop = "digtron:dual_digger",
sounds = digtron.metal_sounds,
@ -371,7 +381,9 @@ minetest.register_node("digtron:dual_digger", {
-- Digs out soft nodes that are "in front" of the digger head and "below" the digger head (can be rotated).
minetest.register_node("digtron:dual_soft_digger", {
description = "Dual Soft Material Digger Head",
description = "Digtron Dual Soft Material Digger Head",
_doc_items_longdesc = digtron.doc.dual_soft_digger_longdesc,
_doc_items_usagehelp = digtron.doc.dual_soft_digger_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
drop = "digtron:dual_soft_digger",
sounds = digtron.metal_sounds,

View File

@ -1,6 +1,8 @@
-- A do-nothing "structural" node, to ensure all digtron nodes that are supposed to be connected to each other can be connected to each other.
minetest.register_node("digtron:structure", {
description = "Digtron Structure",
_doc_items_longdesc = digtron.doc.structure_longdesc,
_doc_items_usagehelp = digtron.doc.structure_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
drop = "digtron:structure",
tiles = {"digtron_plate.png"},
@ -32,6 +34,8 @@ minetest.register_node("digtron:structure", {
-- A modest light source that will move with the digtron, handy for working in a tunnel you aren't bothering to install permanent lights in.
minetest.register_node("digtron:light", {
description = "Digtron Light",
_doc_items_longdesc = digtron.doc.light_longdesc,
_doc_items_usagehelp = digtron.doc.light_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
drop = "digtron:light",
tiles = {"digtron_plate.png^digtron_light.png"},
@ -52,6 +56,8 @@ minetest.register_node("digtron:light", {
-- A simple structural panel
minetest.register_node("digtron:panel", {
description = "Digtron Panel",
_doc_items_longdesc = digtron.doc.panel_longdesc,
_doc_items_usagehelp = digtron.doc.panel_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
drop = "digtron:panel",
tiles = {"digtron_plate.png"},
@ -73,6 +79,8 @@ minetest.register_node("digtron:panel", {
-- A simple structural panel
minetest.register_node("digtron:edge_panel", {
description = "Digtron Edge Panel",
_doc_items_longdesc = digtron.doc.edge_panel_longdesc,
_doc_items_usagehelp = digtron.doc.edge_panel_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
drop = "digtron:edge_panel",
tiles = {"digtron_plate.png"},
@ -100,6 +108,8 @@ minetest.register_node("digtron:edge_panel", {
minetest.register_node("digtron:corner_panel", {
description = "Digtron Corner Panel",
_doc_items_longdesc = digtron.doc.corner_panel_longdesc,
_doc_items_usagehelp = digtron.doc.corner_panel_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 1},
drop = "digtron:corner_panel",
tiles = {"digtron_plate.png"},

View File

@ -1,8 +1,9 @@
-- Storage buffer. Builder nodes draw from this inventory and digger nodes deposit into it.
-- Note that inventories are digtron group 2.
minetest.register_node("digtron:inventory",
{
minetest.register_node("digtron:inventory", {
description = "Digtron Inventory Storage",
_doc_items_longdesc = digtron.doc.inventory_longdesc,
_doc_items_usagehelp = digtron.doc.inventory_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 2, tubedevice = 1, tubedevice_receiver = 1},
drop = "digtron:inventory",
sounds = digtron.metal_sounds,
@ -61,9 +62,10 @@ minetest.register_node("digtron:inventory",
-- Fuel storage. Controller node draws fuel from here.
-- Note that fuel stores are digtron group 5.
minetest.register_node("digtron:fuelstore",
{
minetest.register_node("digtron:fuelstore", {
description = "Digtron Fuel Storage",
_doc_items_longdesc = digtron.doc.fuelstore_longdesc,
_doc_items_usagehelp = digtron.doc.fuelstore_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 5, tubedevice = 1, tubedevice_receiver = 1},
drop = "digtron:fuelstore",
sounds = digtron.metal_sounds,
@ -142,9 +144,10 @@ minetest.register_node("digtron:fuelstore",
})
-- Combined storage. Group 6 has both an inventory and a fuel store
minetest.register_node("digtron:combined_storage",
{
minetest.register_node("digtron:combined_storage", {
description = "Digtron Combined Storage",
_doc_items_longdesc = digtron.doc.combined_storage_longdesc,
_doc_items_usagehelp = digtron.doc.combined_storage_usagehelp,
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 6, tubedevice = 1, tubedevice_receiver = 1},
drop = "digtron:combined_storage",
sounds = digtron.metal_sounds,

View File

@ -1,6 +1,8 @@
minetest.register_craftitem("digtron:digtron_core", {
description = "Digtron Core",
inventory_image = "digtron_core.png"
inventory_image = "digtron_core.png",
_doc_items_longdesc = digtron.doc.core_longdesc,
_doc_items_usagehelp = digtron.doc.core_usagehelp,
})
minetest.register_craft({

View File

@ -1,7 +1,5 @@
-- A random assortment of methods used in various places in this mod.
digtron = {}
dofile( minetest.get_modpath( "digtron" ) .. "/util_item_place_node.lua" ) -- separated out to avoid potential for license complexity
dofile( minetest.get_modpath( "digtron" ) .. "/util_execute_cycle.lua" ) -- separated out simply for tidiness, there's some big code in there