Initial commit
53
README.txt
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
Minetest Game [minetest_game]
|
||||||
|
=============================
|
||||||
|
The main subgame for the Minetest engine
|
||||||
|
========================================
|
||||||
|
|
||||||
|
To use this subgame with the Minetest engine, insert this repository as
|
||||||
|
/games/landrush_game
|
||||||
|
|
||||||
|
The Minetest engine can be found in:
|
||||||
|
https://github.com/bremaweb/landrush_game/
|
||||||
|
|
||||||
|
Compatibility
|
||||||
|
--------------
|
||||||
|
The Minetest Game github master HEAD is generally compatible with the github
|
||||||
|
master HEAD of the Minetest engine.
|
||||||
|
|
||||||
|
Additionally, when the Minetest engine is tagged to be a certain version (eg.
|
||||||
|
0.4.10), Minetest Game is tagged with the version too.
|
||||||
|
|
||||||
|
When stable releases are made, Minetest Game is packaged and made available in
|
||||||
|
http://minetest.net/download
|
||||||
|
and in case the repository has grown too much, it may be reset. In that sense,
|
||||||
|
this is not a "real" git repository. (Package maintainers please note!)
|
||||||
|
|
||||||
|
License of source code
|
||||||
|
----------------------
|
||||||
|
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
See README.txt in each mod directory for information about other authors.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
License of media (textures and sounds)
|
||||||
|
--------------------------------------
|
||||||
|
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
See README.txt in each mod directory for information about other authors.
|
||||||
|
|
||||||
|
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||||
|
http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
|
|
||||||
|
License of menu/header.png
|
||||||
|
Copyright (C) 2015 paramat CC BY-SA 3.0
|
635
game_api.txt
Normal file
@ -0,0 +1,635 @@
|
|||||||
|
Minetest Game API
|
||||||
|
=================
|
||||||
|
GitHub Repo: https://github.com/minetest/minetest_game
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
The Minetest Game subgame offers multiple new possibilities in addition to the Minetest engine's built-in API,
|
||||||
|
allowing you to add new plants to farming mod, buckets for new liquids, new stairs and custom panes.
|
||||||
|
For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
|
||||||
|
Please note:
|
||||||
|
|
||||||
|
* [XYZ] refers to a section the Minetest API
|
||||||
|
* [#ABC] refers to a section in this document
|
||||||
|
* [pos] refers to a position table `{x = -5, y = 0, z = 200}`
|
||||||
|
|
||||||
|
Bucket API
|
||||||
|
----------
|
||||||
|
|
||||||
|
The bucket API allows registering new types of buckets for non-default liquids.
|
||||||
|
|
||||||
|
|
||||||
|
bucket.register_liquid(
|
||||||
|
"default:lava_source", -- name of the source node
|
||||||
|
"default:lava_flowing", -- name of the flowing node
|
||||||
|
"bucket:bucket_lava", -- name of the new bucket item (or nil if liquid is not takeable)
|
||||||
|
"bucket_lava.png", -- texture of the new bucket item (ignored if itemname == nil)
|
||||||
|
"Lava Bucket", -- text description of the bucket item
|
||||||
|
{lava_bucket = 1} -- groups of the bucket item, OPTIONAL
|
||||||
|
)
|
||||||
|
|
||||||
|
Beds API
|
||||||
|
--------
|
||||||
|
|
||||||
|
beds.register_bed(
|
||||||
|
"beds:bed", -- Bed name
|
||||||
|
def -- See [#Bed definition]
|
||||||
|
)
|
||||||
|
|
||||||
|
* `beds.read_spawns() ` Returns a table containing players respawn positions
|
||||||
|
* `beds.kick_players()` Forces all players to leave bed
|
||||||
|
* `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping
|
||||||
|
|
||||||
|
### Bed definition
|
||||||
|
|
||||||
|
{
|
||||||
|
description = "Simple Bed",
|
||||||
|
inventory_image = "beds_bed.png",
|
||||||
|
wield_image = "beds_bed.png",
|
||||||
|
tiles = {
|
||||||
|
bottom = {'Tile definition'}, -- the tiles of the bottom part of the bed.
|
||||||
|
top = {Tile definition} -- the tiles of the bottom part of the bed.
|
||||||
|
},
|
||||||
|
nodebox = {
|
||||||
|
bottom = 'regular nodebox', -- bottom part of bed (see [Node boxes])
|
||||||
|
top = 'regular nodebox', -- top part of bed (see [Node boxes])
|
||||||
|
},
|
||||||
|
selectionbox = 'regular nodebox', -- for both nodeboxes (see [Node boxes])
|
||||||
|
recipe = { -- Craft recipe
|
||||||
|
{"group:wool", "group:wool", "group:wool"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Creative API
|
||||||
|
------------
|
||||||
|
|
||||||
|
A global string called `creative.formspec_add` was added which allows mods to add additional formspec elements onto the default creative inventory formspec to be drawn after each update.
|
||||||
|
|
||||||
|
Doors API
|
||||||
|
---------
|
||||||
|
|
||||||
|
The doors mod allows modders to register custom doors and trapdoors.
|
||||||
|
|
||||||
|
`doors.register_door(name, def)`
|
||||||
|
|
||||||
|
* Registers new door
|
||||||
|
* `name` Name for door
|
||||||
|
* `def` See [#Door definition]
|
||||||
|
|
||||||
|
`doors.register_trapdoor(name, def)`
|
||||||
|
|
||||||
|
* Registers new trapdoor
|
||||||
|
* `name` Name for trapdoor
|
||||||
|
* `def` See [#Trapdoor definition]
|
||||||
|
|
||||||
|
`doors.register_fencegate(name, def)`
|
||||||
|
|
||||||
|
* Registers new fence gate
|
||||||
|
* `name` Name for fence gate
|
||||||
|
* `def` See [#Fence gate definition]
|
||||||
|
|
||||||
|
`doors.get(pos)`
|
||||||
|
|
||||||
|
* `pos` A position as a table, e.g `{x = 1, y = 1, z = 1}`
|
||||||
|
* Returns an ObjectRef to a door, or nil if the position does not contain a door
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
:open(player) -- Open the door object, returns if door was opened
|
||||||
|
:close(player) -- Close the door object, returns if door was closed
|
||||||
|
:toggle(player) -- Toggle the door state, returns if state was toggled
|
||||||
|
:state() -- returns the door state, true = open, false = closed
|
||||||
|
|
||||||
|
the "player" parameter can be omitted in all methods. If passed then
|
||||||
|
the usual permission checks will be performed to make sure the player
|
||||||
|
has the permissions needed to open this door. If omitted then no
|
||||||
|
permission checks are performed.
|
||||||
|
|
||||||
|
### Door definition
|
||||||
|
|
||||||
|
description = "Door description",
|
||||||
|
inventory_image = "mod_door_inv.png",
|
||||||
|
groups = {choppy = 2},
|
||||||
|
tiles = {"mod_door.png"}, -- UV map.
|
||||||
|
recipe = craftrecipe,
|
||||||
|
sounds = default.node_sound_wood_defaults(), -- optional
|
||||||
|
sound_open = sound play for open door, -- optional
|
||||||
|
sound_close = sound play for close door, -- optional
|
||||||
|
protected = false, -- If true, only placer can open the door (locked for others)
|
||||||
|
|
||||||
|
### Trapdoor definition
|
||||||
|
|
||||||
|
description = "Trapdoor description",
|
||||||
|
inventory_image = "mod_trapdoor_inv.png",
|
||||||
|
groups = {choppy = 2},
|
||||||
|
tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor
|
||||||
|
tile_side = "doors_trapdoor_side.png", -- the tiles of the four side parts of the trapdoor
|
||||||
|
sounds = default.node_sound_wood_defaults(), -- optional
|
||||||
|
sound_open = sound play for open door, -- optional
|
||||||
|
sound_close = sound play for close door, -- optional
|
||||||
|
protected = false, -- If true, only placer can open the door (locked for others)
|
||||||
|
|
||||||
|
### Fence gate definition
|
||||||
|
|
||||||
|
description = "Wooden Fence Gate",
|
||||||
|
texture = "default_wood.png",
|
||||||
|
material = "default:wood",
|
||||||
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||||
|
sounds = default.node_sound_wood_defaults(), -- optional
|
||||||
|
|
||||||
|
Fence API
|
||||||
|
---------
|
||||||
|
|
||||||
|
Allows creation of new fences with "fencelike" drawtype.
|
||||||
|
|
||||||
|
`default.register_fence(name, item definition)`
|
||||||
|
|
||||||
|
Registers a new fence. Custom fields texture and material are required, as
|
||||||
|
are name and description. The rest is optional. You can pass most normal
|
||||||
|
nodedef fields here except drawtype. The fence group will always be added
|
||||||
|
for this node.
|
||||||
|
|
||||||
|
### fence definition
|
||||||
|
|
||||||
|
name = "default:fence_wood",
|
||||||
|
description = "Wooden Fence",
|
||||||
|
texture = "default_wood.png",
|
||||||
|
material = "default:wood",
|
||||||
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
|
||||||
|
Walls API
|
||||||
|
---------
|
||||||
|
|
||||||
|
The walls API allows easy addition of stone auto-connecting wall nodes.
|
||||||
|
|
||||||
|
walls.register(name, desc, texture, mat, sounds)
|
||||||
|
^ name = "walls:stone_wall". Node name.
|
||||||
|
^ desc = "A Stone wall"
|
||||||
|
^ texture = "default_stone.png"
|
||||||
|
^ mat = "default:stone". Used to auto-generate crafting recipe.
|
||||||
|
^ sounds = sounds: see [#Default sounds]
|
||||||
|
|
||||||
|
Farming API
|
||||||
|
-----------
|
||||||
|
|
||||||
|
The farming API allows you to easily register plants and hoes.
|
||||||
|
|
||||||
|
`farming.register_hoe(name, hoe definition)`
|
||||||
|
* Register a new hoe, see [#hoe definition]
|
||||||
|
|
||||||
|
`farming.register_plant(name, Plant definition)`
|
||||||
|
* Register a new growing plant, see [#Plant definition]
|
||||||
|
|
||||||
|
### Hoe Definition
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
description = "", -- Description for tooltip
|
||||||
|
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
|
||||||
|
max_uses = 30, -- Uses until destroyed
|
||||||
|
material = "", -- Material for recipes
|
||||||
|
recipe = { -- Craft recipe, if material isn't used
|
||||||
|
{"air", "air", "air"},
|
||||||
|
{"", "group:stick"},
|
||||||
|
{"", "group:stick"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
### Plant definition
|
||||||
|
|
||||||
|
{
|
||||||
|
description = "", -- Description of seed item
|
||||||
|
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
|
||||||
|
steps = 8, -- How many steps the plant has to grow, until it can be harvested
|
||||||
|
-- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
|
||||||
|
minlight = 13, -- Minimum light to grow
|
||||||
|
maxlight = default.LIGHT_MAX -- Maximum light to grow
|
||||||
|
}
|
||||||
|
|
||||||
|
Fire API
|
||||||
|
--------
|
||||||
|
|
||||||
|
New node def property:
|
||||||
|
|
||||||
|
`on_burn(pos)`
|
||||||
|
|
||||||
|
* Called when fire attempts to remove a burning node.
|
||||||
|
* `pos` Position of the burning node.
|
||||||
|
|
||||||
|
Give Initial Stuff API
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
`give_initial_stuff.give(player)`
|
||||||
|
|
||||||
|
^ Give initial stuff to "player"
|
||||||
|
|
||||||
|
`give_initial_stuff.add(stack)`
|
||||||
|
|
||||||
|
^ Add item to the initial stuff
|
||||||
|
^ Stack can be an ItemStack or a item name eg: "default:dirt 99"
|
||||||
|
^ Can be called after the game has loaded
|
||||||
|
|
||||||
|
`give_initial_stuff.clear()`
|
||||||
|
|
||||||
|
^ Removes all items from the initial stuff
|
||||||
|
^ Can be called after the game has loaded
|
||||||
|
|
||||||
|
`give_initial_stuff.get_list()`
|
||||||
|
|
||||||
|
^ returns list of item stacks
|
||||||
|
|
||||||
|
`give_initial_stuff.set_list(list)`
|
||||||
|
|
||||||
|
^ List of initial items with numeric indices.
|
||||||
|
|
||||||
|
`give_initial_stuff.add_from_csv(str)`
|
||||||
|
|
||||||
|
^ str is a comma separated list of initial stuff
|
||||||
|
^ Adds items to the list of items to be given
|
||||||
|
|
||||||
|
Nyancat API
|
||||||
|
-----------
|
||||||
|
|
||||||
|
`nyancat.place(pos, facedir, length)`
|
||||||
|
|
||||||
|
^ Place a cat at `pos` facing `facedir` with tail length `length`
|
||||||
|
Only accepts facedir 0-3, if facedir > 3 then it will be interpreted as facedir = 0
|
||||||
|
|
||||||
|
`nyancat.generate(minp, maxp, seed)`
|
||||||
|
|
||||||
|
^ Called by `minetest.register_on_generated`. To disable nyancat generation,
|
||||||
|
you can redefine nyancat.generate() to be an empty function
|
||||||
|
|
||||||
|
TNT API
|
||||||
|
----------
|
||||||
|
|
||||||
|
`tnt.register_tnt(definition)`
|
||||||
|
|
||||||
|
^ Register a new type of tnt.
|
||||||
|
|
||||||
|
* `name` The name of the node. If no prefix is given `tnt` is used.
|
||||||
|
* `description` A description for your TNT.
|
||||||
|
* `radius` The radius within which the TNT can destroy nodes. The default is 3.
|
||||||
|
* `damage_radius` The radius within which the TNT can damage players and mobs. By default it is twice the `radius`.
|
||||||
|
* `disable_drops` Disable drops. By default it is set to false.
|
||||||
|
* `ignore_protection` Don't check `minetest.is_protected` before removing a node.
|
||||||
|
* `ignore_on_blast` Don't call `on_blast` even if a node has one.
|
||||||
|
* `tiles` Textures for node
|
||||||
|
* `side` Side tiles. By default the name of the tnt with a suffix of `_side.png`.
|
||||||
|
* `top` Top tile. By default the name of the tnt with a suffix of `_top.png`.
|
||||||
|
* `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`.
|
||||||
|
* `burning` Top tile when lit. By default the name of the tnt with a suffix of `_top_burning_animated.png".
|
||||||
|
|
||||||
|
`tnt.boom(position, definition)`
|
||||||
|
|
||||||
|
^ Create an explosion.
|
||||||
|
|
||||||
|
* `position` The center of explosion.
|
||||||
|
* `definition` The TNT definion as passed to `tnt.register`
|
||||||
|
|
||||||
|
`tnt.burn(position)`
|
||||||
|
|
||||||
|
^ Ignite TNT at position
|
||||||
|
|
||||||
|
|
||||||
|
To make dropping items from node inventories easier, you can use the
|
||||||
|
following helper function from 'default':
|
||||||
|
|
||||||
|
default.get_inventory_drops(pos, inventory, drops)
|
||||||
|
|
||||||
|
^ Return drops from node inventory "inventory" in drops.
|
||||||
|
|
||||||
|
* `pos` - the node position
|
||||||
|
* `inventory` - the name of the inventory (string)
|
||||||
|
* `drops` - an initialized list
|
||||||
|
|
||||||
|
The function returns no values. The drops are returned in the `drops`
|
||||||
|
parameter, and drops is not reinitialized so you can call it several
|
||||||
|
times in a row to add more inventory items to it.
|
||||||
|
|
||||||
|
|
||||||
|
`on_blast` callbacks:
|
||||||
|
|
||||||
|
Both nodedefs and entitydefs can provide an `on_blast()` callback
|
||||||
|
|
||||||
|
`nodedef.on_blast(pos, intensity)`
|
||||||
|
^ Allow drop and node removal overriding
|
||||||
|
* `pos` - node position
|
||||||
|
* `intensity` - TNT explosion measure. larger or equal to 1.0
|
||||||
|
^ Should return a list of drops (e.g. {"default:stone"})
|
||||||
|
^ Should perform node removal itself. If callback exists in the nodedef
|
||||||
|
^ then the TNT code will not destroy this node.
|
||||||
|
|
||||||
|
`entitydef.on_blast(luaobj, damage)`
|
||||||
|
^ Allow TNT effects on entities to be overridden
|
||||||
|
* `luaobj` - LuaEntityRef of the entity
|
||||||
|
* `damage` - suggested HP damage value
|
||||||
|
^ Should return a list of (bool do_damage, bool do_knockback, table drops)
|
||||||
|
* `do_damage` - if true then TNT mod wil damage the entity
|
||||||
|
* `do_knockback` - if true then TNT mod will knock the entity away
|
||||||
|
* `drops` - a list of drops, e.g. {"wool:red"}
|
||||||
|
|
||||||
|
|
||||||
|
Screwdriver API
|
||||||
|
---------------
|
||||||
|
|
||||||
|
The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it.
|
||||||
|
To use it, add the `on_screwdriver` function to the node definition.
|
||||||
|
|
||||||
|
`on_rotate(pos, node, user, mode, new_param2)`
|
||||||
|
|
||||||
|
* `pos` Position of the node that the screwdriver is being used on
|
||||||
|
* `node` that node
|
||||||
|
* `user` The player who used the screwdriver
|
||||||
|
* `mode` screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS
|
||||||
|
* `new_param2` the new value of param2 that would have been set if on_rotate wasn't there
|
||||||
|
* return value: false to disallow rotation, nil to keep default behaviour, true to allow
|
||||||
|
it but to indicate that changed have already been made (so the screwdriver will wear out)
|
||||||
|
* use `on_rotate = false` to always disallow rotation
|
||||||
|
* use `on_rotate = screwdriver.rotate_simple` to allow only face rotation
|
||||||
|
|
||||||
|
|
||||||
|
Sethome API
|
||||||
|
-----------
|
||||||
|
|
||||||
|
The sethome API adds three global functions to allow mods to read a players home position,
|
||||||
|
set a players home position and teleport a player to home position.
|
||||||
|
|
||||||
|
`sethome.get(name)`
|
||||||
|
|
||||||
|
* `name` Player who's home position you wish to get
|
||||||
|
* return value: false if no player home coords exist, position table if true
|
||||||
|
|
||||||
|
`sethome.set(name, pos)`
|
||||||
|
|
||||||
|
* `name` Player who's home position you wish to set
|
||||||
|
* `pos` Position table containing coords of home position
|
||||||
|
* return value: false if unable to set and save new home position, otherwise true
|
||||||
|
|
||||||
|
`sethome.go(name)`
|
||||||
|
|
||||||
|
* `name` Player you wish to teleport to their home position
|
||||||
|
* return value: false if player cannot be sent home, otherwise true
|
||||||
|
|
||||||
|
|
||||||
|
Stairs API
|
||||||
|
----------
|
||||||
|
|
||||||
|
The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those
|
||||||
|
delivered with Minetest Game, to keep them compatible with other mods.
|
||||||
|
|
||||||
|
`stairs.register_stair(subname, recipeitem, groups, images, description, sounds)`
|
||||||
|
|
||||||
|
* Registers a stair.
|
||||||
|
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
|
||||||
|
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
|
||||||
|
* `groups`: see [Known damage and digging time defining groups]
|
||||||
|
* `images`: see [Tile definition]
|
||||||
|
* `description`: used for the description field in the stair's definition
|
||||||
|
* `sounds`: see [#Default sounds]
|
||||||
|
|
||||||
|
`stairs.register_slab(subname, recipeitem, groups, images, description, sounds)`
|
||||||
|
|
||||||
|
* Registers a slabs
|
||||||
|
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
|
||||||
|
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble"
|
||||||
|
* `groups`: see [Known damage and digging time defining groups]
|
||||||
|
* `images`: see [Tile definition]
|
||||||
|
* `description`: used for the description field in the stair's definition
|
||||||
|
* `sounds`: see [#Default sounds]
|
||||||
|
|
||||||
|
`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)`
|
||||||
|
|
||||||
|
* A wrapper for stairs.register_stair and stairs.register_slab
|
||||||
|
* Uses almost the same arguments as stairs.register_stair
|
||||||
|
* `desc_stair`: Description for stair node
|
||||||
|
* `desc_slab`: Description for slab node
|
||||||
|
|
||||||
|
Xpanes API
|
||||||
|
----------
|
||||||
|
|
||||||
|
Creates panes that automatically connect to each other
|
||||||
|
|
||||||
|
`xpanes.register_pane(subname, def)`
|
||||||
|
|
||||||
|
* `subname`: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
|
||||||
|
* `def`: See [#Pane definition]
|
||||||
|
|
||||||
|
### Pane definition
|
||||||
|
|
||||||
|
{
|
||||||
|
textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"}, -- More tiles aren't supported
|
||||||
|
groups = {group = rating}, -- Uses the known node groups, see [Known damage and digging time defining groups]
|
||||||
|
sounds = SoundSpec, -- See [#Default sounds]
|
||||||
|
recipe = {{"","","","","","","","",""}}, -- Recipe field only
|
||||||
|
}
|
||||||
|
|
||||||
|
Raillike definitions
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The following nodes use the group `connect_to_raillike` and will only connect to
|
||||||
|
raillike nodes within this group and the same group value.
|
||||||
|
Use `minetest.raillike_group(<Name>)` to get the group value.
|
||||||
|
|
||||||
|
| Node type | Raillike group name
|
||||||
|
|-----------------------|---------------------
|
||||||
|
| default:rail | "rail"
|
||||||
|
| tnt:gunpowder | "gunpowder"
|
||||||
|
| tnt:gunpowder_burning | "gunpowder"
|
||||||
|
|
||||||
|
Example:
|
||||||
|
If you want to add a new rail type and want it to connect with default:rail,
|
||||||
|
add `connect_to_raillike=minetest.raillike_group("rail")` into the `groups` table
|
||||||
|
of your node.
|
||||||
|
|
||||||
|
|
||||||
|
Default sounds
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Sounds inside the default table can be used within the sounds field of node definitions.
|
||||||
|
|
||||||
|
* `default.node_sound_defaults()`
|
||||||
|
* `default.node_sound_stone_defaults()`
|
||||||
|
* `default.node_sound_dirt_defaults()`
|
||||||
|
* `default.node_sound_sand_defaults()`
|
||||||
|
* `default.node_sound_wood_defaults()`
|
||||||
|
* `default.node_sound_leaves_defaults()`
|
||||||
|
* `default.node_sound_glass_defaults()`
|
||||||
|
|
||||||
|
Default constants
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
`default.LIGHT_MAX` The maximum light level (see [Node definition] light_source)
|
||||||
|
|
||||||
|
Player API
|
||||||
|
----------
|
||||||
|
|
||||||
|
The player API can register player models and update the player's appearence
|
||||||
|
|
||||||
|
`default.player_register_model(name, def)`
|
||||||
|
|
||||||
|
* Register a new model to be used by players.
|
||||||
|
* name: model filename such as "character.x", "foo.b3d", etc.
|
||||||
|
* def: See [#Model definition]
|
||||||
|
|
||||||
|
`default.registered_player_models[name]`
|
||||||
|
|
||||||
|
* Get a model's definition
|
||||||
|
* see [#Model definition]
|
||||||
|
|
||||||
|
`default.player_set_model(player, model_name)`
|
||||||
|
|
||||||
|
* Change a player's model
|
||||||
|
* `player`: PlayerRef
|
||||||
|
* `model_name`: model registered with player_register_model()
|
||||||
|
|
||||||
|
`default.player_set_animation(player, anim_name [, speed])`
|
||||||
|
|
||||||
|
* Applies an animation to a player
|
||||||
|
* anim_name: name of the animation.
|
||||||
|
* speed: frames per second. If nil, default from the model is used
|
||||||
|
|
||||||
|
`default.player_set_textures(player, textures)`
|
||||||
|
|
||||||
|
* Sets player textures
|
||||||
|
* `player`: PlayerRef
|
||||||
|
* `textures`: array of textures, If `textures` is nil, the default textures from the model def are used
|
||||||
|
|
||||||
|
default.player_get_animation(player)
|
||||||
|
|
||||||
|
* Returns a table containing fields `model`, `textures` and `animation`.
|
||||||
|
* Any of the fields of the returned table may be nil.
|
||||||
|
* player: PlayerRef
|
||||||
|
|
||||||
|
### Model Definition
|
||||||
|
|
||||||
|
{
|
||||||
|
animation_speed = 30, -- Default animation speed, in FPS.
|
||||||
|
textures = {"character.png", }, -- Default array of textures.
|
||||||
|
visual_size = {x = 1, y = 1}, -- Used to scale the model.
|
||||||
|
animations = {
|
||||||
|
-- <anim_name> = {x = <start_frame>, y = <end_frame>},
|
||||||
|
foo = {x = 0, y = 19},
|
||||||
|
bar = {x = 20, y = 39},
|
||||||
|
-- ...
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
Leafdecay
|
||||||
|
---------
|
||||||
|
|
||||||
|
To enable leaf decay for a node, add it to the `leafdecay` group.
|
||||||
|
|
||||||
|
The rating of the group determines how far from a node in the group `tree`
|
||||||
|
the node can be without decaying.
|
||||||
|
|
||||||
|
If `param2` of the node is ~= 0, the node will always be preserved. Thus, if
|
||||||
|
the player places a node of that kind, you will want to set `param2 = 1` or so.
|
||||||
|
|
||||||
|
The function `default.after_place_leaves` can be set as `after_place_node of a node`
|
||||||
|
to set param2 to 1 if the player places the node (should not be used for nodes
|
||||||
|
that use param2 otherwise (e.g. facedir)).
|
||||||
|
|
||||||
|
If the node is in the `leafdecay_drop` group then it will always be dropped as an
|
||||||
|
item.
|
||||||
|
|
||||||
|
Dyes
|
||||||
|
----
|
||||||
|
|
||||||
|
To make recipes that will work with any dye ever made by anybody, define
|
||||||
|
them based on groups. You can select any group of groups, based on your need for
|
||||||
|
amount of colors.
|
||||||
|
|
||||||
|
### Color groups
|
||||||
|
|
||||||
|
Base color groups:
|
||||||
|
|
||||||
|
* `basecolor_white`
|
||||||
|
* `basecolor_grey`
|
||||||
|
* `basecolor_black`
|
||||||
|
* `basecolor_red`
|
||||||
|
* `basecolor_yellow`
|
||||||
|
* `basecolor_green`
|
||||||
|
* `basecolor_cyan`
|
||||||
|
* `basecolor_blue`
|
||||||
|
* `basecolor_magenta`
|
||||||
|
|
||||||
|
Extended color groups ( * means also base color )
|
||||||
|
|
||||||
|
* `excolor_white` *
|
||||||
|
* `excolor_lightgrey`
|
||||||
|
* `excolor_grey` *
|
||||||
|
* `excolor_darkgrey`
|
||||||
|
* `excolor_black` *
|
||||||
|
* `excolor_red` *
|
||||||
|
* `excolor_orange`
|
||||||
|
* `excolor_yellow` *
|
||||||
|
* `excolor_lime`
|
||||||
|
* `excolor_green` *
|
||||||
|
* `excolor_aqua`
|
||||||
|
* `excolor_cyan` *
|
||||||
|
* `excolor_sky_blue`
|
||||||
|
* `excolor_blue` *
|
||||||
|
* `excolor_violet`
|
||||||
|
* `excolor_magenta` *
|
||||||
|
* `excolor_red_violet`
|
||||||
|
|
||||||
|
The whole unifieddyes palette as groups:
|
||||||
|
|
||||||
|
* `unicolor_<excolor>`
|
||||||
|
|
||||||
|
For the following, no white/grey/black is allowed:
|
||||||
|
|
||||||
|
* `unicolor_medium_<excolor>`
|
||||||
|
* `unicolor_dark_<excolor>`
|
||||||
|
* `unicolor_light_<excolor>`
|
||||||
|
* `unicolor_<excolor>_s50`
|
||||||
|
* `unicolor_medium_<excolor>_s50`
|
||||||
|
* `unicolor_dark_<excolor>_s50`
|
||||||
|
|
||||||
|
Example of one shapeless recipe using a color group:
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = '<mod>:item_yellow',
|
||||||
|
recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
|
||||||
|
})
|
||||||
|
|
||||||
|
### Color lists
|
||||||
|
|
||||||
|
* `dye.basecolors` are an array containing the names of available base colors
|
||||||
|
|
||||||
|
* `dye.excolors` are an array containing the names of the available extended colors
|
||||||
|
|
||||||
|
Trees
|
||||||
|
-----
|
||||||
|
|
||||||
|
* `default.grow_tree(pos, is_apple_tree)`
|
||||||
|
* Grows a mgv6 tree or apple tree at pos
|
||||||
|
|
||||||
|
* `default.grow_jungle_tree(pos)`
|
||||||
|
* Grows a mgv6 jungletree at pos
|
||||||
|
|
||||||
|
* `default.grow_pine_tree(pos)`
|
||||||
|
* Grows a mgv6 pinetree at pos
|
||||||
|
|
||||||
|
* `default.grow_new_apple_tree(pos)`
|
||||||
|
* Grows a new design apple tree at pos
|
||||||
|
|
||||||
|
* `default.grow_new_jungle_tree(pos)`
|
||||||
|
* Grows a new design jungle tree at pos
|
||||||
|
|
||||||
|
* `default.grow_new_pine_tree(pos)`
|
||||||
|
* Grows a new design pine tree at pos
|
||||||
|
|
||||||
|
* `default.grow_new_acacia_tree(pos)`
|
||||||
|
* Grows a new design acacia tree at pos
|
||||||
|
|
||||||
|
* `default.grow_new_aspen_tree(pos)`
|
||||||
|
* Grows a new design aspen tree at pos
|
||||||
|
|
||||||
|
* `default.grow_new_snowy_pine_tree(pos)`
|
||||||
|
* Grows a new design snowy pine tree at pos
|
BIN
menu/header.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
menu/icon.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
54
mods/affects/README.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
Affects
|
||||||
|
|
||||||
|
This adds an API to easily affect players in various ways, both positive and negative.
|
||||||
|
|
||||||
|
Depends: whoison ( https://github.com/bremaweb/whoison )
|
||||||
|
License: WTFPL
|
||||||
|
|
||||||
|
Functions
|
||||||
|
|
||||||
|
affects.registerAffect( {affect definition} )
|
||||||
|
affects.affectPlayer(name,affectid)
|
||||||
|
affects.removeAffect(name,affectid)
|
||||||
|
|
||||||
|
Affect Definition
|
||||||
|
|
||||||
|
affect = {
|
||||||
|
affectid = <unique string id for this affect>,
|
||||||
|
name = <string name for this affect>,
|
||||||
|
stages = { {stage definition}, {stage definition}, .. },
|
||||||
|
onremove = function(name,player,affectid) -- optional function that is ran when the affect is removed
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Stage Definition
|
||||||
|
This is where the magic happens. You can define as many stages for an affect as you want. This can be used to gradually decrease the affect or make the affect change over time. The sky is the limit
|
||||||
|
|
||||||
|
{
|
||||||
|
time = <number of seconds this stage lasts>,
|
||||||
|
|
||||||
|
physics = { ... },
|
||||||
|
optional this is a table as used by set_physics_override ( https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1787 ) to change the physics for a player during this stage
|
||||||
|
|
||||||
|
emote = { chance = <Number 1-100>, action = <string> }
|
||||||
|
optional chance is the chance out of 100 that action will be displayed in chat as if the affected player had used /me <action>
|
||||||
|
|
||||||
|
place = { chance = <number 1-100>, node = <string node that will be placed> },
|
||||||
|
optional, chance is the chance out of 100 the player with place the node defined at their current position, node would be a string like "default:dirt"
|
||||||
|
|
||||||
|
damage = { chance = <number 1-100>, amount = <number> }
|
||||||
|
optional, chance the player will be dealt the amount defined in damage, this could be a negative number and actually result in healing instead of damage
|
||||||
|
|
||||||
|
custom { func = function(name, player, affectid), chance = <number 1-100>, runonce = <true/false> }
|
||||||
|
optional, a function that you can write to do whatever you want. runonce tells whether this function should only be ran once or not
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
When a player is affected they start at the first stage. The function to apply the affects runs every 30 seconds. Each time it runs it uses what you defined a chance to determine if it should execute that item of the stage. The custom function has a runonce variable, if true the custom function will only run one time for the whole time that stage is in affect. After the player has been online longer than the time in your stage definition they are moved to the next stage, and the affect is applied. After they pass the last stage of the affect the onremove function is called, and the physics are reset, and the affect is removed.
|
||||||
|
|
||||||
|
It is up to you to write the code to initially apply an affect to a player. That can be done by using an item, digging a node, or executing a chat command.
|
||||||
|
|
||||||
|
This depends on the whoison mod for the whoison.getTimeOnline(name) function to know how long a player has been online, to advance the stages after the right amount of time.
|
||||||
|
|
||||||
|
|
61
mods/affects/affect_examples.lua
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
local antig = {
|
||||||
|
affectid="antig",
|
||||||
|
name="Anti Gravity",
|
||||||
|
stages={
|
||||||
|
{
|
||||||
|
time=60,
|
||||||
|
physics = { gravity = .3 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time=60,
|
||||||
|
physics = { gravity = .5 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time=60,
|
||||||
|
physics = { gravity = .9 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onremove = function(name, player, affectid)
|
||||||
|
minetest.chat_send_player(name,"You no longer have anti gravity!",false)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
affects.registerAffect(antig)
|
||||||
|
|
||||||
|
local combust = {
|
||||||
|
affectid="combust",
|
||||||
|
name="Spontaneous Combustion",
|
||||||
|
stages={
|
||||||
|
{
|
||||||
|
time=300,
|
||||||
|
emote = { chance=40, action = "thinks it's getting hot in here" },
|
||||||
|
place = { chance=70, node = "fire:basic_flame" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
affects.registerAffect(combust)
|
||||||
|
|
||||||
|
local fly = {
|
||||||
|
affectid = "fly",
|
||||||
|
name="Temporary Fly",
|
||||||
|
stages = {
|
||||||
|
{
|
||||||
|
time=45,
|
||||||
|
custom = { chance=100, func = function(name, player, affectid)
|
||||||
|
local pPrivs = minetest.get_player_privs(name)
|
||||||
|
pPrivs["fly"] = true
|
||||||
|
minetest.set_player_privs(name,pPrivs)
|
||||||
|
end, runonce=true }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onremove = function(name, player, affectid)
|
||||||
|
local pPrivs = minetest.get_player_privs(name)
|
||||||
|
pPrivs["fly"] = nil
|
||||||
|
minetest.set_player_privs(name,pPrivs)
|
||||||
|
minetest.chat_send_player(name,"You can no longer fly!",false)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
affects.registerAffect(fly)
|
53
mods/affects/api.lua
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
function affects.registerAffect( aDef )
|
||||||
|
-- Here we validate some values and add it to the affects._affects table
|
||||||
|
minetest.log("action","Registering affect: "..aDef.name)
|
||||||
|
|
||||||
|
if ( aDef.affectid == nil ) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( #aDef.stages < 1 ) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- TODO add more checks here to ensure the affect definition won't crash the server
|
||||||
|
|
||||||
|
affects._affects[aDef.affectid] = aDef
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function affects.removeAffect(name, affectid)
|
||||||
|
if ( affects._affectedPlayers[name] ~= nil ) then
|
||||||
|
if ( affectid == nil ) then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
affects._affectedPlayers[name][affectid] = nil;
|
||||||
|
if ( affects._affects[affectid].onremove ~= nil ) then
|
||||||
|
player = minetest.get_player_by_name(name)
|
||||||
|
player:set_physics_override({ speed=1, jump=1,gravity=1,sneak=true }) -- reset their physics
|
||||||
|
affects._affects[affectid].onremove(name,player,affectid)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function affects.affectPlayer(name, affectid)
|
||||||
|
if ( affects._affectedPlayers[name] == nil ) then
|
||||||
|
affects._affectedPlayers[name] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( affects._affectedPlayers[name][affectid] == nil ) then
|
||||||
|
if ( affects._affects[affectid] ~= nil ) then
|
||||||
|
whoison.updateStats(name)
|
||||||
|
local ns = ( whoison.getTimeOnline(name) + affects._affects[affectid].stages[1].time )
|
||||||
|
affects._affectedPlayers[name][affectid] = { stage = 1, nextStage = ns, ran=false }
|
||||||
|
applyAffect(name,affectid)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
28
mods/affects/chatcommands.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
minetest.register_chatcommand("affect",{
|
||||||
|
params = "<name> <affectid>",
|
||||||
|
description = "Applies an affect to a player",
|
||||||
|
privs = {affects=true},
|
||||||
|
func = function (name, param)
|
||||||
|
local aname, affectid = string.match(param, "([^ ]+) (.+)")
|
||||||
|
if ( affects.affectPlayer(aname,affectid) ) then
|
||||||
|
minetest.chat_send_player(name,aname.." has been affected by "..affects._affects[affectid].name)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,"Unable to affect "..aname.." with "..affectid)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("removeaffect",{
|
||||||
|
params = "<name> [affectid]",
|
||||||
|
description = "Removes and affect or all affects from a player",
|
||||||
|
privs = {affects=true},
|
||||||
|
func = function (name, param)
|
||||||
|
local aname, affectid = string.match(param, "([^ ]+) (.+)")
|
||||||
|
if ( affects.removeAffect(aname,affectid) ) then
|
||||||
|
minetest.chat_send_player(name,"Affect removed from "..aname)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,"Unable to remove affects")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
2
mods/affects/depends.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
whoison
|
||||||
|
|
61
mods/affects/functions.lua
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
function applyAffect(name,affectid)
|
||||||
|
minetest.log("action","Applying affect "..affectid.." on "..name)
|
||||||
|
whoison.updateStats(name)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
|
||||||
|
local oStage = affects._affectedPlayers[name][affectid].stage
|
||||||
|
-- see if they need advanced into the next stage
|
||||||
|
if ( affects._affectedPlayers[name][affectid].nextStage < whoison.getTimeOnline(name) ) then
|
||||||
|
local nextStageNum = affects._affectedPlayers[name][affectid].stage + 1
|
||||||
|
affects._affectedPlayers[name][affectid].stage = nextStageNum
|
||||||
|
affects._affectedPlayers[name][affectid].ran = false
|
||||||
|
minetest.log("action","Advancing "..affectid.." to the next stage for "..name)
|
||||||
|
if ( #affects._affects[affectid].stages < nextStageNum ) then
|
||||||
|
minetest.log("action","Affect "..affectid.." has worn off of "..name)
|
||||||
|
affects.removeAffect(name,affectid)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
affects._affectedPlayers[name][affectid].nextStage = (whoison.getTimeOnline(name) + affects._affects[affectid].stages[nextStageNum].time)
|
||||||
|
end
|
||||||
|
|
||||||
|
local iStage = affects._affectedPlayers[name][affectid].stage
|
||||||
|
local stage = affects._affects[affectid].stages[iStage]
|
||||||
|
local oPhysics = stage.physics
|
||||||
|
|
||||||
|
if ( oPhysics ~= nil ) then
|
||||||
|
player:set_physics_override(oPhysics)
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( stage.damage ~= nil ) then
|
||||||
|
if ( randomChance(stage.damage.chance) ) then
|
||||||
|
player:set_hp( player:get_hp() - stage.damage.amount )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( stage.emote ~= nil ) then
|
||||||
|
if ( randomChance(stage.emote.chance) ) then
|
||||||
|
minetest.chat_send_all(name.." "..stage.emote.action)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( stage.place ~= nil ) then
|
||||||
|
if ( randomChance(stage.place.chance) ) then
|
||||||
|
minetest.place_node(player:getpos(),{name=stage.place.node, param1=0, param2=0})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( stage.custom ~= nil ) then
|
||||||
|
if ( stage.custom.runonce == true and affects._affectedPlayers[name][affectid].ran == true ) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if ( randomChance(stage.custom.chance) ) then
|
||||||
|
affects._affectedPlayers[name][affectid].ran = true
|
||||||
|
stage.custom.func(name,player,affectid)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function randomChance (percent)
|
||||||
|
math.randomseed( os.time() )
|
||||||
|
return percent >= math.random(1, 100)
|
||||||
|
end
|
24
mods/affects/init.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
affects = {}
|
||||||
|
|
||||||
|
affects.affectTime = 30 -- how often, in seconds, should runAffects be called
|
||||||
|
|
||||||
|
affectsPath = minetest.get_modpath("affects")
|
||||||
|
affectsFile = minetest.get_worldpath().."/affects.txt"
|
||||||
|
|
||||||
|
affects._affects = {}
|
||||||
|
affects._affectedPlayers = {}
|
||||||
|
|
||||||
|
dofile(affectsPath.."/functions.lua")
|
||||||
|
dofile(affectsPath.."/api.lua")
|
||||||
|
dofile(affectsPath.."/loops.lua")
|
||||||
|
dofile(affectsPath.."/chatcommands.lua")
|
||||||
|
dofile(affectsPath.."/persistance.lua")
|
||||||
|
|
||||||
|
affects.loadAffects()
|
||||||
|
|
||||||
|
minetest.register_privilege("affects", "Player can use the affects chat commands.")
|
||||||
|
|
||||||
|
minetest.register_on_shutdown(function()
|
||||||
|
affects.saveAffects()
|
||||||
|
end
|
||||||
|
)
|
14
mods/affects/loops.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
local function runAffects()
|
||||||
|
for _,player in ipairs( minetest.get_connected_players() ) do
|
||||||
|
local name = player:get_player_name()
|
||||||
|
if ( affects._affectedPlayers[name] ) ~= nil then
|
||||||
|
for affectid,a in pairs(affects._affectedPlayers[name]) do
|
||||||
|
applyAffect(name,affectid)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
affects.saveAffects()
|
||||||
|
minetest.after(affects.affectTime, runAffects)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.after(affects.affectTime, runAffects)
|
19
mods/affects/persistance.lua
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
function affects.saveAffects()
|
||||||
|
minetest.log("action","Saving player affects")
|
||||||
|
local f = io.open(affectsFile,"w")
|
||||||
|
f:write(minetest.serialize(affects._affectedPlayers))
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
function affects.loadAffects()
|
||||||
|
minetest.log("action","Loading player affects")
|
||||||
|
local f = io.open(affectsFile,"r")
|
||||||
|
if ( f ~= nil ) then
|
||||||
|
local af = f:read("*all")
|
||||||
|
f:close()
|
||||||
|
if ( af ~= nil and af ~= "" ) then
|
||||||
|
affects._affectedPlayers = minetest.deserialize(af)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
30
mods/beds/README.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
Minetest Game mod: beds
|
||||||
|
=======================
|
||||||
|
by BlockMen (c) 2014-2015
|
||||||
|
|
||||||
|
Version: 1.1.1
|
||||||
|
|
||||||
|
About
|
||||||
|
~~~~~
|
||||||
|
This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing
|
||||||
|
in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other
|
||||||
|
players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced
|
||||||
|
if more than 50% of the players are lying in bed and use this option.
|
||||||
|
|
||||||
|
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
|
||||||
|
is set to the beds location and you will respawn there after death.
|
||||||
|
You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf
|
||||||
|
You can also disable the night skip feature by setting "enable_bed_night_skip = false" in minetest.conf or by using
|
||||||
|
the /set command ingame.
|
||||||
|
|
||||||
|
|
||||||
|
License of source code, textures: WTFPL
|
||||||
|
---------------------------------------
|
||||||
|
(c) Copyright BlockMen (2014-2015)
|
||||||
|
|
||||||
|
|
||||||
|
This program is free software. It comes without any warranty, to
|
||||||
|
the extent permitted by applicable law. You can redistribute it
|
||||||
|
and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
|
To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
|
http://sam.zoy.org/wtfpl/COPYING for more details.
|
158
mods/beds/api.lua
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
|
||||||
|
local reverse = true
|
||||||
|
|
||||||
|
local function destruct_bed(pos, n)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local other
|
||||||
|
|
||||||
|
if n == 2 then
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
other = vector.subtract(pos, dir)
|
||||||
|
elseif n == 1 then
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
other = vector.add(pos, dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
if reverse then
|
||||||
|
reverse = not reverse
|
||||||
|
minetest.remove_node(other)
|
||||||
|
nodeupdate(other)
|
||||||
|
else
|
||||||
|
reverse = not reverse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function beds.register_bed(name, def)
|
||||||
|
minetest.register_node(name .. "_bottom", {
|
||||||
|
description = def.description,
|
||||||
|
inventory_image = def.inventory_image,
|
||||||
|
wield_image = def.wield_image,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = def.tiles.bottom,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
is_ground_content = false,
|
||||||
|
stack_max = 1,
|
||||||
|
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = def.nodebox.bottom,
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = def.selectionbox,
|
||||||
|
},
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
local under = pointed_thing.under
|
||||||
|
local pos
|
||||||
|
if minetest.registered_items[minetest.get_node(under).name].buildable_to then
|
||||||
|
pos = under
|
||||||
|
else
|
||||||
|
pos = pointed_thing.above
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, placer:get_player_name()) and
|
||||||
|
not minetest.check_player_privs(placer, "protection_bypass") then
|
||||||
|
minetest.record_protection_violation(pos, placer:get_player_name())
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||||
|
if not node_def or not node_def.buildable_to then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local dir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
|
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
|
||||||
|
|
||||||
|
if minetest.is_protected(botpos, placer:get_player_name()) and
|
||||||
|
not minetest.check_player_privs(placer, "protection_bypass") then
|
||||||
|
minetest.record_protection_violation(botpos, placer:get_player_name())
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local botdef = minetest.registered_nodes[minetest.get_node(botpos).name]
|
||||||
|
if not botdef or not botdef.buildable_to then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
|
||||||
|
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
||||||
|
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_destruct = function(pos)
|
||||||
|
destruct_bed(pos, 1)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
|
beds.on_rightclick(pos, clicker)
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
local p = vector.add(pos, dir)
|
||||||
|
local node2 = minetest.get_node_or_nil(p)
|
||||||
|
if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or
|
||||||
|
not node.param2 == node2.param2 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if minetest.is_protected(p, user:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(p, user:get_player_name())
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if mode ~= screwdriver.ROTATE_FACE then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
|
||||||
|
local node3 = minetest.get_node_or_nil(newp)
|
||||||
|
local node_def = node3 and minetest.registered_nodes[node3.name]
|
||||||
|
if not node_def or not node_def.buildable_to then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if minetest.is_protected(newp, user:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(newp, user:get_player_name())
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
node.param2 = new_param2
|
||||||
|
-- do not remove_node here - it will trigger destroy_bed()
|
||||||
|
minetest.set_node(p, {name = "air"})
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
minetest.set_node(newp, {name = name .. "_top", param2 = new_param2})
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node(name .. "_top", {
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = def.tiles.top,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
is_ground_content = false,
|
||||||
|
pointable = false,
|
||||||
|
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
drop = name .. "_bottom",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = def.nodebox.top,
|
||||||
|
},
|
||||||
|
on_destruct = function(pos)
|
||||||
|
destruct_bed(pos, 2)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_alias(name, name .. "_bottom")
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = name,
|
||||||
|
recipe = def.recipe
|
||||||
|
})
|
||||||
|
end
|
90
mods/beds/beds.lua
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
-- Fancy shaped bed
|
||||||
|
|
||||||
|
beds.register_bed("beds:fancy_bed", {
|
||||||
|
description = "Fancy Bed",
|
||||||
|
inventory_image = "beds_bed_fancy.png",
|
||||||
|
wield_image = "beds_bed_fancy.png",
|
||||||
|
tiles = {
|
||||||
|
bottom = {
|
||||||
|
"beds_bed_top1.png",
|
||||||
|
"default_wood.png",
|
||||||
|
"beds_bed_side1.png",
|
||||||
|
"beds_bed_side1.png^[transformFX",
|
||||||
|
"default_wood.png",
|
||||||
|
"beds_bed_foot.png",
|
||||||
|
},
|
||||||
|
top = {
|
||||||
|
"beds_bed_top2.png",
|
||||||
|
"default_wood.png",
|
||||||
|
"beds_bed_side2.png",
|
||||||
|
"beds_bed_side2.png^[transformFX",
|
||||||
|
"beds_bed_head.png",
|
||||||
|
"default_wood.png",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nodebox = {
|
||||||
|
bottom = {
|
||||||
|
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
|
||||||
|
{0.375, -0.5, -0.5, 0.5, -0.065, -0.4375},
|
||||||
|
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375},
|
||||||
|
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
|
||||||
|
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
|
||||||
|
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5},
|
||||||
|
},
|
||||||
|
top = {
|
||||||
|
{-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5},
|
||||||
|
{0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5},
|
||||||
|
{-0.5, 0, 0.4375, 0.5, 0.125, 0.5},
|
||||||
|
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5},
|
||||||
|
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
|
||||||
|
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
|
||||||
|
{-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||||
|
recipe = {
|
||||||
|
{"", "", "group:stick"},
|
||||||
|
{"wool:red", "wool:red", "wool:white"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Simple shaped bed
|
||||||
|
|
||||||
|
beds.register_bed("beds:bed", {
|
||||||
|
description = "Simple Bed",
|
||||||
|
inventory_image = "beds_bed.png",
|
||||||
|
wield_image = "beds_bed.png",
|
||||||
|
tiles = {
|
||||||
|
bottom = {
|
||||||
|
"beds_bed_top_bottom.png^[transformR90",
|
||||||
|
"default_wood.png",
|
||||||
|
"beds_bed_side_bottom_r.png",
|
||||||
|
"beds_bed_side_bottom_r.png^[transformfx",
|
||||||
|
"beds_transparent.png",
|
||||||
|
"beds_bed_side_bottom.png"
|
||||||
|
},
|
||||||
|
top = {
|
||||||
|
"beds_bed_top_top.png^[transformR90",
|
||||||
|
"default_wood.png",
|
||||||
|
"beds_bed_side_top_r.png",
|
||||||
|
"beds_bed_side_top_r.png^[transformfx",
|
||||||
|
"beds_bed_side_top.png",
|
||||||
|
"beds_transparent.png",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nodebox = {
|
||||||
|
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||||
|
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||||
|
},
|
||||||
|
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||||
|
recipe = {
|
||||||
|
{"wool:red", "wool:red", "wool:white"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Aliases for PilzAdam's beds mod
|
||||||
|
|
||||||
|
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
|
||||||
|
minetest.register_alias("beds:bed_top_red", "beds:bed_top")
|
2
mods/beds/depends.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
wool
|
220
mods/beds/functions.lua
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
local pi = math.pi
|
||||||
|
local player_in_bed = 0
|
||||||
|
local is_sp = minetest.is_singleplayer()
|
||||||
|
local enable_respawn = minetest.setting_getbool("enable_bed_respawn")
|
||||||
|
if enable_respawn == nil then
|
||||||
|
enable_respawn = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Helper functions
|
||||||
|
|
||||||
|
local function get_look_yaw(pos)
|
||||||
|
local n = minetest.get_node(pos)
|
||||||
|
if n.param2 == 1 then
|
||||||
|
return pi / 2, n.param2
|
||||||
|
elseif n.param2 == 3 then
|
||||||
|
return -pi / 2, n.param2
|
||||||
|
elseif n.param2 == 0 then
|
||||||
|
return pi, n.param2
|
||||||
|
else
|
||||||
|
return 0, n.param2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_night_skip_enabled()
|
||||||
|
local enable_night_skip = minetest.setting_getbool("enable_bed_night_skip")
|
||||||
|
if enable_night_skip == nil then
|
||||||
|
enable_night_skip = true
|
||||||
|
end
|
||||||
|
return enable_night_skip
|
||||||
|
end
|
||||||
|
|
||||||
|
local function check_in_beds(players)
|
||||||
|
local in_bed = beds.player
|
||||||
|
if not players then
|
||||||
|
players = minetest.get_connected_players()
|
||||||
|
end
|
||||||
|
|
||||||
|
for n, player in ipairs(players) do
|
||||||
|
local name = player:get_player_name()
|
||||||
|
if not in_bed[name] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return #players > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local hud_flags = player:hud_get_flags()
|
||||||
|
|
||||||
|
if not player or not name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- stand up
|
||||||
|
if state ~= nil and not state then
|
||||||
|
local p = beds.pos[name] or nil
|
||||||
|
if beds.player[name] ~= nil then
|
||||||
|
beds.player[name] = nil
|
||||||
|
player_in_bed = player_in_bed - 1
|
||||||
|
end
|
||||||
|
-- skip here to prevent sending player specific changes (used for leaving players)
|
||||||
|
if skip then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if p then
|
||||||
|
player:setpos(p)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- physics, eye_offset, etc
|
||||||
|
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||||
|
player:set_look_horizontal(math.random(1, 180) / 100)
|
||||||
|
default.player_attached[name] = false
|
||||||
|
player:set_physics_override(1, 1, 1)
|
||||||
|
hud_flags.wielditem = true
|
||||||
|
default.player_set_animation(player, "stand" , 30)
|
||||||
|
|
||||||
|
-- lay down
|
||||||
|
else
|
||||||
|
beds.player[name] = 1
|
||||||
|
beds.pos[name] = pos
|
||||||
|
player_in_bed = player_in_bed + 1
|
||||||
|
|
||||||
|
-- physics, eye_offset, etc
|
||||||
|
player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0})
|
||||||
|
local yaw, param2 = get_look_yaw(bed_pos)
|
||||||
|
player:set_look_horizontal(yaw)
|
||||||
|
local dir = minetest.facedir_to_dir(param2)
|
||||||
|
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
|
||||||
|
player:set_physics_override(0, 0, 0)
|
||||||
|
player:setpos(p)
|
||||||
|
default.player_attached[name] = true
|
||||||
|
hud_flags.wielditem = false
|
||||||
|
default.player_set_animation(player, "lay" , 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
player:hud_set_flags(hud_flags)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_formspecs(finished)
|
||||||
|
local ges = #minetest.get_connected_players()
|
||||||
|
local form_n
|
||||||
|
local is_majority = (ges / 2) < player_in_bed
|
||||||
|
|
||||||
|
if finished then
|
||||||
|
form_n = beds.formspec .. "label[2.7,11; Good morning.]"
|
||||||
|
else
|
||||||
|
form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) ..
|
||||||
|
" of " .. tostring(ges) .. " players are in bed]"
|
||||||
|
if is_majority and is_night_skip_enabled() then
|
||||||
|
form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for name,_ in pairs(beds.player) do
|
||||||
|
minetest.show_formspec(name, "beds_form", form_n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Public functions
|
||||||
|
|
||||||
|
function beds.kick_players()
|
||||||
|
for name, _ in pairs(beds.player) do
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
lay_down(player, nil, nil, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function beds.skip_night()
|
||||||
|
minetest.set_timeofday(0.23)
|
||||||
|
end
|
||||||
|
|
||||||
|
function beds.on_rightclick(pos, player)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local ppos = player:getpos()
|
||||||
|
local tod = minetest.get_timeofday()
|
||||||
|
|
||||||
|
if tod > 0.2 and tod < 0.805 then
|
||||||
|
if beds.player[name] then
|
||||||
|
lay_down(player, nil, nil, false)
|
||||||
|
end
|
||||||
|
minetest.chat_send_player(name, "You can only sleep at night.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- move to bed
|
||||||
|
if not beds.player[name] then
|
||||||
|
lay_down(player, ppos, pos)
|
||||||
|
beds.set_spawns() -- save respawn positions when entering bed
|
||||||
|
else
|
||||||
|
lay_down(player, nil, nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not is_sp then
|
||||||
|
update_formspecs(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- skip the night and let all players stand up
|
||||||
|
if check_in_beds() then
|
||||||
|
minetest.after(2, function()
|
||||||
|
if not is_sp then
|
||||||
|
update_formspecs(is_night_skip_enabled())
|
||||||
|
end
|
||||||
|
if is_night_skip_enabled() then
|
||||||
|
beds.skip_night()
|
||||||
|
beds.kick_players()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Callbacks
|
||||||
|
-- Only register respawn callback if respawn enabled
|
||||||
|
if enable_respawn then
|
||||||
|
-- respawn player at bed if enabled and valid position is found
|
||||||
|
minetest.register_on_respawnplayer(function(player)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local pos = beds.spawn[name]
|
||||||
|
if pos then
|
||||||
|
player:setpos(pos)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
lay_down(player, nil, nil, false, true)
|
||||||
|
beds.player[name] = nil
|
||||||
|
if check_in_beds() then
|
||||||
|
minetest.after(2, function()
|
||||||
|
update_formspecs(is_night_skip_enabled())
|
||||||
|
if is_night_skip_enabled() then
|
||||||
|
beds.skip_night()
|
||||||
|
beds.kick_players()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname ~= "beds_form" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if fields.quit or fields.leave then
|
||||||
|
lay_down(player, nil, nil, false)
|
||||||
|
update_formspecs(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
if fields.force then
|
||||||
|
update_formspecs(is_night_skip_enabled())
|
||||||
|
if is_night_skip_enabled() then
|
||||||
|
beds.skip_night()
|
||||||
|
beds.kick_players()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
17
mods/beds/init.lua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
beds = {}
|
||||||
|
beds.player = {}
|
||||||
|
beds.pos = {}
|
||||||
|
beds.spawn = {}
|
||||||
|
|
||||||
|
beds.formspec = "size[8,15;true]" ..
|
||||||
|
"bgcolor[#080808BB; true]" ..
|
||||||
|
"button_exit[2,12;4,0.75;leave;Leave Bed]"
|
||||||
|
|
||||||
|
local modpath = minetest.get_modpath("beds")
|
||||||
|
|
||||||
|
-- Load files
|
||||||
|
|
||||||
|
dofile(modpath .. "/functions.lua")
|
||||||
|
dofile(modpath .. "/api.lua")
|
||||||
|
dofile(modpath .. "/beds.lua")
|
||||||
|
dofile(modpath .. "/spawns.lua")
|
63
mods/beds/spawns.lua
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
local world_path = minetest.get_worldpath()
|
||||||
|
local org_file = world_path .. "/beds_spawns"
|
||||||
|
local file = world_path .. "/beds_spawns"
|
||||||
|
local bkwd = false
|
||||||
|
|
||||||
|
-- check for PA's beds mod spawns
|
||||||
|
local cf = io.open(world_path .. "/beds_player_spawns", "r")
|
||||||
|
if cf ~= nil then
|
||||||
|
io.close(cf)
|
||||||
|
file = world_path .. "/beds_player_spawns"
|
||||||
|
bkwd = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function beds.read_spawns()
|
||||||
|
local spawns = beds.spawn
|
||||||
|
local input = io.open(file, "r")
|
||||||
|
if input and not bkwd then
|
||||||
|
repeat
|
||||||
|
local x = input:read("*n")
|
||||||
|
if x == nil then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
local y = input:read("*n")
|
||||||
|
local z = input:read("*n")
|
||||||
|
local name = input:read("*l")
|
||||||
|
spawns[name:sub(2)] = {x = x, y = y, z = z}
|
||||||
|
until input:read(0) == nil
|
||||||
|
io.close(input)
|
||||||
|
elseif input and bkwd then
|
||||||
|
beds.spawn = minetest.deserialize(input:read("*all"))
|
||||||
|
input:close()
|
||||||
|
beds.save_spawns()
|
||||||
|
os.rename(file, file .. ".backup")
|
||||||
|
file = org_file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
beds.read_spawns()
|
||||||
|
|
||||||
|
function beds.save_spawns()
|
||||||
|
if not beds.spawn then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local data = {}
|
||||||
|
local output = io.open(org_file, "w")
|
||||||
|
for k, v in pairs(beds.spawn) do
|
||||||
|
table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, k))
|
||||||
|
end
|
||||||
|
output:write(table.concat(data))
|
||||||
|
io.close(output)
|
||||||
|
end
|
||||||
|
|
||||||
|
function beds.set_spawns()
|
||||||
|
for name,_ in pairs(beds.player) do
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
local p = player:getpos()
|
||||||
|
-- but don't change spawn location if borrowing a bed
|
||||||
|
if not minetest.is_protected(p, name) then
|
||||||
|
beds.spawn[name] = p
|
||||||
|
end
|
||||||
|
end
|
||||||
|
beds.save_spawns()
|
||||||
|
end
|
BIN
mods/beds/textures/beds_bed.png
Normal file
After Width: | Height: | Size: 540 B |
BIN
mods/beds/textures/beds_bed_fancy.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
mods/beds/textures/beds_bed_foot.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
mods/beds/textures/beds_bed_head.png
Normal file
After Width: | Height: | Size: 387 B |
BIN
mods/beds/textures/beds_bed_side1.png
Normal file
After Width: | Height: | Size: 296 B |
BIN
mods/beds/textures/beds_bed_side2.png
Normal file
After Width: | Height: | Size: 316 B |
BIN
mods/beds/textures/beds_bed_side_bottom.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
mods/beds/textures/beds_bed_side_bottom_r.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
mods/beds/textures/beds_bed_side_top.png
Normal file
After Width: | Height: | Size: 611 B |
BIN
mods/beds/textures/beds_bed_side_top_r.png
Normal file
After Width: | Height: | Size: 596 B |
BIN
mods/beds/textures/beds_bed_top1.png
Normal file
After Width: | Height: | Size: 583 B |
BIN
mods/beds/textures/beds_bed_top2.png
Normal file
After Width: | Height: | Size: 616 B |
BIN
mods/beds/textures/beds_bed_top_bottom.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
mods/beds/textures/beds_bed_top_top.png
Normal file
After Width: | Height: | Size: 556 B |
BIN
mods/beds/textures/beds_transparent.png
Normal file
After Width: | Height: | Size: 143 B |
16
mods/boats/README.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Minetest Game mod: boats
|
||||||
|
========================
|
||||||
|
by PilzAdam
|
||||||
|
|
||||||
|
License of source code:
|
||||||
|
-----------------------
|
||||||
|
WTFPL
|
||||||
|
|
||||||
|
License of media (textures and sounds):
|
||||||
|
---------------------------------------
|
||||||
|
WTFPL
|
||||||
|
|
||||||
|
Authors of media files:
|
||||||
|
-----------------------
|
||||||
|
textures: Zeg9
|
||||||
|
model: thetoon and Zeg9, modified by PavelS(SokolovPavel)
|
1
mods/boats/depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
default
|
249
mods/boats/init.lua
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
--
|
||||||
|
-- Helper functions
|
||||||
|
--
|
||||||
|
|
||||||
|
local function is_water(pos)
|
||||||
|
local nn = minetest.get_node(pos).name
|
||||||
|
return minetest.get_item_group(nn, "water") ~= 0
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function get_sign(i)
|
||||||
|
if i == 0 then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return i / math.abs(i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function get_velocity(v, yaw, y)
|
||||||
|
local x = -math.sin(yaw) * v
|
||||||
|
local z = math.cos(yaw) * v
|
||||||
|
return {x = x, y = y, z = z}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function get_v(v)
|
||||||
|
return math.sqrt(v.x ^ 2 + v.z ^ 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Boat entity
|
||||||
|
--
|
||||||
|
|
||||||
|
local boat = {
|
||||||
|
physical = true,
|
||||||
|
-- Warning: Do not change the position of the collisionbox top surface,
|
||||||
|
-- lowering it causes the boat to fall through the world if underwater
|
||||||
|
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "boats_boat.obj",
|
||||||
|
textures = {"default_wood.png"},
|
||||||
|
|
||||||
|
driver = nil,
|
||||||
|
v = 0,
|
||||||
|
last_v = 0,
|
||||||
|
removed = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function boat.on_rightclick(self, clicker)
|
||||||
|
if not clicker or not clicker:is_player() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local name = clicker:get_player_name()
|
||||||
|
if self.driver and clicker == self.driver then
|
||||||
|
self.driver = nil
|
||||||
|
clicker:set_detach()
|
||||||
|
default.player_attached[name] = false
|
||||||
|
default.player_set_animation(clicker, "stand" , 30)
|
||||||
|
local pos = clicker:getpos()
|
||||||
|
pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
|
||||||
|
minetest.after(0.1, function()
|
||||||
|
clicker:setpos(pos)
|
||||||
|
end)
|
||||||
|
elseif not self.driver then
|
||||||
|
local attach = clicker:get_attach()
|
||||||
|
if attach and attach:get_luaentity() then
|
||||||
|
local luaentity = attach:get_luaentity()
|
||||||
|
if luaentity.driver then
|
||||||
|
luaentity.driver = nil
|
||||||
|
end
|
||||||
|
clicker:set_detach()
|
||||||
|
end
|
||||||
|
self.driver = clicker
|
||||||
|
clicker:set_attach(self.object, "",
|
||||||
|
{x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
|
||||||
|
default.player_attached[name] = true
|
||||||
|
minetest.after(0.2, function()
|
||||||
|
default.player_set_animation(clicker, "sit" , 30)
|
||||||
|
end)
|
||||||
|
self.object:setyaw(clicker:get_look_horizontal() - math.pi / 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function boat.on_activate(self, staticdata, dtime_s)
|
||||||
|
self.object:set_armor_groups({immortal = 1})
|
||||||
|
if staticdata then
|
||||||
|
self.v = tonumber(staticdata)
|
||||||
|
end
|
||||||
|
self.last_v = self.v
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function boat.get_staticdata(self)
|
||||||
|
return tostring(self.v)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function boat.on_punch(self, puncher)
|
||||||
|
if not puncher or not puncher:is_player() or self.removed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if self.driver and puncher == self.driver then
|
||||||
|
self.driver = nil
|
||||||
|
puncher:set_detach()
|
||||||
|
default.player_attached[puncher:get_player_name()] = false
|
||||||
|
end
|
||||||
|
if not self.driver then
|
||||||
|
self.removed = true
|
||||||
|
-- delay remove to ensure player is detached
|
||||||
|
minetest.after(0.1, function()
|
||||||
|
self.object:remove()
|
||||||
|
end)
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
if inv:room_for_item("main", "boats:boat") then
|
||||||
|
inv:add_item("main", "boats:boat")
|
||||||
|
else
|
||||||
|
minetest.add_item(self.object:getpos(), "boats:boat")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function boat.on_step(self, dtime)
|
||||||
|
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
|
||||||
|
if self.driver then
|
||||||
|
local ctrl = self.driver:get_player_control()
|
||||||
|
local yaw = self.object:getyaw()
|
||||||
|
if ctrl.up then
|
||||||
|
self.v = self.v + 0.1
|
||||||
|
elseif ctrl.down then
|
||||||
|
self.v = self.v - 0.1
|
||||||
|
end
|
||||||
|
if ctrl.left then
|
||||||
|
if self.v < 0 then
|
||||||
|
self.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||||
|
else
|
||||||
|
self.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||||
|
end
|
||||||
|
elseif ctrl.right then
|
||||||
|
if self.v < 0 then
|
||||||
|
self.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||||
|
else
|
||||||
|
self.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local velo = self.object:getvelocity()
|
||||||
|
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||||
|
self.object:setpos(self.object:getpos())
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local s = get_sign(self.v)
|
||||||
|
self.v = self.v - 0.02 * s
|
||||||
|
if s ~= get_sign(self.v) then
|
||||||
|
self.object:setvelocity({x = 0, y = 0, z = 0})
|
||||||
|
self.v = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if math.abs(self.v) > 5 then
|
||||||
|
self.v = 5 * get_sign(self.v)
|
||||||
|
end
|
||||||
|
|
||||||
|
local p = self.object:getpos()
|
||||||
|
p.y = p.y - 0.5
|
||||||
|
local new_velo
|
||||||
|
local new_acce = {x = 0, y = 0, z = 0}
|
||||||
|
if not is_water(p) then
|
||||||
|
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
|
||||||
|
if (not nodedef) or nodedef.walkable then
|
||||||
|
self.v = 0
|
||||||
|
new_acce = {x = 0, y = 1, z = 0}
|
||||||
|
else
|
||||||
|
new_acce = {x = 0, y = -9.8, z = 0}
|
||||||
|
end
|
||||||
|
new_velo = get_velocity(self.v, self.object:getyaw(),
|
||||||
|
self.object:getvelocity().y)
|
||||||
|
self.object:setpos(self.object:getpos())
|
||||||
|
else
|
||||||
|
p.y = p.y + 1
|
||||||
|
if is_water(p) then
|
||||||
|
local y = self.object:getvelocity().y
|
||||||
|
if y >= 5 then
|
||||||
|
y = 5
|
||||||
|
elseif y < 0 then
|
||||||
|
new_acce = {x = 0, y = 20, z = 0}
|
||||||
|
else
|
||||||
|
new_acce = {x = 0, y = 5, z = 0}
|
||||||
|
end
|
||||||
|
new_velo = get_velocity(self.v, self.object:getyaw(), y)
|
||||||
|
self.object:setpos(self.object:getpos())
|
||||||
|
else
|
||||||
|
new_acce = {x = 0, y = 0, z = 0}
|
||||||
|
if math.abs(self.object:getvelocity().y) < 1 then
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
pos.y = math.floor(pos.y) + 0.5
|
||||||
|
self.object:setpos(pos)
|
||||||
|
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
|
||||||
|
else
|
||||||
|
new_velo = get_velocity(self.v, self.object:getyaw(),
|
||||||
|
self.object:getvelocity().y)
|
||||||
|
self.object:setpos(self.object:getpos())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.object:setvelocity(new_velo)
|
||||||
|
self.object:setacceleration(new_acce)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_entity("boats:boat", boat)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("boats:boat", {
|
||||||
|
description = "Boat",
|
||||||
|
inventory_image = "boats_inventory.png",
|
||||||
|
wield_image = "boats_wield.png",
|
||||||
|
wield_scale = {x = 2, y = 2, z = 1},
|
||||||
|
liquids_pointable = true,
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
if not is_water(pointed_thing.under) then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
||||||
|
minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "boats:boat",
|
||||||
|
recipe = {
|
||||||
|
{"", "", "" },
|
||||||
|
{"group:wood", "", "group:wood"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
},
|
||||||
|
})
|
11110
mods/boats/models/boat.x
Normal file
358
mods/boats/models/boats_boat.obj
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
# Blender v2.76 (sub 11) OBJ File: 'boat.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib boat.mtl
|
||||||
|
o boats_boat
|
||||||
|
v -6.786140 -3.033999 -9.415440
|
||||||
|
v -6.786140 -1.967150 -9.415440
|
||||||
|
v -6.786140 -1.967150 8.793510
|
||||||
|
v -6.786140 -3.033999 8.793510
|
||||||
|
v 5.732520 -1.967150 -9.415440
|
||||||
|
v 5.732520 -3.033999 -9.415440
|
||||||
|
v 5.732520 -3.033999 8.793510
|
||||||
|
v 5.732520 -1.967150 8.793510
|
||||||
|
v -2.233900 -3.033999 -9.415440
|
||||||
|
v -2.233900 -1.967150 -9.415440
|
||||||
|
v -2.233900 -1.967150 8.793510
|
||||||
|
v -2.233900 -3.033999 8.793510
|
||||||
|
v 2.318340 -3.033999 -9.415440
|
||||||
|
v 2.318340 -1.967150 -9.415440
|
||||||
|
v 2.318340 -1.967150 8.793510
|
||||||
|
v 2.318340 -3.033999 8.793510
|
||||||
|
v -3.371960 -3.033999 8.793510
|
||||||
|
v -3.371960 -1.967150 8.793510
|
||||||
|
v -3.371960 -1.967150 -9.415440
|
||||||
|
v -3.371960 -3.033999 -9.415440
|
||||||
|
v 2.318340 0.276645 8.793510
|
||||||
|
v 1.180280 -1.967150 8.793510
|
||||||
|
v 5.732520 0.276645 8.793510
|
||||||
|
v 5.732520 1.039180 8.793510
|
||||||
|
v 6.870580 0.276645 8.793510
|
||||||
|
v 6.870580 -1.967150 8.793510
|
||||||
|
v 2.318340 1.039180 8.793510
|
||||||
|
v 1.180280 0.276645 8.793510
|
||||||
|
v 1.180280 1.039180 8.793510
|
||||||
|
v 1.180280 -3.033999 8.793510
|
||||||
|
v -2.233900 0.276645 8.793510
|
||||||
|
v -3.371960 0.276645 8.793510
|
||||||
|
v -2.233900 1.039180 8.793510
|
||||||
|
v -3.371960 1.039180 8.793510
|
||||||
|
v -6.786140 0.276645 8.793510
|
||||||
|
v -7.786200 0.276645 8.793510
|
||||||
|
v -7.786200 -1.967150 8.793510
|
||||||
|
v -6.786140 1.039180 8.793510
|
||||||
|
v 1.180280 -1.967150 -9.415440
|
||||||
|
v 1.180280 -3.033999 -9.415440
|
||||||
|
v 2.318340 0.276645 -9.415440
|
||||||
|
v 1.180280 0.276645 -9.415440
|
||||||
|
v 2.318340 1.039180 -9.415440
|
||||||
|
v 5.732520 0.276645 -9.415440
|
||||||
|
v 6.870580 -1.967150 -9.415440
|
||||||
|
v 5.732520 1.039180 -9.415440
|
||||||
|
v 6.870580 0.276645 -9.415440
|
||||||
|
v 0.042220 1.039180 -9.415440
|
||||||
|
v 1.180280 1.039180 -9.415440
|
||||||
|
v 0.042220 -1.967150 -9.415440
|
||||||
|
v -1.095840 -1.967150 -9.415440
|
||||||
|
v -2.233900 0.276645 -9.415440
|
||||||
|
v -3.371960 0.276645 -9.415440
|
||||||
|
v -2.233900 1.039180 -9.415440
|
||||||
|
v -1.095840 1.039180 -9.415440
|
||||||
|
v -3.371960 1.039180 -9.415440
|
||||||
|
v -6.786140 0.276645 -9.415440
|
||||||
|
v -6.786140 1.039180 -9.415440
|
||||||
|
v -7.786200 -1.967150 -9.415440
|
||||||
|
v -7.786200 0.276645 -9.415440
|
||||||
|
v -1.095840 0.156645 -12.044100
|
||||||
|
v -1.095840 -4.601110 -9.415440
|
||||||
|
v -1.095840 1.039181 -10.802900
|
||||||
|
v -1.095840 2.868579 -10.802900
|
||||||
|
v -1.095840 2.868580 -7.883420
|
||||||
|
v -1.095840 3.746069 -12.034100
|
||||||
|
v -1.095840 3.746070 -7.883420
|
||||||
|
v -1.095840 0.156645 -14.294900
|
||||||
|
v -1.095840 -4.601110 -14.284900
|
||||||
|
v 0.042220 -4.601110 -14.284900
|
||||||
|
v 0.042220 -4.601110 -9.415440
|
||||||
|
v 0.042220 1.039181 -10.802900
|
||||||
|
v 0.042220 0.156645 -12.044100
|
||||||
|
v 0.042220 2.868579 -10.802900
|
||||||
|
v 0.042220 0.156645 -14.294900
|
||||||
|
v 0.042220 3.746069 -12.034100
|
||||||
|
v 0.042220 3.746070 -7.883420
|
||||||
|
v 0.042220 2.868580 -7.883420
|
||||||
|
v -1.096322 -3.033999 -9.415440
|
||||||
|
v 0.044046 -3.035397 -9.415440
|
||||||
|
vt 1.000000 0.187500
|
||||||
|
vt -1.000000 0.312500
|
||||||
|
vt 1.000000 0.312500
|
||||||
|
vt 0.687500 1.000000
|
||||||
|
vt 0.500000 0.875000
|
||||||
|
vt 0.500000 0.625000
|
||||||
|
vt -1.000000 0.062500
|
||||||
|
vt 1.000000 0.062500
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt -1.000000 0.125000
|
||||||
|
vt 1.000000 0.125000
|
||||||
|
vt 0.437500 0.125000
|
||||||
|
vt 0.312500 0.500000
|
||||||
|
vt 0.312500 0.125000
|
||||||
|
vt 1.000000 0.625000
|
||||||
|
vt -1.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 0.187500 0.687500
|
||||||
|
vt -0.187500 0.687500
|
||||||
|
vt -0.187500 0.312500
|
||||||
|
vt 1.000000 0.812500
|
||||||
|
vt -1.000000 0.937500
|
||||||
|
vt -1.000000 0.812500
|
||||||
|
vt 0.812500 0.687500
|
||||||
|
vt 1.187500 0.687500
|
||||||
|
vt 0.812500 0.312500
|
||||||
|
vt 1.000000 0.562500
|
||||||
|
vt 0.312500 0.437500
|
||||||
|
vt 1.000000 0.437500
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt -1.000000 0.875000
|
||||||
|
vt -1.000000 0.750000
|
||||||
|
vt -1.000000 1.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.437500 0.625000
|
||||||
|
vt 0.562500 0.437500
|
||||||
|
vt 0.562500 0.625000
|
||||||
|
vt -1.000000 0.437500
|
||||||
|
vt -1.000000 0.000000
|
||||||
|
vt 0.500000 0.062500
|
||||||
|
vt 0.375000 0.750000
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt -1.000000 0.250000
|
||||||
|
vt -1.000000 0.687500
|
||||||
|
vt 1.000000 0.687500
|
||||||
|
vt 0.625000 0.375000
|
||||||
|
vt 1.000000 0.375000
|
||||||
|
vt 1.000000 0.250000
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 0.437500 0.812500
|
||||||
|
vt 0.312500 0.312500
|
||||||
|
vt 0.312500 0.812500
|
||||||
|
vt 0.437500 0.312500
|
||||||
|
vt 0.437500 0.437500
|
||||||
|
vt 0.687500 0.812500
|
||||||
|
vt 0.000000 0.687500
|
||||||
|
vt 0.000000 0.812500
|
||||||
|
vt -1.000000 0.562500
|
||||||
|
vt 0.875000 0.812500
|
||||||
|
vt 0.875000 0.687500
|
||||||
|
vt 0.250000 0.312500
|
||||||
|
vt 0.562500 0.187500
|
||||||
|
vt 0.250000 0.187500
|
||||||
|
vt -1.000000 0.187500
|
||||||
|
vt 0.312500 0.625000
|
||||||
|
vt 0.312500 0.187500
|
||||||
|
vt 0.312500 -0.187500
|
||||||
|
vt 1.000000 -0.187500
|
||||||
|
vt 0.687500 0.500000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt 0.000000 0.875000
|
||||||
|
vt 0.437500 0.500000
|
||||||
|
vt -1.000000 0.625000
|
||||||
|
vt 0.812500 0.187500
|
||||||
|
vt 1.187500 0.187500
|
||||||
|
vt 1.187500 0.312500
|
||||||
|
vt 1.312500 0.312500
|
||||||
|
vt 1.312500 0.687500
|
||||||
|
vt 0.687500 0.187500
|
||||||
|
vt 0.687500 0.312500
|
||||||
|
vt 1.187500 0.812500
|
||||||
|
vt 0.812500 0.812500
|
||||||
|
vt 0.187500 0.312500
|
||||||
|
vt 0.312500 0.687500
|
||||||
|
vt 0.687500 0.687500
|
||||||
|
vt -0.187500 0.187500
|
||||||
|
vt 0.187500 0.187500
|
||||||
|
vt -0.312500 0.687500
|
||||||
|
vt -0.312500 0.312500
|
||||||
|
vt 0.187500 0.812500
|
||||||
|
vt -0.187500 0.812500
|
||||||
|
vt 0.437500 0.687500
|
||||||
|
vt 0.437500 0.187500
|
||||||
|
vt 0.562500 0.812500
|
||||||
|
vt 0.562500 0.687500
|
||||||
|
vt 0.312500 0.562500
|
||||||
|
vt 1.000000 0.875000
|
||||||
|
vt 0.375000 0.062500
|
||||||
|
vt -1.000000 0.375000
|
||||||
|
vt 0.625000 0.500000
|
||||||
|
vt 0.875000 0.562500
|
||||||
|
vt 0.937500 0.812500
|
||||||
|
vt 0.937500 0.687500
|
||||||
|
vt 0.875000 0.937500
|
||||||
|
vt 0.562500 0.312500
|
||||||
|
vn -1.000000 0.000000 0.000000
|
||||||
|
vn 1.000000 0.000000 0.000000
|
||||||
|
vn 0.000000 0.000000 1.000000
|
||||||
|
vn 0.000000 0.000000 -1.000000
|
||||||
|
vn 0.000000 -1.000000 0.000000
|
||||||
|
vn 0.000000 1.000000 0.000000
|
||||||
|
vn 0.000000 -0.002100 -1.000000
|
||||||
|
vn 0.001200 -1.000000 0.000000
|
||||||
|
vn 0.000000 0.002800 -1.000000
|
||||||
|
vn -0.001200 -1.000000 0.000200
|
||||||
|
g boats_boat_boats_boat_None
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 41/1/1 27/2/1 43/3/1
|
||||||
|
f 76/4/2 74/5/2 72/6/2
|
||||||
|
f 8/7/2 6/1/2 5/8/2
|
||||||
|
f 15/9/1 13/10/1 16/11/1
|
||||||
|
f 51/12/3 71/13/3 50/14/3
|
||||||
|
f 56/15/2 32/16/2 53/17/2
|
||||||
|
f 15/18/3 8/19/3 23/20/3
|
||||||
|
f 22/21/2 40/22/2 39/23/2
|
||||||
|
f 19/24/4 2/25/4 53/26/4
|
||||||
|
f 70/27/5 62/28/5 69/29/5
|
||||||
|
f 11/30/5 19/31/5 10/32/5
|
||||||
|
f 4/15/5 20/33/5 17/34/5
|
||||||
|
f 72/35/3 64/36/3 63/37/3
|
||||||
|
f 13/8/5 7/38/5 16/7/5
|
||||||
|
f 23/39/6 47/11/6 44/9/6
|
||||||
|
f 68/40/7 70/41/7 69/42/7
|
||||||
|
f 80/43/8 40/10/8 30/11/8
|
||||||
|
f 3/15/1 1/32/1 4/30/1
|
||||||
|
f 20/44/2 18/27/2 17/45/2
|
||||||
|
f 74/17/5 65/46/5 64/47/5
|
||||||
|
f 31/43/1 54/47/1 52/48/1
|
||||||
|
f 22/47/5 14/43/5 15/48/5
|
||||||
|
f 46/1/2 23/7/2 44/8/2
|
||||||
|
f 57/21/1 38/22/1 58/49/1
|
||||||
|
f 61/50/9 76/51/9 73/52/9
|
||||||
|
f 37/45/5 2/23/5 3/21/5
|
||||||
|
f 78/28/3 67/53/3 65/54/3
|
||||||
|
f 64/5/1 66/4/1 63/6/1
|
||||||
|
f 76/55/6 67/56/6 77/57/6
|
||||||
|
f 47/17/2 26/10/2 45/11/2
|
||||||
|
f 5/16/5 26/47/5 8/17/5
|
||||||
|
f 33/58/6 48/59/6 55/60/6
|
||||||
|
f 29/38/2 42/3/2 49/29/2
|
||||||
|
f 32/44/6 52/21/6 53/45/6
|
||||||
|
f 58/15/6 34/33/6 56/34/6
|
||||||
|
f 27/7/6 46/29/6 43/8/6
|
||||||
|
f 73/61/6 68/62/6 61/63/6
|
||||||
|
f 21/58/6 42/29/6 28/38/6
|
||||||
|
f 11/29/1 9/58/1 12/27/1
|
||||||
|
f 59/45/1 36/2/1 60/3/1
|
||||||
|
f 60/9/6 35/10/6 57/11/6
|
||||||
|
f 41/1/1 21/64/1 27/2/1
|
||||||
|
f 72/6/2 48/65/2 50/66/2
|
||||||
|
f 50/66/2 71/67/2 70/68/2
|
||||||
|
f 70/68/2 75/17/2 73/69/2
|
||||||
|
f 76/4/2 77/70/2 74/5/2
|
||||||
|
f 77/70/2 78/71/2 74/5/2
|
||||||
|
f 50/66/2 70/68/2 73/69/2
|
||||||
|
f 73/69/2 76/4/2 72/6/2
|
||||||
|
f 72/6/2 50/66/2 73/69/2
|
||||||
|
f 8/7/2 7/64/2 6/1/2
|
||||||
|
f 15/9/1 14/39/1 13/10/1
|
||||||
|
f 51/12/3 62/72/3 71/13/3
|
||||||
|
f 56/15/2 34/73/2 32/16/2
|
||||||
|
f 32/26/3 34/74/3 38/75/3
|
||||||
|
f 35/76/3 36/77/3 37/78/3
|
||||||
|
f 32/26/3 38/75/3 35/76/3
|
||||||
|
f 29/66/3 33/79/3 31/80/3
|
||||||
|
f 32/26/3 35/76/3 3/25/3
|
||||||
|
f 28/51/3 29/66/3 31/80/3
|
||||||
|
f 31/80/3 32/26/3 18/24/3
|
||||||
|
f 3/25/3 4/81/3 17/82/3
|
||||||
|
f 35/76/3 37/78/3 3/25/3
|
||||||
|
f 21/83/3 28/51/3 22/84/3
|
||||||
|
f 3/25/3 17/82/3 18/24/3
|
||||||
|
f 11/85/3 12/55/3 30/52/3
|
||||||
|
f 32/26/3 3/25/3 18/24/3
|
||||||
|
f 11/85/3 30/52/3 22/84/3
|
||||||
|
f 31/80/3 18/24/3 11/85/3
|
||||||
|
f 24/86/3 27/87/3 21/83/3
|
||||||
|
f 28/51/3 31/80/3 11/85/3
|
||||||
|
f 11/85/3 22/84/3 28/51/3
|
||||||
|
f 24/86/3 21/83/3 23/20/3
|
||||||
|
f 26/88/3 25/89/3 23/20/3
|
||||||
|
f 23/20/3 21/83/3 15/18/3
|
||||||
|
f 15/18/3 16/90/3 7/91/3
|
||||||
|
f 21/83/3 22/84/3 15/18/3
|
||||||
|
f 8/19/3 26/88/3 23/20/3
|
||||||
|
f 15/18/3 7/91/3 8/19/3
|
||||||
|
f 22/21/2 30/49/2 40/22/2
|
||||||
|
f 47/89/4 45/88/4 5/19/4
|
||||||
|
f 5/19/4 6/91/4 13/90/4
|
||||||
|
f 5/19/4 13/90/4 14/18/4
|
||||||
|
f 44/20/4 47/89/4 5/19/4
|
||||||
|
f 43/87/4 46/86/4 44/20/4
|
||||||
|
f 41/83/4 43/87/4 44/20/4
|
||||||
|
f 44/20/4 5/19/4 14/18/4
|
||||||
|
f 39/84/4 40/52/4 80/50/4
|
||||||
|
f 44/20/4 14/18/4 41/83/4
|
||||||
|
f 42/51/4 41/83/4 39/84/4
|
||||||
|
f 39/84/4 80/50/4 50/92/4
|
||||||
|
f 41/83/4 14/18/4 39/84/4
|
||||||
|
f 48/93/4 49/66/4 42/51/4
|
||||||
|
f 50/92/4 48/93/4 42/51/4
|
||||||
|
f 80/50/4 79/94/4 50/92/4
|
||||||
|
f 50/92/4 42/51/4 39/84/4
|
||||||
|
f 54/79/4 55/62/4 52/80/4
|
||||||
|
f 50/92/4 79/94/4 51/95/4
|
||||||
|
f 52/80/4 55/62/4 51/95/4
|
||||||
|
f 51/95/4 79/94/4 10/85/4
|
||||||
|
f 79/94/4 9/55/4 10/85/4
|
||||||
|
f 53/26/4 52/80/4 10/85/4
|
||||||
|
f 58/75/4 56/74/4 53/26/4
|
||||||
|
f 59/78/4 60/77/4 57/76/4
|
||||||
|
f 57/76/4 58/75/4 53/26/4
|
||||||
|
f 52/80/4 51/95/4 10/85/4
|
||||||
|
f 19/24/4 20/82/4 1/81/4
|
||||||
|
f 53/26/4 10/85/4 19/24/4
|
||||||
|
f 59/78/4 57/76/4 2/25/4
|
||||||
|
f 19/24/4 1/81/4 2/25/4
|
||||||
|
f 2/25/4 57/76/4 53/26/4
|
||||||
|
f 70/27/5 71/96/5 62/28/5
|
||||||
|
f 11/30/5 18/97/5 19/31/5
|
||||||
|
f 4/15/5 1/73/5 20/33/5
|
||||||
|
f 72/35/3 74/54/3 64/36/3
|
||||||
|
f 13/8/5 6/29/5 7/38/5
|
||||||
|
f 23/39/6 25/10/6 47/11/6
|
||||||
|
f 68/40/7 75/98/7 70/41/7
|
||||||
|
f 30/11/5 12/17/5 79/99/5
|
||||||
|
f 79/99/10 80/43/10 30/11/10
|
||||||
|
f 12/17/5 9/16/5 79/99/5
|
||||||
|
f 3/15/1 2/73/1 1/32/1
|
||||||
|
f 20/44/2 19/58/2 18/27/2
|
||||||
|
f 74/17/5 78/100/5 65/46/5
|
||||||
|
f 31/43/1 33/99/1 54/47/1
|
||||||
|
f 22/47/5 39/99/5 14/43/5
|
||||||
|
f 46/1/2 24/64/2 23/7/2
|
||||||
|
f 57/21/1 35/23/1 38/22/1
|
||||||
|
f 61/50/9 66/53/9 76/51/9
|
||||||
|
f 37/45/5 59/44/5 2/23/5
|
||||||
|
f 78/28/3 77/51/3 67/53/3
|
||||||
|
f 62/67/1 51/66/1 69/68/1
|
||||||
|
f 51/66/1 55/65/1 63/6/1
|
||||||
|
f 68/17/1 69/68/1 61/69/1
|
||||||
|
f 61/69/1 69/68/1 51/66/1
|
||||||
|
f 61/69/1 51/66/1 63/6/1
|
||||||
|
f 65/71/1 67/70/1 64/5/1
|
||||||
|
f 61/69/1 63/6/1 66/4/1
|
||||||
|
f 64/5/1 67/70/1 66/4/1
|
||||||
|
f 76/55/6 66/85/6 67/56/6
|
||||||
|
f 47/17/2 25/16/2 26/10/2
|
||||||
|
f 5/16/5 45/99/5 26/47/5
|
||||||
|
f 55/60/6 54/101/6 33/58/6
|
||||||
|
f 33/58/6 29/22/6 48/59/6
|
||||||
|
f 48/59/6 72/102/6 63/103/6
|
||||||
|
f 29/22/6 49/104/6 48/59/6
|
||||||
|
f 48/59/6 63/103/6 55/60/6
|
||||||
|
f 29/38/2 28/2/2 42/3/2
|
||||||
|
f 32/44/6 31/23/6 52/21/6
|
||||||
|
f 58/15/6 38/73/6 34/33/6
|
||||||
|
f 27/7/6 24/38/6 46/29/6
|
||||||
|
f 73/61/6 75/105/6 68/62/6
|
||||||
|
f 21/58/6 41/27/6 42/29/6
|
||||||
|
f 11/29/1 10/38/1 9/58/1
|
||||||
|
f 59/45/1 37/44/1 36/2/1
|
||||||
|
f 60/9/6 36/39/6 35/10/6
|
BIN
mods/boats/textures/boat_inventory.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
mods/boats/textures/boat_wield.png
Normal file
After Width: | Height: | Size: 985 B |
BIN
mods/boats/textures/boats_inventory.png
Normal file
After Width: | Height: | Size: 851 B |
BIN
mods/boats/textures/boats_wield.png
Normal file
After Width: | Height: | Size: 546 B |
844
mods/bobblocks/blocks.lua
Normal file
@ -0,0 +1,844 @@
|
|||||||
|
-- BobBlocks mod by RabbiBob
|
||||||
|
-- State Changes
|
||||||
|
|
||||||
|
local update_bobblock = function (pos, node)
|
||||||
|
local nodename=""
|
||||||
|
local param2=""
|
||||||
|
--Switch Block State
|
||||||
|
if
|
||||||
|
-- Start Blocks
|
||||||
|
node.name == 'bobblocks:redblock_off' then nodename = 'bobblocks:redblock'
|
||||||
|
elseif node.name == 'bobblocks:redblock' then nodename = 'bobblocks:redblock_off'
|
||||||
|
elseif node.name == 'bobblocks:orangeblock_off' then nodename = 'bobblocks:orangeblock'
|
||||||
|
elseif node.name == 'bobblocks:orangeblock' then nodename = 'bobblocks:orangeblock_off'
|
||||||
|
elseif node.name == 'bobblocks:yellowblock_off' then nodename = 'bobblocks:yellowblock'
|
||||||
|
elseif node.name == 'bobblocks:yellowblock' then nodename = 'bobblocks:yellowblock_off'
|
||||||
|
elseif node.name == 'bobblocks:greenblock_off' then nodename = 'bobblocks:greenblock'
|
||||||
|
elseif node.name == 'bobblocks:greenblock' then nodename = 'bobblocks:greenblock_off'
|
||||||
|
elseif node.name == 'bobblocks:blueblock_off' then nodename = 'bobblocks:blueblock'
|
||||||
|
elseif node.name == 'bobblocks:blueblock' then nodename = 'bobblocks:blueblock_off'
|
||||||
|
elseif node.name == 'bobblocks:indigoblock_off' then nodename = 'bobblocks:indigoblock'
|
||||||
|
elseif node.name == 'bobblocks:indigoblock' then nodename = 'bobblocks:indigoblock_off'
|
||||||
|
elseif node.name == 'bobblocks:violetblock_off' then nodename = 'bobblocks:violetblock'
|
||||||
|
elseif node.name == 'bobblocks:violetblock' then nodename = 'bobblocks:violetblock_off'
|
||||||
|
elseif node.name == 'bobblocks:whiteblock_off' then nodename = 'bobblocks:whiteblock'
|
||||||
|
elseif node.name == 'bobblocks:whiteblock' then nodename = 'bobblocks:whiteblock_off'
|
||||||
|
-- Start Poles
|
||||||
|
elseif node.name == 'bobblocks:redpole_off' then nodename = 'bobblocks:redpole'
|
||||||
|
elseif node.name == 'bobblocks:redpole' then nodename = 'bobblocks:redpole_off'
|
||||||
|
elseif node.name == 'bobblocks:orangepole_off' then nodename = 'bobblocks:orangepole'
|
||||||
|
elseif node.name == 'bobblocks:orangepole' then nodename = 'bobblocks:orangepole_off'
|
||||||
|
elseif node.name == 'bobblocks:yellowpole_off' then nodename = 'bobblocks:yellowpole'
|
||||||
|
elseif node.name == 'bobblocks:yellowpole' then nodename = 'bobblocks:yellowpole_off'
|
||||||
|
elseif node.name == 'bobblocks:greenpole_off' then nodename = 'bobblocks:greenpole'
|
||||||
|
elseif node.name == 'bobblocks:greenpole' then nodename = 'bobblocks:greenpole_off'
|
||||||
|
elseif node.name == 'bobblocks:bluepole_off' then nodename = 'bobblocks:bluepole'
|
||||||
|
elseif node.name == 'bobblocks:bluepole' then nodename = 'bobblocks:bluepole_off'
|
||||||
|
elseif node.name == 'bobblocks:indigopole_off' then nodename = 'bobblocks:indigopole'
|
||||||
|
elseif node.name == 'bobblocks:indigopole' then nodename = 'bobblocks:indigopole_off'
|
||||||
|
elseif node.name == 'bobblocks:violetpole_off' then nodename = 'bobblocks:violetpole'
|
||||||
|
elseif node.name == 'bobblocks:violetpole' then nodename = 'bobblocks:violetpole_off'
|
||||||
|
elseif node.name == 'bobblocks:whitepole_off' then nodename = 'bobblocks:whitepole'
|
||||||
|
elseif node.name == 'bobblocks:whitepole' then nodename = 'bobblocks:whitepole_off'
|
||||||
|
end
|
||||||
|
minetest.env:add_node(pos, {name = nodename})
|
||||||
|
minetest.sound_play("bobblocks_glassblock",
|
||||||
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Punch Blocks
|
||||||
|
local on_bobblock_punched = function (pos, node, puncher)
|
||||||
|
if
|
||||||
|
-- Start Blocks
|
||||||
|
node.name == 'bobblocks:redblock_off' or node.name == 'bobblocks:redblock' or
|
||||||
|
node.name == 'bobblocks:orangeblock_off' or node.name == 'bobblocks:orangeblock' or
|
||||||
|
node.name == 'bobblocks:yellowblock_off' or node.name == 'bobblocks:yellowblock' or
|
||||||
|
node.name == 'bobblocks:greenblock_off' or node.name == 'bobblocks:greenblock' or
|
||||||
|
node.name == 'bobblocks:blueblock_off' or node.name == 'bobblocks:blueblock' or
|
||||||
|
node.name == 'bobblocks:indigoblock_off' or node.name == 'bobblocks:indigoblock' or
|
||||||
|
node.name == 'bobblocks:violetblock_off' or node.name == 'bobblocks:violetblock' or
|
||||||
|
node.name == 'bobblocks:whiteblock_off' or node.name == 'bobblocks:whiteblock' or
|
||||||
|
--Start Poles
|
||||||
|
node.name == 'bobblocks:redpole_off' or node.name == 'bobblocks:redpole' or
|
||||||
|
node.name == 'bobblocks:orangepole_off' or node.name == 'bobblocks:orangepole' or
|
||||||
|
node.name == 'bobblocks:yellowpole_off' or node.name == 'bobblocks:yellowpole' or
|
||||||
|
node.name == 'bobblocks:greenpole_off' or node.name == 'bobblocks:greenpole' or
|
||||||
|
node.name == 'bobblocks:bluepole_off' or node.name == 'bobblocks:bluepole' or
|
||||||
|
node.name == 'bobblocks:indigopole_off' or node.name == 'bobblocks:indigopole' or
|
||||||
|
node.name == 'bobblocks:violetpole_off' or node.name == 'bobblocks:violetpole' or
|
||||||
|
node.name == 'bobblocks:whitepole_off' or node.name == 'bobblocks:whitepole'
|
||||||
|
then
|
||||||
|
update_bobblock(pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(on_bobblock_punched)
|
||||||
|
|
||||||
|
-- Nodes
|
||||||
|
-- Misc Node
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:btm", {
|
||||||
|
description = "Bobs TransMorgifier v5",
|
||||||
|
tile_images = {"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm_sides.png",
|
||||||
|
"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm.png"},
|
||||||
|
inventory_image = "bobblocks_btm.png",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
material = minetest.digprop_dirtlike(1.0),
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Start Block Nodes
|
||||||
|
minetest.register_node("bobblocks:redblock", {
|
||||||
|
description = "Red Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_redblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_redblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:redblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:redblock_off", {
|
||||||
|
description = "Red Block",
|
||||||
|
tile_images = {"bobblocks_redblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:redblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:redblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:orangeblock", {
|
||||||
|
description = "Orange Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_orangeblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_orangeblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:orangeblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:orangeblock_off", {
|
||||||
|
description = "Orange Block",
|
||||||
|
tile_images = {"bobblocks_orangeblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:orangeblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:orangeblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:yellowblock", {
|
||||||
|
description = "Yellow Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_yellowblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_yellowblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:yellowblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:yellowblock_off", {
|
||||||
|
description = "Yellow Block",
|
||||||
|
tile_images = {"bobblocks_yellowblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:yellowblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:yellowblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:greenblock", {
|
||||||
|
description = "Green Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_greenblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_greenblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:greenblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:greenblock_off", {
|
||||||
|
description = "Green Block",
|
||||||
|
tile_images = {"bobblocks_greenblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:greenblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:greenblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:blueblock", {
|
||||||
|
description = "Blue Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_blueblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_blueblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:blueblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:blueblock_off", {
|
||||||
|
description = "Blue Block",
|
||||||
|
tile_images = {"bobblocks_blueblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:blueblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:blueblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:indigoblock", {
|
||||||
|
description = "Indigo Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_indigoblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_indigoblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:indigoblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:indigoblock_off", {
|
||||||
|
description = "Indigo Block",
|
||||||
|
tile_images = {"bobblocks_indigoblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:indigoblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:indigoblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:violetblock", {
|
||||||
|
description = "Violet Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_violetblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_violetblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:violetblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:violetblock_off", {
|
||||||
|
description = "Violet Block",
|
||||||
|
tile_images = {"bobblocks_violetblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:violetblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:violetblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:whiteblock", {
|
||||||
|
description = "White Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_whiteblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_whiteblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:whiteblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:whiteblock_off", {
|
||||||
|
description = "White Block",
|
||||||
|
tile_images = {"bobblocks_whiteblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:whiteblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:whiteblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:greyblock", {
|
||||||
|
description = "Grey Block",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tile_images = {"bobblocks_greyblock.png"},
|
||||||
|
inventory_image = minetest.inventorycube("bobblocks_greyblock.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:greyblock_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:greyblock_off", {
|
||||||
|
description = "Grey Block",
|
||||||
|
tile_images = {"bobblocks_greyblock.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:greyblock',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:greyblock"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Block Poles
|
||||||
|
minetest.register_node("bobblocks:redpole", {
|
||||||
|
description = "Red Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_redblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invredpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:redpole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:redpole_off", {
|
||||||
|
description = "Red Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_redblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invredpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:redpole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:redpole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:orangepole", {
|
||||||
|
description = "Orange Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_orangeblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invorangepole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:orangepole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:orangepole_off", {
|
||||||
|
description = "Orange Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_orangeblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invorangepole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:orangepole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:orangepole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:yellowpole", {
|
||||||
|
description = "Yellow Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_yellowblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invyellowpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:yellowpole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:yellowpole_off", {
|
||||||
|
description = "Yellow Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_yellowblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invyellowpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:yellowpole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:yellowpole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:greenpole", {
|
||||||
|
description = "Green Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_greenblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invgreenpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:greenpole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:greenpole_off", {
|
||||||
|
description = "Green Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_greenblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invgreenpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:greenpole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:greenpole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:bluepole", {
|
||||||
|
description = "Blue Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_blueblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invbluepole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:bluepole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:bluepole_off", {
|
||||||
|
description = "Blue Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_blueblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invbluepole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:bluepole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:bluepole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:indigopole", {
|
||||||
|
description = "Indigo Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_indigoblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invindigopole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:indigopole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:indigopole_off", {
|
||||||
|
description = "Indigo Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_indigoblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invindigopole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:indigopole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:indigopole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:violetpole", {
|
||||||
|
description = "Violet Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_violetblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invvioletpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:violetpole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:violetpole_off", {
|
||||||
|
description = "Violet Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_violetblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invvioletpole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:violetpole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:violetpole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:whitepole", {
|
||||||
|
description = "White Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_whiteblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invwhitepole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:whitepole_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:whitepole_off", {
|
||||||
|
description = "White Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_whiteblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invwhitepole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
light_source = LIGHT_MAX-10,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:whitepole',
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:whitepole"
|
||||||
|
}}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:greypole", {
|
||||||
|
description = "Grey Pole",
|
||||||
|
drawtype = "fencelike",
|
||||||
|
tile_images = {"bobblocks_greyblock.png"},
|
||||||
|
inventory_image = ("bobblocks_invgreypole.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
--light_source = LIGHT_MAX-0,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Crafts
|
||||||
|
-- BTM
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:btm" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:leaves" 1',
|
||||||
|
'node "default:mese" 1','node "default:rat" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:greyblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:cobble" 1'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Red / Yellow / Blue / White
|
||||||
|
-- Red / Yellow -> Orange
|
||||||
|
-- Red / Blue -> Violet
|
||||||
|
-- Blue / Yellow -> Green
|
||||||
|
-- Red / Yellow / White -> Indigo
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:redblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:brick" 1'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:yellowblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:sand" 1'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:blueblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:gravel" 1'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:whiteblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:dirt" 1'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:orangeblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:redblock" 1', 'node "bobblocks:yellowblock" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:violetblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:greenblock" 2',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:blueblock" 1', 'node "bobblocks:yellowblock" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:indigoblock" 3',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1', 'node "bobblocks:whiteblock" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Poles
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:redpole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:redblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:yellowpole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:yellowblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:bluepole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:blueblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:whitepole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:whiteblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:orangepole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:orangeblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:violetpole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:violetblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:greenpole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:greenblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:indigopole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:indigoblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:greypole" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "bobblocks:greyblock" 1', 'node "default:stick" 1'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- MESECON
|
||||||
|
-- Add jeija to bobblocks\default.txt and paste the below in at the bottom of bobblocks\blocks.lua
|
||||||
|
|
2
mods/bobblocks/depends.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
mesecons
|
95
mods/bobblocks/health.lua
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
local is_healthpack = function(node)
|
||||||
|
if node.name == 'bobblocks:health_off' or node.name == 'health_on' then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local update_healthpack = function (pos, node)
|
||||||
|
local nodename=""
|
||||||
|
local param2=""
|
||||||
|
--Switch HealthPack State
|
||||||
|
if node.name == 'bobblocks:health_off' then
|
||||||
|
nodename = 'bobblocks:health_on'
|
||||||
|
elseif node.name == 'bobblocks:health_on' then
|
||||||
|
nodename = 'bobblocks:health_off'
|
||||||
|
end
|
||||||
|
minetest.env:add_node(pos, {name = nodename})
|
||||||
|
end
|
||||||
|
|
||||||
|
local toggle_healthpack = function (pos, node)
|
||||||
|
if not is_healthgate(node) then return end
|
||||||
|
update_healthpack (pos, node, state)
|
||||||
|
end
|
||||||
|
|
||||||
|
local on_healthpack_punched = function (pos, node, puncher)
|
||||||
|
if node.name == 'bobblocks:health_off' or node.name == 'bobblocks:health_on' then
|
||||||
|
update_healthpack(pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Healing Node
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:health_off", {
|
||||||
|
description = "Health Pack 1 Off",
|
||||||
|
tile_images = {"bobblocks_health_off.png"},
|
||||||
|
inventory_image = "bobblocks_health_off.png",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
is_ground_content = true,
|
||||||
|
walkable = false,
|
||||||
|
climbable = false,
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.off,
|
||||||
|
onstate = "bobblocks:health_on"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:health_on", {
|
||||||
|
description = "Health Pack 1 On",
|
||||||
|
tile_images = {"bobblocks_health_on.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
light_source = LIGHT_MAX-0,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
is_ground_content = true,
|
||||||
|
walkable = false,
|
||||||
|
climbable = false,
|
||||||
|
drop = "bobblocks:health_off",
|
||||||
|
mesecons = {conductor={
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "bobblocks:health_off"
|
||||||
|
}}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_abm(
|
||||||
|
{nodenames = {"bobblocks:health_on"},
|
||||||
|
interval = 1.0,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||||
|
for k, obj in pairs(objs) do
|
||||||
|
minetest.sound_play("bobblocks_health",
|
||||||
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||||
|
obj:set_hp(obj:get_hp()+10) -- give 10HP
|
||||||
|
minetest.env:remove_node(pos) -- remove the node after use
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
--- Health
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'NodeItem "bobblocks:health_off" 1',
|
||||||
|
recipe = {
|
||||||
|
{'node "default:dirt" 1', 'node "default:paper" 1', 'node "default:apple" 2'},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(on_healthpack_punched)
|
||||||
|
|
11
mods/bobblocks/init.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loading....")
|
||||||
|
print("[BobBlocks] loading Blocks")
|
||||||
|
dofile(minetest.get_modpath("bobblocks") .. "/blocks.lua")
|
||||||
|
print("[BobBlocks] loaded Blocks")
|
||||||
|
--print("[BobBlocks] loading Health")
|
||||||
|
--dofile(minetest.get_modpath("bobblocks") .. "/health.lua")
|
||||||
|
--print("[BobBlocks] loaded Health")
|
||||||
|
--print("[BobBlocks] loading Traps")
|
||||||
|
--dofile(minetest.get_modpath("bobblocks") .. "/trap.lua")
|
||||||
|
--print("[BobBlocks] loaded Traps")
|
||||||
|
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loaded!")
|
11
mods/bobblocks/init.lua~
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loading....")
|
||||||
|
print("[BobBlocks] loading Blocks")
|
||||||
|
dofile(minetest.get_modpath("bobblocks") .. "/blocks.lua")
|
||||||
|
print("[BobBlocks] loaded Blocks")
|
||||||
|
print("[BobBlocks] loading Health")
|
||||||
|
dofile(minetest.get_modpath("bobblocks") .. "/health.lua")
|
||||||
|
print("[BobBlocks] loaded Health")
|
||||||
|
print("[BobBlocks] loading Traps")
|
||||||
|
dofile(minetest.get_modpath("bobblocks") .. "/trap.lua")
|
||||||
|
print("[BobBlocks] loaded Traps")
|
||||||
|
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loaded!")
|
53
mods/bobblocks/readme.txt
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
-- BobBlocks v0.0.8
|
||||||
|
-- (Minetest 0.4.5 compatible 20130315)
|
||||||
|
-- http://forum.minetest.net/viewtopic.php?id=1274
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
-- Requirements: Mesecons --
|
||||||
|
-- http://forum.minetest.net/viewtopic.php?id=628 --
|
||||||
|
-- --
|
||||||
|
-- Does not support jeija or older version of Mesecons --
|
||||||
|
-- before 1/20/2013 --
|
||||||
|
-- http://forum.minetest.net/viewtopic.php?pid=64976#p64976 --
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
-- Colored Lit Blocks
|
||||||
|
---- Default state = Solid lit block
|
||||||
|
---- Secondary state (punch) = transparent unlit block
|
||||||
|
---- Mesecons activation [CONDUCTOR]
|
||||||
|
-- Colored Lit Poles
|
||||||
|
---- Default state = Solid lit block
|
||||||
|
---- Secondary state (punch) = unlit block
|
||||||
|
---- Mesecons activation [CONDUCTOR]
|
||||||
|
-- Health Kit
|
||||||
|
---- Default state = health kit inactive
|
||||||
|
---- Secondary state (punch) = health kit active +10HP when walked through
|
||||||
|
---- Mesecons activation [CONDUCTOR]
|
||||||
|
-- Trap
|
||||||
|
---- Default Grass (walkable off)
|
||||||
|
---- Spike Minor (1HP per hit)
|
||||||
|
------ Spikes can be 'set' and activated when walked over
|
||||||
|
---- Spike Major (100HP per hit)
|
||||||
|
------ Spikes can be 'set' and activated when walked over
|
||||||
|
|
||||||
|
# [ATTRIBUTION]
|
||||||
|
# Unless otherwise noted, all graphics & sounds
|
||||||
|
# created by Rabbi Bob
|
||||||
|
# Licensed under the GPLv2/later
|
||||||
|
|
||||||
|
# [GRAPHICS]
|
||||||
|
# minor & major spikes by Death Dealer
|
||||||
|
# License: WTFPL
|
||||||
|
# http://minetest.net/forum/viewtopic.php?id=1582
|
||||||
|
|
||||||
|
# [SOUNDS]
|
||||||
|
# bobblocks_glass
|
||||||
|
# Author: Ch0cchi
|
||||||
|
# http://www.freesound.org/people/Ch0cchi/sounds/15285/
|
||||||
|
# Edited by rabbibob
|
||||||
|
# bobblocks_trap_fall & bobblocks_trap_fall_major
|
||||||
|
# Author: Rock Savage
|
||||||
|
# http://www.freesound.org/people/Rock%20Savage/sounds/65924/#
|
||||||
|
# Edited by rabbibob
|
||||||
|
# bobblocks_health
|
||||||
|
# http://hamsterrepublic.com/ohrrpgce/Free_Sound_Effects.html
|
BIN
mods/bobblocks/sounds/bobblocks_glassblock.ogg
Normal file
BIN
mods/bobblocks/sounds/bobblocks_health.ogg
Normal file
BIN
mods/bobblocks/sounds/bobblocks_trap_fall.ogg
Normal file
BIN
mods/bobblocks/sounds/bobblocks_trap_fall_major.ogg
Normal file
BIN
mods/bobblocks/textures/bobblocks_blueblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_btm.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_btm_sides.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_greenblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_greyblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_health_off.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_health_on.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_health_one_sides.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_indigoblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invbluepole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invgreenpole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invgreypole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invindigopole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invorangepole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invredpole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invvioletpole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invwhitepole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_invyellowpole.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_majorspike.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_minorspike.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_orangeblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_redblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_redblock_off.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_trap_set.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_violetblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_whiteblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/bobblocks/textures/bobblocks_yellowblock.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
183
mods/bobblocks/trap.lua
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
-- State Changes
|
||||||
|
|
||||||
|
local update_bobtrap = function (pos, node)
|
||||||
|
local nodename=""
|
||||||
|
local param2=""
|
||||||
|
--Switch Trap State
|
||||||
|
if
|
||||||
|
-- Swap Traps
|
||||||
|
node.name == 'bobblocks:trap_spike' then nodename = 'bobblocks:trap_spike_set'
|
||||||
|
elseif node.name == 'bobblocks:trap_spike_set' then nodename = 'bobblocks:trap_spike'
|
||||||
|
elseif node.name == 'bobblocks:trap_spike_major' then nodename = 'bobblocks:trap_spike_major_set'
|
||||||
|
elseif node.name == 'bobblocks:trap_spike_major_set' then nodename = 'bobblocks:trap_spike_major'
|
||||||
|
end
|
||||||
|
minetest.env:add_node(pos, {name = nodename})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Punch Traps
|
||||||
|
local on_bobtrap_punched = function (pos, node, puncher)
|
||||||
|
if
|
||||||
|
-- Start Traps
|
||||||
|
node.name == 'bobblocks:trap_spike' or node.name == 'bobblocks:trap_spike_set' or
|
||||||
|
node.name == 'bobblocks:trap_spike_major' or node.name == 'bobblocks:trap_spike_major_set'
|
||||||
|
then
|
||||||
|
update_bobtrap(pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(on_bobtrap_punched)
|
||||||
|
|
||||||
|
|
||||||
|
--ABM (Spring The Traps)
|
||||||
|
|
||||||
|
minetest.register_abm(
|
||||||
|
{nodenames = {"bobblocks:trap_spike_set"},
|
||||||
|
interval = 1.0,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||||
|
for k, obj in pairs(objs) do
|
||||||
|
|
||||||
|
update_bobtrap(pos, node)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm(
|
||||||
|
{nodenames = {"bobblocks:trap_spike_major_set"},
|
||||||
|
interval = 1.0,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||||
|
for k, obj in pairs(objs) do
|
||||||
|
|
||||||
|
update_bobtrap(pos, node)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Nodes
|
||||||
|
minetest.register_node("bobblocks:trap_grass", {
|
||||||
|
description = "Trap Grass",
|
||||||
|
tile_images = {"default_grass.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
legacy_facedir_simple = true,
|
||||||
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
climbable = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:trap_spike", {
|
||||||
|
description = "Trap Spike Minor",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 1,
|
||||||
|
tile_images = {"bobblocks_minorspike.png"},
|
||||||
|
inventory_image = ("bobblocks_minorspike.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
groups = {cracky=3,melty=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:trap_spike_set", {
|
||||||
|
description = "Trap Spike Minor Set",
|
||||||
|
drawtype = "raillike",
|
||||||
|
visual_scale = 1,
|
||||||
|
tile_images = {"bobblocks_trap_set.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
groups = {cracky=3,melty=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:trap_spike',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:trap_spike_major", {
|
||||||
|
description = "Trap Spike Major",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 1,
|
||||||
|
tile_images = {"bobblocks_majorspike.png"},
|
||||||
|
inventory_image = ("bobblocks_majorspike.png"),
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
groups = {cracky=2,melty=2},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("bobblocks:trap_spike_major_set", {
|
||||||
|
description = "Trap Spike Major Set",
|
||||||
|
drawtype = "raillike",
|
||||||
|
visual_scale = 1,
|
||||||
|
tile_images = {"bobblocks_trap_set.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
groups = {cracky=3,melty=3,not_in_creative_inventory=1},
|
||||||
|
drop = 'bobblocks:trap_spike_major',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Crafting
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'bobblocks:trap_spike',
|
||||||
|
recipe = {
|
||||||
|
{'', '', ''},
|
||||||
|
{'', 'default:cobble', ''},
|
||||||
|
{'default:cobble', 'default:apple', 'default:cobble'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'bobblocks:trap_spike_major',
|
||||||
|
recipe = {
|
||||||
|
{'', 'default:cobble', ''},
|
||||||
|
{'', 'default:apple', ''},
|
||||||
|
{'default:cobble', 'default:apple', 'default:cobble'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'bobblocks:trap_grass',
|
||||||
|
recipe = {
|
||||||
|
{'', '', ''},
|
||||||
|
{'', 'default:dirt', ''},
|
||||||
|
{'', 'default:stick', ''},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- ABM
|
||||||
|
minetest.register_abm(
|
||||||
|
{nodenames = {"bobblocks:trap_spike"},
|
||||||
|
interval = 1.0,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||||
|
for k, obj in pairs(objs) do
|
||||||
|
obj:set_hp(obj:get_hp()-1)
|
||||||
|
minetest.sound_play("bobblocks_trap_fall",
|
||||||
|
{pos = pos, gain = 1.0, max_hear_distance = 3,})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm(
|
||||||
|
{nodenames = {"bobblocks:trap_spike_major"},
|
||||||
|
interval = 1.0,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||||
|
for k, obj in pairs(objs) do
|
||||||
|
obj:set_hp(obj:get_hp()-100)
|
||||||
|
minetest.sound_play("bobblocks_trap_fall",
|
||||||
|
{pos = pos, gain = 1.0, max_hear_distance = 3,})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
17
mods/bones/README.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Minetest Game mod: bones
|
||||||
|
========================
|
||||||
|
|
||||||
|
License of source code:
|
||||||
|
-----------------------
|
||||||
|
Copyright (C) 2012 PilzAdam
|
||||||
|
|
||||||
|
WTFPL
|
||||||
|
|
||||||
|
License of media (textures and sounds)
|
||||||
|
--------------------------------------
|
||||||
|
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||||
|
http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
|
|
||||||
|
Authors of media files
|
||||||
|
----------------------
|
||||||
|
All textures: paramat
|
269
mods/bones/bones.lua
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
---
|
||||||
|
--Bones
|
||||||
|
--Copyright (C) 2012 Bad_Command
|
||||||
|
--
|
||||||
|
--This library is free software; you can redistribute it and/or
|
||||||
|
--modify it under the terms of the GNU Lesser General Public
|
||||||
|
--License as published by the Free Software Foundation; either
|
||||||
|
--version 2.1 of the License, or (at your option) any later version.
|
||||||
|
--
|
||||||
|
--This program is distributed in the hope that it will be useful,
|
||||||
|
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
--GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
--You should have received a copy of the GNU Lesser General Public
|
||||||
|
--License along with this library; if not, write to the Free Software
|
||||||
|
--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
----
|
||||||
|
|
||||||
|
bones.replaceable_node_types = {
|
||||||
|
"default:lava_source",
|
||||||
|
"default:lava_flowing",
|
||||||
|
"default:water_source",
|
||||||
|
"default:water_flowing",
|
||||||
|
"air"
|
||||||
|
}
|
||||||
|
|
||||||
|
bones.allow_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
if not bones.privilege(meta, player) then
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" tried to access bones belonging to "..
|
||||||
|
meta:get_string("owner").." at "..
|
||||||
|
minetest.pos_to_string(pos))
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return stack:get_count()
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.on_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
local fresh = meta:get_int("fresh") or 1
|
||||||
|
if fresh > 0 then
|
||||||
|
fresh = "fresh"
|
||||||
|
else
|
||||||
|
fresh = "old"
|
||||||
|
end
|
||||||
|
minetest.log("action", player:get_player_name()..
|
||||||
|
" picks from "..meta:get_string("owner").."'s "..fresh.." bones at "..minetest.pos_to_string(pos))
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.privilege=function(meta, player)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local privs = minetest.get_player_privs(name)
|
||||||
|
if not privs["interact"] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local fresh = meta:get_int("fresh") or 0
|
||||||
|
if fresh > 0 and name ~= meta:get_string("owner") and not privs["server"] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.action=function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
local fresh = meta:get_int("fresh") or 0
|
||||||
|
if fresh > 0 then
|
||||||
|
local bonetime = meta:get_float("bonetime") or 0
|
||||||
|
if worldtime_get() - bonetime > bones.age_after then
|
||||||
|
local name = meta:get_string("owner") or ""
|
||||||
|
meta:set_string("infotext", name .. "'s old bones")
|
||||||
|
meta:set_int("fresh", -1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.create = function(player, pos)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
minetest.env:set_node(pos, {name="bones:bones", param1=0, param2=0})
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
meta:set_string("formspec",
|
||||||
|
"invsize[8,9;]"..
|
||||||
|
"list[current_name;main;0,0;8,4;]"..
|
||||||
|
"list[current_player;main;0,5;8,4;]")
|
||||||
|
meta:set_string("infotext", name .. "'s fresh bones")
|
||||||
|
meta:set_string("owner", name)
|
||||||
|
meta:set_float("bonetime", worldtime_get())
|
||||||
|
meta:set_int("fresh", 1)
|
||||||
|
|
||||||
|
-- test to see if node was created
|
||||||
|
local node = minetest.env:get_node_or_nil(pos)
|
||||||
|
if node == nil or node.name ~= "bones:bones" then
|
||||||
|
minetest.log("error", 'Bones: Failed to create bones node for '..name)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local bones_inv = meta:get_inventory()
|
||||||
|
bones_inv:set_size("main", 8*4)
|
||||||
|
local player_inv = player:get_inventory()
|
||||||
|
if ( player_inv == nil ) then
|
||||||
|
minetest.log("error", 'Bones: Unable to get player '..name..' inventory')
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
for i=1,32 do
|
||||||
|
local stack = player_inv:get_stack("main", i)
|
||||||
|
if stack ~= nil and not stack:is_empty() then
|
||||||
|
bones_inv:set_stack("main", i, stack:to_table())
|
||||||
|
player_inv:set_stack("main", i, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i=1,9 do
|
||||||
|
local stack = player_inv:get_stack("craft", i)
|
||||||
|
if stack ~= nil and not stack:is_empty() then
|
||||||
|
local leftover = bones_inv:add_item("main", stack)
|
||||||
|
if leftover ~= nil and not leftover:is_empty() then
|
||||||
|
minetest.env:add_item({
|
||||||
|
x=pos.x,
|
||||||
|
y=pos.y + 1.1,
|
||||||
|
z=pos.z}, leftover)
|
||||||
|
end
|
||||||
|
player_inv:set_stack("craft", i, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.settle_type = function(nodename)
|
||||||
|
for i=1,#bones.replaceable_node_types do
|
||||||
|
if nodename == bones.replaceable_node_types[i] then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.on_punch = function(pos, node, player)
|
||||||
|
if node == nil or node.name ~= "bones:bones" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
|
||||||
|
local fresh = meta:get_int("fresh") or 0
|
||||||
|
if fresh == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local name = player:get_player_name()
|
||||||
|
if name ~= meta:get_string("owner") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
local bones_inv = meta:get_inventory()
|
||||||
|
if ( bones_inv == nil ) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local player_inv = player:get_inventory()
|
||||||
|
if ( player_inv == nil ) then
|
||||||
|
minetest.log("error", 'Bones: Unable to get player '..name..' inventory')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=1,32 do
|
||||||
|
local stack = bones_inv:get_stack("main", i)
|
||||||
|
if stack ~= nil and not stack:is_empty() then
|
||||||
|
local leftover = player_inv:add_item("main", stack)
|
||||||
|
bones_inv:set_stack("main", i, nil)
|
||||||
|
if leftover ~= nil and not leftover:is_empty() then
|
||||||
|
bones_inv:set_stack("main", i, leftover)
|
||||||
|
else
|
||||||
|
bones_inv:set_stack("main", i, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.log("action", name.." unloaded his fresh bones at "..minetest.pos_to_string(pos))
|
||||||
|
|
||||||
|
-- destroy the bone item
|
||||||
|
minetest.env:set_node(pos, {name="air", param1=0, param2=0})
|
||||||
|
minetest.log("action","Destroying bones "..minetest.pos_to_string(pos))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
bones.settle_bones = function(pos)
|
||||||
|
local nextpos = pos;
|
||||||
|
local node
|
||||||
|
|
||||||
|
-- find ground beneath player
|
||||||
|
repeat
|
||||||
|
pos = nextpos
|
||||||
|
nextpos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
|
node = minetest.env:get_node_or_nil(nextpos)
|
||||||
|
until node == nil or not bones.settle_type(node.name)
|
||||||
|
|
||||||
|
node = minetest.env:get_node_or_nil(pos)
|
||||||
|
|
||||||
|
-- if the player is inside rock or something
|
||||||
|
if node == nil or not bones.settle_type(node.name) then
|
||||||
|
-- find nearby empty node
|
||||||
|
pos = minetest.env:find_node_near(pos, 3, bones.replaceable_node_types)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if nothing nearby is empty
|
||||||
|
if pos == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return pos;--{x=math.floor(pos.x*10)/10, y=math.floor(pos.y*10)/10, z=math.floor(pos.z*10)/10}
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.pos_to_string = function(pos)
|
||||||
|
return math.floor(pos.x + 0.5) .. "," .. math.floor(pos.y+0.5) .. "," .. math.floor(pos.z+0.5)
|
||||||
|
end
|
||||||
|
|
||||||
|
bones.on_dieplayer = function(player)
|
||||||
|
if player == nil then
|
||||||
|
minetest.log("error", 'Unknown player died (player = nil)')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local privs = minetest.get_player_privs(name)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
|
||||||
|
if not privs["interact"] or (inv:is_empty("main") and inv:is_empty("craft")) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local playerpos = player:getpos()
|
||||||
|
playerpos = {
|
||||||
|
x=math.floor(playerpos.x+0.5),
|
||||||
|
y=math.floor(playerpos.y+0.5),
|
||||||
|
z=math.floor(playerpos.z+0.5)
|
||||||
|
}
|
||||||
|
local bonepos = bones.settle_bones(playerpos);
|
||||||
|
if bonepos == nil then
|
||||||
|
minetest.log("action", player:get_player_name().." dies at "..minetest.pos_to_string(playerpos)..' without dropping gear.')
|
||||||
|
minetest.chat_send_player(name, 'Bones: There was no room to drop your bones. You get to keep your gear.')
|
||||||
|
return
|
||||||
|
else
|
||||||
|
if bones.create(player, bonepos) then
|
||||||
|
minetest.log("action", player:get_player_name().." dies at "..minetest.pos_to_string(playerpos)..', gear dropped at '..minetest.pos_to_string(bonepos))
|
||||||
|
minetest.chat_send_player(name,
|
||||||
|
'Bones: Your bones were left at '..bones.pos_to_string(bonepos)..
|
||||||
|
'. Go there to find your gear. Bones stay fresh for '..
|
||||||
|
(math.floor(bones.age_after/360+0.5)/10)..'hrs.')
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name, 'Bones: Lucky you! You get to respawn with your bones.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = { "bones:bones" },
|
||||||
|
interval = 120,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
local bonetime = meta:get_float("bonetime") or 0
|
||||||
|
if worldtime_get() - bonetime > bones.destroy_after then
|
||||||
|
minetest.env:set_node(pos, {name="air", param1=0, param2=0})
|
||||||
|
minetest.log("action","Destroying bones"..minetest.pos_to_string(pos))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
24
mods/bones/config.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
--Bones Configuration File
|
||||||
|
--Copyright (C) 2012 Bad_Command
|
||||||
|
--
|
||||||
|
--This library is free software; you can redistribute it and/or
|
||||||
|
--modify it under the terms of the GNU Lesser General Public
|
||||||
|
--License as published by the Free Software Foundation; either
|
||||||
|
--version 2.1 of the License, or (at your option) any later version.
|
||||||
|
--
|
||||||
|
--This program is distributed in the hope that it will be useful,
|
||||||
|
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
--GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
--You should have received a copy of the GNU Lesser General Public
|
||||||
|
--License along with this library; if not, write to the Free Software
|
||||||
|
--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
----
|
||||||
|
|
||||||
|
-- Config option: Bones become 'old' after this interval, in seconds.
|
||||||
|
-- Default: 2 hours (there are 3600 seconds in an hour.)
|
||||||
|
bones.age_after = 2 * 3600
|
||||||
|
bones.destroy_after = 6 * 3600
|
||||||
|
|
1
mods/bones/depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
default
|
248
mods/bones/init.lua
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
-- Minetest 0.4 mod: bones
|
||||||
|
-- See README.txt for licensing and other information.
|
||||||
|
|
||||||
|
local function is_owner(pos, name)
|
||||||
|
local owner = minetest.get_meta(pos):get_string("owner")
|
||||||
|
if owner == "" or owner == name or minetest.check_player_privs(name, "protection_bypass") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local bones_formspec =
|
||||||
|
"size[8,9]" ..
|
||||||
|
default.gui_bg ..
|
||||||
|
default.gui_bg_img ..
|
||||||
|
default.gui_slots ..
|
||||||
|
"list[current_name;main;0,0.3;8,4;]" ..
|
||||||
|
"list[current_player;main;0,4.85;8,1;]" ..
|
||||||
|
"list[current_player;main;0,6.08;8,3;8]" ..
|
||||||
|
"listring[current_name;main]" ..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
default.get_hotbar_bg(0,4.85)
|
||||||
|
|
||||||
|
local share_bones_time = tonumber(minetest.setting_get("share_bones_time")) or 1200
|
||||||
|
local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early")) or share_bones_time / 4
|
||||||
|
|
||||||
|
minetest.register_node("bones:bones", {
|
||||||
|
description = "Bones",
|
||||||
|
tiles = {
|
||||||
|
"bones_top.png^[transform2",
|
||||||
|
"bones_bottom.png",
|
||||||
|
"bones_side.png",
|
||||||
|
"bones_side.png",
|
||||||
|
"bones_rear.png",
|
||||||
|
"bones_front.png"
|
||||||
|
},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {dig_immediate = 2},
|
||||||
|
sounds = default.node_sound_gravel_defaults(),
|
||||||
|
|
||||||
|
can_dig = function(pos, player)
|
||||||
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
local name = ""
|
||||||
|
if player then
|
||||||
|
name = player:get_player_name()
|
||||||
|
end
|
||||||
|
return is_owner(pos, name) and inv:is_empty("main")
|
||||||
|
end,
|
||||||
|
|
||||||
|
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
if is_owner(pos, player:get_player_name()) then
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
|
||||||
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
|
||||||
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
if is_owner(pos, player:get_player_name()) then
|
||||||
|
return stack:get_count()
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if meta:get_inventory():is_empty("main") then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_punch = function(pos, node, player)
|
||||||
|
if not is_owner(pos, player:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_meta(pos):get_string("infotext") == "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
local player_inv = player:get_inventory()
|
||||||
|
local has_space = true
|
||||||
|
|
||||||
|
for i = 1, inv:get_size("main") do
|
||||||
|
local stk = inv:get_stack("main", i)
|
||||||
|
if player_inv:room_for_item("main", stk) then
|
||||||
|
inv:set_stack("main", i, nil)
|
||||||
|
player_inv:add_item("main", stk)
|
||||||
|
else
|
||||||
|
has_space = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- remove bones if player emptied them
|
||||||
|
if has_space then
|
||||||
|
if player_inv:room_for_item("main", {name = "bones:bones"}) then
|
||||||
|
player_inv:add_item("main", {name = "bones:bones"})
|
||||||
|
else
|
||||||
|
minetest.add_item(pos,"bones:bones")
|
||||||
|
end
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local time = meta:get_int("time") + elapsed
|
||||||
|
if time >= share_bones_time then
|
||||||
|
meta:set_string("infotext", meta:get_string("owner") .. "'s old bones")
|
||||||
|
meta:set_string("owner", "")
|
||||||
|
else
|
||||||
|
meta:set_int("time", time)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_blast = function(pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local function may_replace(pos, player)
|
||||||
|
local node_name = minetest.get_node(pos).name
|
||||||
|
local node_definition = minetest.registered_nodes[node_name]
|
||||||
|
|
||||||
|
-- if the node is unknown, we return false
|
||||||
|
if not node_definition then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- allow replacing air and liquids
|
||||||
|
if node_name == "air" or node_definition.liquidtype ~= "none" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- don't replace filled chests and other nodes that don't allow it
|
||||||
|
local can_dig_func = node_definition.can_dig
|
||||||
|
if can_dig_func and not can_dig_func(pos, player) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones?
|
||||||
|
-- flowers being squished by bones are more realistical than a squished stone, too
|
||||||
|
-- exception are of course any protected buildable_to
|
||||||
|
return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name())
|
||||||
|
end
|
||||||
|
|
||||||
|
local drop = function(pos, itemstack)
|
||||||
|
local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count()))
|
||||||
|
if obj then
|
||||||
|
obj:setvelocity({
|
||||||
|
x = math.random(-10, 10) / 9,
|
||||||
|
y = 5,
|
||||||
|
z = math.random(-10, 10) / 9,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_dieplayer(function(player)
|
||||||
|
|
||||||
|
local bones_mode = minetest.setting_get("bones_mode") or "bones"
|
||||||
|
if bones_mode ~= "bones" and bones_mode ~= "drop" and bones_mode ~= "keep" then
|
||||||
|
bones_mode = "bones"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- return if keep inventory set or in creative mode
|
||||||
|
if bones_mode == "keep" or minetest.setting_getbool("creative_mode") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local player_inv = player:get_inventory()
|
||||||
|
if player_inv:is_empty("main") and
|
||||||
|
player_inv:is_empty("craft") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = vector.round(player:getpos())
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
|
||||||
|
-- check if it's possible to place bones, if not go 1 higher
|
||||||
|
if bones_mode == "bones" and not may_replace(pos, player) then
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- still cannot place bones? change mode to 'drop'
|
||||||
|
if bones_mode == "bones" and not may_replace(pos, player) then
|
||||||
|
bones_mode = "drop"
|
||||||
|
end
|
||||||
|
|
||||||
|
if bones_mode == "drop" then
|
||||||
|
|
||||||
|
-- drop inventory items
|
||||||
|
for i = 1, player_inv:get_size("main") do
|
||||||
|
drop(pos, player_inv:get_stack("main", i))
|
||||||
|
end
|
||||||
|
player_inv:set_list("main", {})
|
||||||
|
|
||||||
|
-- drop crafting grid items
|
||||||
|
for i = 1, player_inv:get_size("craft") do
|
||||||
|
drop(pos, player_inv:get_stack("craft", i))
|
||||||
|
end
|
||||||
|
player_inv:set_list("craft", {})
|
||||||
|
|
||||||
|
drop(pos, ItemStack("bones:bones"))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local param2 = minetest.dir_to_facedir(player:get_look_dir())
|
||||||
|
minetest.set_node(pos, {name = "bones:bones", param2 = param2})
|
||||||
|
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8 * 4)
|
||||||
|
inv:set_list("main", player_inv:get_list("main"))
|
||||||
|
|
||||||
|
for i = 1, player_inv:get_size("craft") do
|
||||||
|
local stack = player_inv:get_stack("craft", i)
|
||||||
|
if inv:room_for_item("main", stack) then
|
||||||
|
inv:add_item("main", stack)
|
||||||
|
else
|
||||||
|
--drop if no space left
|
||||||
|
drop(pos, stack)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
player_inv:set_list("main", {})
|
||||||
|
player_inv:set_list("craft", {})
|
||||||
|
|
||||||
|
meta:set_string("formspec", bones_formspec)
|
||||||
|
meta:set_string("owner", player_name)
|
||||||
|
|
||||||
|
if share_bones_time ~= 0 then
|
||||||
|
meta:set_string("infotext", player_name .. "'s fresh bones")
|
||||||
|
|
||||||
|
if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then
|
||||||
|
meta:set_int("time", 0)
|
||||||
|
else
|
||||||
|
meta:set_int("time", (share_bones_time - share_bones_time_early))
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.get_node_timer(pos):start(10)
|
||||||
|
else
|
||||||
|
meta:set_string("infotext", player_name.."'s bones")
|
||||||
|
end
|
||||||
|
end)
|
502
mods/bones/license.txt
Normal file
@ -0,0 +1,502 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
BIN
mods/bones/textures/bones_bottom.png
Normal file
After Width: | Height: | Size: 740 B |
BIN
mods/bones/textures/bones_front.png
Normal file
After Width: | Height: | Size: 656 B |
BIN
mods/bones/textures/bones_rear.png
Normal file
After Width: | Height: | Size: 637 B |
BIN
mods/bones/textures/bones_side.png
Normal file
After Width: | Height: | Size: 700 B |
BIN
mods/bones/textures/bones_top.png
Normal file
After Width: | Height: | Size: 662 B |
26
mods/bucket/README.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Minetest Game mod: bucket
|
||||||
|
=========================
|
||||||
|
|
||||||
|
License of source code:
|
||||||
|
-----------------------
|
||||||
|
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
|
||||||
|
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||||
|
|
||||||
|
License of media (textures and sounds)
|
||||||
|
--------------------------------------
|
||||||
|
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||||
|
http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
|
|
||||||
|
Authors of media files
|
||||||
|
-----------------------
|
||||||
|
Everything not listed in here:
|
||||||
|
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
|
||||||
|
|
2
mods/bucket/depends.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
|
191
mods/bucket/init.lua
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
-- Minetest 0.4 mod: bucket
|
||||||
|
-- See README.txt for licensing and other information.
|
||||||
|
|
||||||
|
minetest.register_alias("bucket", "bucket:bucket_empty")
|
||||||
|
minetest.register_alias("bucket_water", "bucket:bucket_water")
|
||||||
|
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'bucket:bucket_empty 1',
|
||||||
|
recipe = {
|
||||||
|
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||||
|
{'', 'default:steel_ingot', ''},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
bucket = {}
|
||||||
|
bucket.liquids = {}
|
||||||
|
|
||||||
|
local function check_protection(pos, name, text)
|
||||||
|
if minetest.is_protected(pos, name) then
|
||||||
|
minetest.log("action", (name ~= "" and name or "A mod")
|
||||||
|
.. " tried to " .. text
|
||||||
|
.. " at protected position "
|
||||||
|
.. minetest.pos_to_string(pos)
|
||||||
|
.. " with a bucket")
|
||||||
|
minetest.record_protection_violation(pos, name)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register a new liquid
|
||||||
|
-- source = name of the source node
|
||||||
|
-- flowing = name of the flowing node
|
||||||
|
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
|
||||||
|
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
||||||
|
-- name = text description of the bucket item
|
||||||
|
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
|
||||||
|
-- This function can be called from any mod (that depends on bucket).
|
||||||
|
function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups)
|
||||||
|
bucket.liquids[source] = {
|
||||||
|
source = source,
|
||||||
|
flowing = flowing,
|
||||||
|
itemname = itemname,
|
||||||
|
}
|
||||||
|
bucket.liquids[flowing] = bucket.liquids[source]
|
||||||
|
|
||||||
|
if itemname ~= nil then
|
||||||
|
minetest.register_craftitem(itemname, {
|
||||||
|
description = name,
|
||||||
|
inventory_image = inventory_image,
|
||||||
|
stack_max = 1,
|
||||||
|
liquids_pointable = true,
|
||||||
|
groups = groups,
|
||||||
|
|
||||||
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
|
-- Must be pointing to node
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node_or_nil(pointed_thing.under)
|
||||||
|
local ndef = node and minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
if ndef and ndef.on_rightclick and
|
||||||
|
user and not user:get_player_control().sneak then
|
||||||
|
return ndef.on_rightclick(
|
||||||
|
pointed_thing.under,
|
||||||
|
node, user,
|
||||||
|
itemstack)
|
||||||
|
end
|
||||||
|
|
||||||
|
local lpos
|
||||||
|
|
||||||
|
-- Check if pointing to a buildable node
|
||||||
|
if ndef and ndef.buildable_to then
|
||||||
|
-- buildable; replace the node
|
||||||
|
lpos = pointed_thing.under
|
||||||
|
else
|
||||||
|
-- not buildable to; place the liquid above
|
||||||
|
-- check if the node above can be replaced
|
||||||
|
|
||||||
|
lpos = pointed_thing.above
|
||||||
|
node = minetest.get_node_or_nil(lpos)
|
||||||
|
local above_ndef = node and minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
|
if not above_ndef or not above_ndef.buildable_to then
|
||||||
|
-- do not remove the bucket with the liquid
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if check_protection(lpos, user
|
||||||
|
and user:get_player_name()
|
||||||
|
or "", "place "..source) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.set_node(lpos, {name = source})
|
||||||
|
return ItemStack("bucket:bucket_empty")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craftitem("bucket:bucket_empty", {
|
||||||
|
description = "Empty Bucket",
|
||||||
|
inventory_image = "bucket.png",
|
||||||
|
stack_max = 99,
|
||||||
|
liquids_pointable = true,
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
-- Must be pointing to node
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- Check if pointing to a liquid source
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
local liquiddef = bucket.liquids[node.name]
|
||||||
|
local item_count = user:get_wielded_item():get_count()
|
||||||
|
|
||||||
|
if liquiddef ~= nil
|
||||||
|
and liquiddef.itemname ~= nil
|
||||||
|
and node.name == liquiddef.source then
|
||||||
|
if check_protection(pointed_thing.under,
|
||||||
|
user:get_player_name(),
|
||||||
|
"take ".. node.name) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- default set to return filled bucket
|
||||||
|
local giving_back = liquiddef.itemname
|
||||||
|
|
||||||
|
-- check if holding more than 1 empty bucket
|
||||||
|
if item_count > 1 then
|
||||||
|
|
||||||
|
-- if space in inventory add filled bucked, otherwise drop as item
|
||||||
|
local inv = user:get_inventory()
|
||||||
|
if inv:room_for_item("main", {name=liquiddef.itemname}) then
|
||||||
|
inv:add_item("main", liquiddef.itemname)
|
||||||
|
else
|
||||||
|
local pos = user:getpos()
|
||||||
|
pos.y = math.floor(pos.y + 0.5)
|
||||||
|
minetest.add_item(pos, liquiddef.itemname)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- set to return empty buckets minus 1
|
||||||
|
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.add_node(pointed_thing.under, {name="air"})
|
||||||
|
|
||||||
|
return ItemStack(giving_back)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
bucket.register_liquid(
|
||||||
|
"default:water_source",
|
||||||
|
"default:water_flowing",
|
||||||
|
"bucket:bucket_water",
|
||||||
|
"bucket_water.png",
|
||||||
|
"Water Bucket",
|
||||||
|
{water_bucket = 1}
|
||||||
|
)
|
||||||
|
|
||||||
|
bucket.register_liquid(
|
||||||
|
"default:river_water_source",
|
||||||
|
"default:river_water_flowing",
|
||||||
|
"bucket:bucket_river_water",
|
||||||
|
"bucket_river_water.png",
|
||||||
|
"River Water Bucket",
|
||||||
|
{water_bucket = 1}
|
||||||
|
)
|
||||||
|
|
||||||
|
bucket.register_liquid(
|
||||||
|
"default:lava_source",
|
||||||
|
"default:lava_flowing",
|
||||||
|
"bucket:bucket_lava",
|
||||||
|
"bucket_lava.png",
|
||||||
|
"Lava Bucket"
|
||||||
|
)
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "bucket:bucket_lava",
|
||||||
|
burntime = 60,
|
||||||
|
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
|
||||||
|
})
|
||||||
|
|
BIN
mods/bucket/textures/bucket.png
Executable file
After Width: | Height: | Size: 205 B |
BIN
mods/bucket/textures/bucket_lava.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
mods/bucket/textures/bucket_river_water.png
Normal file
After Width: | Height: | Size: 221 B |