### `item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]`
* `item name` is the registered name of an item/node
+* `name` is non-optional and must be unique, or else tooltips are broken.
* The item description will be used as the tooltip. This can be overridden with
a tooltip element.
* `hand`: list containing an override for the empty hand
* Is not created automatically, use `InvRef:set_size`
* Is only used to enhance the empty hand's tool capabilities
+* `offhand`: list containing the offhand wielded item.
+ * Is not created automatically, use `InvRef:set_size`
+ * Will be used for placements and secondary uses if the
+ main hand does not have any node_place_prediction, on_place
+ or on_secondary_use callbacks.
+ * Is passed to on_place and on_secondary_use callbacks; make sure
+ mods are aware of the itemstack not neccessarily being
+ located in the main hand.
+ * The offhand item cannot have its own range or liquids_pointable and
+ will always reuse the characteristics from the hand item.
Colors
======
* Returns a vector where the function `func` has been applied to each
component.
* `vector.combine(v, w, func)`:
- * Returns a vector where the function `func` has combined both components of `v` and `w`
- for each component
+ * Returns a vector where the function `func` has combined both components of `v` and `w`
+ for each component
* `vector.equals(v1, v2)`:
* Returns a boolean, `true` if the vectors are identical.
* `vector.sort(v1, v2)`:
used for updating the entity state.
* `on_deactivate(self, removal)`
* Called when the object is about to get removed or unloaded.
- * `removal`: boolean indicating whether the object is about to get removed.
- Calling `object:remove()` on an active object will call this with `removal=true`.
- The mapblock the entity resides in being unloaded will call this with `removal=false`.
- * Note that this won't be called if the object hasn't been activated in the first place.
- In particular, `minetest.clear_objects({mode = "full"})` won't call this,
- whereas `minetest.clear_objects({mode = "quick"})` might call this.
+ * `removal`: boolean indicating whether the object is about to get removed.
+ Calling `object:remove()` on an active object will call this with `removal=true`.
+ The mapblock the entity resides in being unloaded will call this with `removal=false`.
+ * Note that this won't be called if the object hasn't been activated in the first place.
+ In particular, `minetest.clear_objects({mode = "full"})` won't call this,
+ whereas `minetest.clear_objects({mode = "quick"})` might call this.
* `on_step(self, dtime, moveresult)`
* Called on every server tick, after movement and collision processing.
* `dtime`: elapsed time since last call
protocol_version = 32, -- protocol version used by client
formspec_version = 2, -- supported formspec version
lang_code = "fr" -- Language code used for translation
+
-- the following keys can be missing if no stats have been collected yet
min_rtt = 0.01, -- minimum round trip time
max_rtt = 0.2, -- maximum round trip time
--vers_string = "0.4.9-git", -- full version string
--state = "Active" -- current client state
}
+* `minetest.get_player_window_information(player_name)`:
+
+ -- Will only be present if the client sent this information (requires v5.7+)
+ --
+ -- Note that none of these things are constant, they are likely to change during a client
+ -- connection as the player resizes the window and moves it between monitors
+ --
+ -- real_gui_scaling and real_hud_scaling can be used instead of DPI.
+ -- OSes don't necessarily give the physical DPI, as they may allow user configuration.
+ -- real_*_scaling is just OS DPI / 96 but with another level of user configuration.
+ {
+ -- Current size of the in-game render target (pixels).
+ --
+ -- This is usually the window size, but may be smaller in certain situations,
+ -- such as side-by-side mode.
+ size = {
+ x = 1308,
+ y = 577,
+ },
+
+ -- Estimated maximum formspec size before Minetest will start shrinking the
+ -- formspec to fit. For a fullscreen formspec, use a size 10-20% larger than
+ -- this and `padding[-0.01,-0.01]`.
+ max_formspec_size = {
+ x = 20,
+ y = 11.25
+ },
+
+ -- GUI Scaling multiplier
+ -- Equal to the setting `gui_scaling` multiplied by `dpi / 96`
+ real_gui_scaling = 1,
+
+ -- HUD Scaling multiplier
+ -- Equal to the setting `hud_scaling` multiplied by `dpi / 96`
+ real_hud_scaling = 1,
+ }
* `minetest.mkdir(path)`: returns success.
* Creates a directory specified by `path`, creating parent directories
* `sky_parameters` is a table with the following optional fields:
* `base_color`: ColorSpec, changes fog in "skybox" and "plain".
(default: `#ffffff`)
+ * `body_orbit_tilt`: Float, angle of sun/moon orbit in degrees, relative to Y axis.
+ Valid range [-60.0,60.0] (default: 0.0)
* `type`: Available types:
* `"regular"`: Uses 0 textures, `base_color` ignored
* `"skybox"`: Uses 6 textures, `base_color` used as fog.
collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, -- default
selectionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, rotate = false },
- -- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position.
+ -- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position.
-- Collision boxes cannot rotate, setting `rotate = true` on it has no effect.
-- If not set, the selection box copies the collision box, and will also not rotate.
-- If `rotate = false`, the selection box will not rotate with the object itself, remaining fixed to the axes.
-- If `rotate = true`, it will match the object's rotation and any attachment rotations.
-- Raycasts use the selection box and object's rotation, but do *not* obey attachment rotations.
-
+
pointable = true,
-- Whether the object can be pointed at
},
on_place = function(itemstack, placer, pointed_thing),
- -- When the 'place' key was pressed with the item in hand
+ -- When the 'place' key was pressed with the item one of the hands
-- and a node was pointed at.
+ -- 'itemstack' may be the offhand item in cases where the main hand has
+ -- no on_place handler and no node_placement_prediction.
-- Shall place item and return the leftover itemstack
-- or nil to not modify the inventory.
-- The placer may be any ObjectRef or nil.
-- default: minetest.item_place
on_secondary_use = function(itemstack, user, pointed_thing),
- -- Same as on_place but called when not pointing at a node.
- -- Function must return either nil if inventory shall not be modified,
- -- or an itemstack to replace the original itemstack.
- -- The user may be any ObjectRef or nil.
+ -- Same as on_place but called when not pointing at a node,
+ -- whereas `user` is the same as `placer` above.
-- default: nil
on_drop = function(itemstack, dropper, pos),
-- the format and see [Privileges] for an overview of privileges.
func = function(name, param),
- -- Called when command is run.
+ -- Called when command is run.
-- * `name` is the name of the player who issued the command.
-- * `param` is a string with the full arguments to the command.
- -- Returns a boolean for success and a string value.
+ -- Returns a boolean for success and a string value.
-- The string is shown to the issuing player upon exit of `func` or,
-- if `func` returns `false` and no string, the help message is shown.
}