Initial commit

1) Need to add the fishing mod as submodule
2) keep we the mesecons & pipeworks mod ?
3) need to tweaks the hudbars to only keep the sprint and headth bar
4) need to disable damage, & players can't die (immortal)
master
Quentin BUISSON-DEBON 2015-09-14 17:06:16 +02:00
parent 8b445bf3f8
commit 9c88eef9e9
6847 changed files with 217708 additions and 1 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/.project
.~*
~*
*~
*.od?#
*.patch
*.swp

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "mods/quests"]
path = mods/quests
url = https://github.com/MinetestForFun/quests.git
[submodule "mods/fishing"]
path = mods/fishing
url = https://github.com/MinetestForFun/fishing.git

25
LICENSE Normal file
View File

@ -0,0 +1,25 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>

View File

@ -1 +1,6 @@
# server-minetestforfun-creative
MinetestForFun Creative server version of MinetestForFun Team
===================
You can find here the subgame of the server MinetestForFun.
If you want help us, don't hesitate.

129
minetest.conf Normal file
View File

@ -0,0 +1,129 @@
### GENERAL SETTINGS SERVER ###
###############################
name = Darcidride
# 0 = none, 1 = errors and debug, 2 = action, 3 = info, 4 = verbose
debug_log_level = 2
motd = Welcome to "MinetestForFun CREATIVE" server! Feel free to build what you want, where you want, how you want!
# Permet aux vieux client de minetest de ce connecter
strict_protocol_version_checking = false
# Options pour le type du serveur
creative_mode = true
enable_damage = false
disallow_empty_password = true
server_dedicated = true
# 1 day-night cycle lasts 24 minutes instead of 20.
time_speed = 60
# Slightly higher player limit by default.
max_users = 50
# Give basics privileges to new players.
default_privs = home, spawn
# If true, actions are recorded for rollback
enable_rollback_recording = true
# Desactivate fire
disable_fire = true
# Si false, les pseudos des joueurs sont cachés à partir d'une distance de 50 blocs
unlimited_player_transfer_distance = true
# Activated the minimap usage if true
enable_minimap = true
# Disable PvP
enable_pvp = false
### SERVER SETTINGS FOR IMPROVED PERFORMANCE ###
################################################
max_block_generate_distance = 16 # 4 for better performances
max_block_send_distance = 8 # 6 for better performances
max_simultaneous_block_sends_per_client = 24 # 6 for better performances
max_simultaneous_block_sends_server_total = 500 # 125 for better performances
time_send_interval = 10
active_block_range = 1
server_map_save_interval = 60
sqlite_synchronous = 0
### SERVER AND PUBLIC INFORMATIONS ###
######################################
server_name = MinetestForFun CREATIVE
server_description = Creative server hosted by MinetestForFun Team. (Based on our main server mods)
serverlist_url = servers.minetest.net
server_url = http://minetestforfun.com/
server_announce = true
server_address = 212.83.148.178
port = 30001
### MOVEMENT MODIFICATIONS ###
##############################
# Slightly decreased compared to minetest_next.
movement_acceleration_default = 2.4
# Same acceleration in air and on the ground, to fix some movement glitches. Also is easier to play.
movement_acceleration_air = 1.2
# Almost instant acceleration in fast mode for more control.
movement_acceleration_fast = 24
# Walking is 20 % faster than in minetest_game. Makes playing without the "fast" privilege less boring.
movement_speed_walk = 4.8
# Half the speed of walking, just like the animation.
movement_speed_crouch = 2.4
# 5 times faster than walking.
movement_speed_fast = 24
# Makes climbing speed faster than rising in the water. Also makes ladders more useful.
movement_speed_climb = 4.8
# Faster movement in liquids. Jumping at the water surface also speeds up swimming.
movement_liquid_fluidity = 1.6 (default = 1)
# Ralentissement à la surface de l'eau
movement_liquid_fluidity_smooth = 0.5
# Vitesse à laquelle le joueur coule
movement_liquid_sink = 15
# Slightly less gravity.
movement_gravity = 9.5
# Jump height slightly reduced.
movement_speed_jump = 6.5
# Emplacement du static spawn point
static_spawnpoint = 24,97,-1
# Désactivation de l'anti-cheat qui fait ce téléporter en arrière si l'on va trop vite
disable_anticheat = true
### WORLD MODIFICATIONS ###
###########################
# mapgen version or singlenode
mg_name = v7
# A chosen map seed for a new map, leave empty for random
#fixed_map_seed = 13107546752813893513
# Enable dungeons on new worlds.
mg_flags = trees, caves, dungeons
# Enable jungles on new worlds, disable biome blend and mud flow (faster, looks better).
#mgv6_spflags = jungles, nobiomeblend, nomudflow
# Less deserts, more beaches.
#mgv6_freq_desert = 0.6
#mgv6_freq_beach = -0.15
### MODS PARAMETERS ###
#######################
# GIVE_INITIAL_STUFF MOD - Equipement pour les nouveaux joueurs : Give 1 axe_wood, 10 torches, 2 saplings, 5 apples. Edit mods/misc/give_initial_stuff.lua to change.
give_initial_stuff = true #MODIFIER LES ITEMS AU DEMARRAGE !
# AREAS MOD
areas.self_protection = true
areas.self_protection_max_size = {x=50, y=100, z=50}
areas.self_protection_max_areas = 10
# RANDOM_MESSAGES MOD - paramétrage de l'interval entre deux messages, 30min actuellement
random_messages_interval = 900
# FAIL MOD - permettant failpoints et cookies
fp_pubmsg = true
fp_strict_checking = false
# MESECONS MOD - paramétrage des outils logiques
mesecon.overheat_max = 60
# MAPFIX MOD - Recalculate the flowing liquids and the light of a chunk
mapfix_default_size = 40
mapfix_max_size = 50
mapfix_delay = 15
### IRC CHAT ###
################
irc.server = digitalaudioconcepts.com
#Old value : irc.inchra.net # Ne marche pas : osiris.inchra.net #digitalaudioconcepts.com #IP address 176.9.29.178:6667 or 67.241.151.78:6697
irc.channel = #minetestforfun-creative
irc.interval = 2.0
irc.nick = MFFC-Bot
#irc.password = #vide car aucun mdp pour le channel
secure.trusted_mods = irc, snow # Mod security
irc.debug = false
irc.disable_auto_connect = false
irc.disable_auto_join = false
irc.send_join_part = true

9
minetestforfun_game/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
## Generic ignorable patterns and files
*~
.*.swp
*.bak*
tags
*.vim
## Files related to minetest development cycle
*.patch

View File

@ -0,0 +1,52 @@
The main game for the Minetest game engine [minetest_game]
==========================================================
To use this game with Minetest, insert this repository as
/games/minetest_game
in the Minetest Engine.
The Minetest Engine can be found in:
https://github.com/minetest/minetest/
Compatibility
--------------
The minetest_game github master HEAD is generally compatible with the github
master HEAD of minetest.
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) 2013 BlockMen CC BY-3.0

View File

@ -0,0 +1 @@
name = MinetestForFun Game

View File

@ -0,0 +1,384 @@
minetest_game API
======================
GitHub Repo: https://github.com/minetest/minetest_game
Introduction
------------
The minetest_game gamemode offers multiple new possibilities in addition to Minetest'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
^ Explanation for line above
Bucket API
----------
The bucket API allows registering new types of buckets for non-default liquids.
bucket.register_liquid(
"default:lava_source", -- Source node name
"default:lava_flowing", -- Flowing node name
"bucket:bucket_lava", -- Name to be used for bucket
"bucket_lava.png", -- Bucket texture (for wielditem and inventory_image)
"Lava Bucket" -- Bucket description
)
Beds API
--------
beds.register_bed(
"beds:bed", -- Bed name
def: See [#Bed definition] -- 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, see [Node boxes], -- bottm part of bed
top = regular nodebox, see [Node boxes], -- top part of bed
},
selectionbox = regular nodebox, see [Node boxes], -- for both nodeboxes
recipe = { -- Craft recipe
{"group:wool", "group:wool", "group:wool"},
{"group:wood", "group:wood", "group:wood"}
}
}
Doors API
---------
The doors mod allows modders to register custom doors and trapdoors.
doors.register_door(name, def)
^ name: "Door name"
^ def: See [#Door definition]
-> Registers new door
doors.register_trapdoor(name, def)
^ name: "Trapdoor name"
^ def: See [#Trapdoor definition]
-> Registers new trapdoor
#Door definition
----------------
{
description = "Door description",
inventory_image = "mod_door_inv.png",
groups = {group = 1},
tiles_bottom: [Tile definition],
^ the tiles of the bottom part of the door {front, side}
tiles_top: [Tile definition],
^ the tiles of the bottom part of the door {front, side}
node_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
node_box_top = regular nodebox, see [Node boxes], OPTIONAL,
selection_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
selection_box_top = regular nodebox, see [Node boxes], OPTIONAL,
sound_open_door = sound play for open door, OPTIONAL,
sound_close_door = sound play for close door, OPTIONAL,
only_placer_can_open = true/false,
^ If true, only placer can open the door (locked for others)
}
#Trapdoor definition
----------------
{
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
sound_open = sound to play when opening the trapdoor, OPTIONAL,
sound_close = sound to play when closing the trapdoor, OPTIONAL,
-> You can add any other node definition properties for minetest.register_node,
such as wield_image, inventory_image, sounds, groups, description, ...
Only node_box, selection_box, tiles, drop, drawtype, paramtype, paramtype2, on_rightclick
will be overwritten by the trapdoor registration function
}
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
}
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 = screwdriver.disallow to always disallow rotation
^ use on_rotate = screwdriver.rotate_simple to allow only face rotation
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"
-> 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 (* = equal to a 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
^ Array containing the names of available base colors
dye.excolors
^ Array containing the names of the available extended colors
Trees
-----
default.grow_tree(pos, is_apple_tree)
^ Grows a tree or apple tree at pos
default.grow_jungle_tree(pos)
^ Grows a jungletree at pos
default.grow_pine_tree(pos)
^ Grows a pinetree at pos

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,2 @@
# Enable jungles on new worlds, disable biome blend and mud flow (faster, looks better).
mgv6_spflags = jungles, nobiomeblend, nomudflow

View File

@ -0,0 +1,28 @@
# This file contains settings of minetest_game that can be changed in
# minetest.conf
#
# By default, all the settings are commented and not functional.
# Uncomment settings by removing the preceding #.
# Whether creative mode (fast digging of all blocks, unlimited resources) should be enabled
#creative_mode = false
# The time in seconds after which the bones of a dead player can be looted by everyone
# 0 to disable
#share_bones_time = 1200
# Whether fire should be disabled (all fire nodes will instantly disappear)
#disable_fire = false
# Whether steel tools, torches and cobblestone should be given to new players
#give_initial_stuff = false
# Whether the TNT mod should be enabled
#enable_tnt = <true in singleplayer, false in multiplayer>
# The radius of a TNT explosion
#tnt_radius = 3
# Enable the stairs mod ABM that replaces the old 'upside down'
# stair and slab nodes in old maps with the new param2 versions.
#enable_stairs_replace_abm = false

View File

@ -0,0 +1,26 @@
Minetest 0.4 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>

View File

@ -0,0 +1,2 @@
default

View File

@ -0,0 +1,221 @@
-- 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_acid", "bucket:bucket_acid")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
minetest.register_craft({
output = 'bucket:bucket_empty 1',
recipe = {
{'group:ingot', '', 'group:ingot'},
{'', 'group: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
if node then
ndef = minetest.registered_nodes[node.name]
end
-- 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) or itemstack
end
local place_liquid = function(pos, node, source, flowing)
if check_protection(pos,
user and user:get_player_name() or "",
"place "..source) then
return
end
minetest.add_node(pos, {name=source})
end
-- Check if pointing to a buildable node
if ndef and ndef.buildable_to then
-- buildable; replace the node
place_liquid(pointed_thing.under, node,
source, flowing)
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
local node = minetest.get_node_or_nil(pointed_thing.above)
if node and minetest.registered_nodes[node.name].buildable_to then
place_liquid(pointed_thing.above,
node, source,
flowing)
else
-- do not remove the bucket with the liquid
return
end
end
return {name="bucket:bucket_empty"}
end
})
end
end
-- Empty Bucket code by Casimir.
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)
core.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, not_in_creative_inventory = 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, not_in_creative_inventory = 1}
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png",
"Lava Bucket"
)
bucket.register_liquid(
"default:acid_source",
"default:acid_flowing",
"bucket:bucket_acid",
"bucket_acid.png",
"Acid Bucket",
{not_in_creative_inventory = 1}
)
bucket.register_liquid(
"default:sand_source",
"default:sand_flowing",
"bucket:bucket_sand",
"bucket_sand.png",
"Sand Bucket",
{not_in_creative_inventory = 1}
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})
minetest.register_craft({
output = "bucket:bucket_sand",
recipe = {
{"group:sand"},
{"group:sand"},
{"bucket:bucket_water"},
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

View File

@ -0,0 +1,22 @@
Minetest 0.4 mod: creative
==========================
Implements creative mode.
Switch on by using the "creative_mode" setting.
Registered items that
- have a description, and
- do not have the group not_in_creative_inventory
are added to the creative inventory.
License of source code and media files:
---------------------------------------
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
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.

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,177 @@
-- minetest/creative/init.lua
creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
table.insert(creative_list, name)
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
creative_inventory.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return stack:get_count()
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, "")
end,
})
trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec(
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;5,3.5;8,1;]"..
"list[current_player;main;5,4.75;8,3;8]"..
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"listring[current_player;main]"..
"listring[current_player;craft]"..
"listring[current_player;main]"..
"listring[detached:creative;main]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]"..
default.get_hotbar_bg(5,3.5)
)
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 4*6
end
if fields.creative_next then
start_i = start_i + 4*6
end
if start_i < 0 then
start_i = start_i + 4*6
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end)
if minetest.setting_getbool("creative_mode") then
local digtime = 0.5
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
},
damage_groups = {fleshy = 10},
}
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return
end)
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
end
end
end
end
end

View File

@ -0,0 +1,211 @@
Minetest 0.4 mod: default
==========================
License of source code:
-----------------------
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.1 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>
Cisoun's WTFPL texture pack:
default_jungletree.png
default_lava.png
default_leaves.png
default_sapling.png
default_sign_wall.png
default_stone.png
default_tree.png
default_tree_top.png
default_water.png
Cisoun's conifers mod (WTFPL):
default_pine_needles.png
Originating from G4JC's Almost MC Texture Pack:
default_torch.png
default_torch_on_ceiling.png
default_torch_on_floor.png
VanessaE's animated torches (WTFPL):
default_torch_animated.png
default_torch_on_ceiling_animated.png
default_torch_on_floor_animated.png
default_torch_on_floor.png
RealBadAngel's animated water (WTFPL):
default_water_source_animated.png
default_water_flowing_animated.png
VanessaE (WTFPL):
default_nc_back.png
default_nc_front.png
default_nc_rb.png
default_nc_side.png
default_desert_sand.png
default_desert_stone.png
default_sand.png
default_jungletree_top.png
Calinou (CC BY-SA):
default_brick.png
default_papyrus.png
default_mineral_copper.png
default_glass_detail.png
MirceaKitsune (WTFPL):
character.x
Jordach (CC BY-SA 3.0):
character.png
PilzAdam (WTFPL):
default_jungleleaves.png
default_junglesapling.png
default_obsidian_glass.png
default_obsidian_shard.png
default_mineral_gold.png
default_snowball.png
jojoa1997 (WTFPL):
default_obsidian.png
InfinityProject (WTFPL):
default_mineral_diamond.png
Splizard (CC BY-SA 3.0):
default_snow.png
default_snow_side.png
default_pine_sapling.png
Zeg9 (CC BY-SA 3.0):
default_coal_block.png
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
paramat (CC BY-SA 3.0):
wieldhand.png, derived from character.png by Jordach (CC BY-SA 3.0)
default_pinetree.png
default_pinetree_top.png
default_pinewood.png
default_sandstone_brick.png
default_obsidian_brick.png
default_river_water.png
default_river_water_source_animated.png
default_river_water_flowing_animated.png
default_acacia_leaves.png
default_acacia_sapling.png
default_acacia_tree.png
default_acacia_tree_top.png
default_acacia_wood.png
default_dry_grass.png
default_dry_grass_side.png
default_dry_grass_*.png
default_junglewood.png, derived from a texture by BlockMen (CC BY-SA 3.0)
default_grass.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
default_grass_side.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
default_stone_brick.png, derived from a texture by Cisoun (WTFPL)
default_desert_stone_brick.png, derived from a texture by VanessaE (WTFPL)
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_wood.png
default_clay_brick.png
default_iron_ingot.png
default_gold_ingot.png
default_tool_steelsword.png
default_diamond.png
default_book.png
default_tool_*.png
default_lava_source_animated.png
default_lava_flowing_animated.png
default_stick.png
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_mineral_mese.png
default_meselamp.png
bubble.png
heart.png
gui_*.png
Neuromancer (CC BY-SA 2.0):
default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect
Neuromancer (CC BY-SA 3.0):
default_dirt.png
default_furnace_*.png
Gambit (WTFPL):
default_bronze_ingot.png
default_copper_ingot.png
default_copper_lump.png
default_iron_lump.png
default_gold_lump.png
default_clay_lump.png
default_coal.png
default_grass_*.png
default_paper.png
default_diamond_block.png
asl97 (WTFPL):
default_ice.png
Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
2: http://www.freesound.org/people/Tomlija/sounds/97669/
3: http://www.freesound.org/people/lsprice/sounds/88808/
Mito551 (sounds) (CC BY-SA):
default_dig_choppy.ogg
default_dig_cracky.ogg
default_dig_crumbly.1.ogg
default_dig_crumbly.2.ogg
default_dig_dig_immediate.ogg
default_dig_oddly_breakable_by_hand.ogg
default_dug_node.1.ogg
default_dug_node.2.ogg
default_grass_footstep.1.ogg
default_grass_footstep.2.ogg
default_grass_footstep.3.ogg
default_gravel_footstep.1.ogg
default_gravel_footstep.2.ogg
default_gravel_footstep.3.ogg
default_gravel_footstep.4.ogg
default_grass_footstep.1.ogg
default_place_node.1.ogg
default_place_node.2.ogg
default_place_node.3.ogg
default_place_node_hard.1.ogg
default_place_node_hard.2.ogg
default_snow_footstep.1.ogg
default_snow_footstep.2.ogg
default_hard_footstep.1.ogg
default_hard_footstep.2.ogg
default_hard_footstep.3.ogg
default_sand_footstep.1.ogg
default_sand_footstep.2.ogg
default_wood_footstep.1.ogg
default_wood_footstep.2.ogg
default_dirt_footstep.1.ogg
default_dirt_footstep.2.ogg
default_glass_footstep.ogg

View File

@ -0,0 +1,76 @@
-- mods/default/aliases.lua
-- Aliases to support loading worlds using nodes following the old naming convention
-- These can also be helpful when using chat commands, for example /giveme
minetest.register_alias("stone", "default:stone")
minetest.register_alias("stone_with_coal", "default:stone_with_coal")
minetest.register_alias("stone_with_iron", "default:stone_with_iron")
minetest.register_alias("dirt_with_grass", "default:dirt_with_grass")
minetest.register_alias("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps")
minetest.register_alias("dirt", "default:dirt")
minetest.register_alias("sand", "default:sand")
minetest.register_alias("gravel", "default:gravel")
minetest.register_alias("sandstone", "default:sandstone")
minetest.register_alias("clay", "default:clay")
minetest.register_alias("brick", "default:brick")
minetest.register_alias("tree", "default:tree")
minetest.register_alias("jungletree", "default:jungletree")
minetest.register_alias("junglegrass", "default:junglegrass")
minetest.register_alias("leaves", "default:leaves")
minetest.register_alias("cactus", "default:cactus")
minetest.register_alias("papyrus", "default:papyrus")
minetest.register_alias("bookshelf", "default:bookshelf")
minetest.register_alias("glass", "default:glass")
minetest.register_alias("wooden_fence", "default:fence_wood")
minetest.register_alias("rail", "default:rail")
minetest.register_alias("ladder", "default:ladder")
minetest.register_alias("wood", "default:wood")
minetest.register_alias("mese", "default:mese")
minetest.register_alias("cloud", "default:cloud")
minetest.register_alias("water_flowing", "default:water_flowing")
minetest.register_alias("water_source", "default:water_source")
minetest.register_alias("lava_flowing", "default:lava_flowing")
minetest.register_alias("lava_source", "default:lava_source")
minetest.register_alias("torch", "default:torch")
minetest.register_alias("sign_wall", "default:sign_wall")
minetest.register_alias("furnace", "default:furnace")
minetest.register_alias("chest", "default:chest")
minetest.register_alias("locked_chest", "default:chest_locked")
minetest.register_alias("cobble", "default:cobble")
minetest.register_alias("mossycobble", "default:mossycobble")
minetest.register_alias("steelblock", "default:steelblock")
minetest.register_alias("nyancat", "default:nyancat")
minetest.register_alias("nyancat_rainbow", "default:nyancat_rainbow")
minetest.register_alias("sapling", "default:sapling")
minetest.register_alias("apple", "default:apple")
minetest.register_alias("WPick", "default:pick_wood")
minetest.register_alias("STPick", "default:pick_stone")
minetest.register_alias("SteelPick", "default:pick_steel")
minetest.register_alias("MesePick", "default:pick_mese")
minetest.register_alias("WShovel", "default:shovel_wood")
minetest.register_alias("STShovel", "default:shovel_stone")
minetest.register_alias("SteelShovel", "default:shovel_steel")
minetest.register_alias("WAxe", "default:axe_wood")
minetest.register_alias("STAxe", "default:axe_stone")
minetest.register_alias("SteelAxe", "default:axe_steel")
minetest.register_alias("WSword", "default:sword_wood")
minetest.register_alias("STSword", "default:sword_stone")
minetest.register_alias("SteelSword", "default:sword_steel")
minetest.register_alias("Stick", "default:stick")
minetest.register_alias("paper", "default:paper")
minetest.register_alias("book", "default:book")
minetest.register_alias("lump_of_coal", "default:coal_lump")
minetest.register_alias("lump_of_iron", "default:iron_lump")
minetest.register_alias("lump_of_clay", "default:clay_lump")
minetest.register_alias("steel_ingot", "default:steel_ingot")
minetest.register_alias("clay_brick", "default:clay_brick")
minetest.register_alias("snow", "default:snow")
-- Aliases for corrected pine node names
minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood")
-- Mese now comes in the form of blocks, ore, crystal and fragments
minetest.register_alias("default:mese", "default:mese_block")

View File

@ -0,0 +1,190 @@
minetest.register_privilege("physics", {
description = "Allows player to set their gravity, jump height and movement speed"})
-- Infotool code by PilzAdam:
minetest.register_craftitem("default:infotool", {
description = "Infotool",
inventory_image = "default_infotool.png",
wield_image = "default_infotool.png^[transformR90",
groups = {not_in_creative_inventory = 1},
on_use = function(_, user, pt)
if pt.type ~= "node" then return end
local nn = minetest.get_node(pt.under).name
if minetest.registered_items[nn] == nil or minetest.registered_items[nn].tiles == nil or type(minetest.registered_items[nn].tiles[1]) ~= "string" then return end
local def = minetest.registered_nodes[nn]
if not def then return end
local textures = def.tiles
local description = def.description
if not textures then
textures = {"(no texture)"}
end
if not description then
description = {"(no description)"}
end
for i = 1,6 do
if not textures[i] then
textures[i] = textures[i-1]
end
end
local dir = vector.subtract(pt.above, pt.under)
local index
-- This doesn't work for facedir or other drawtypes yet.
if dir.y == 1 then
index = 1
elseif dir.y == -1 then
index = 2
else
if dir.x == 1 then
index = 3
elseif dir.x == -1 then
index = 4
else
if dir.z == 1 then
index = 5
else
index = 6
end
end
end
minetest.chat_send_player(user:get_player_name(), description .. ": " .. nn .. " (" .. textures[index] .. ")")
end,
})
minetest.register_chatcommand("info", {
description = "Gives an Infotool, click to receive information on the pointed node",
func = function(name)
local receiverref = minetest.get_player_by_name(name)
receiverref:get_inventory():add_item("main", "default:infotool")
minetest.chat_send_player(name, "\"default:infotool\" added to inventory.")
end,
})
minetest.register_chatcommand("clearinventory", {
params = "<inventory>",
description = "Clears an entire inventory, \"main\" if unspecified, \"craft\" is another possible choice",
func = function(name, param)
local player = minetest.get_player_by_name(name)
local player_inv = player:get_inventory()
if not player then
minetest.log("error", "Unable to clear inventory, no player.")
return false, "Unable to clear inventory, no player."
end
if param == "" then
player_inv:set_list("main", {})
return true, "Inventory \"main\" cleared."
else
player_inv:set_list(param, {})
return true, "Inventory \"" .. param .. "\" cleared."
end
end,
})
-- The following commands /whoami, /suicide, /speed, /gravity and /jump by Wuzzy:
minetest.register_chatcommand("whoami", {
params = "",
description = "Tells your name",
privs = {},
func = function(name)
minetest.chat_send_player(name, "Your name is: " .. name)
end,
})
minetest.register_chatcommand("ip", {
params = "",
description = "Shows your IP address",
privs = {},
func = function(name)
minetest.chat_send_player(name, "Your IP address is: "..minetest.get_player_ip(name))
end
})
minetest.register_chatcommand("suicide", {
params = "",
description = "Kills yourself",
func = function(name, param)
local player = minetest.get_player_by_name(name)
if not player then return end
player:set_hp(0)
if minetest.setting_getbool("enable_damage") == false then
minetest.chat_send_player(name, "[X] Damage is disabled on this server.")
else
minetest.chat_send_player(name, "[X] You suicided.")
end
end,
})
minetest.register_chatcommand("speed", {
params = "[speed]",
description = "Sets your movement speed (defaults to 1).",
privs = {physics = true},
func = function(name, speed)
local player = minetest.get_player_by_name(name)
if not player then return end
if speed == "" then speed = 1 end
if type(tonumber(speed)) ~= "number"
or tonumber(speed) < 0
or tonumber(speed) > 10 then
minetest.chat_send_player(name, "[~] Speed must be between 0.0 and 10.0.")
return
end
player:set_physics_override(tonumber(speed), nil, nil)
minetest.chat_send_player(name, "[~] Speed set to " .. tonumber(speed) * 100 .. " %.")
end,
})
minetest.register_chatcommand("gravity", {
params = "[gravity]",
description = "Sets your gravity (defaults to 1).",
privs = {physics = true},
func = function(name, gravity)
local player = minetest.get_player_by_name(name)
if not player then return end
if gravity == "" then gravity = 1 end
if type(tonumber(gravity)) ~= "number"
or tonumber(gravity) < -10
or tonumber(gravity) > 10 then
minetest.chat_send_player(name, "[~] Gravity must be between -10.0 and 10.0.")
return
end
player:set_physics_override(nil, nil, tonumber(gravity))
minetest.chat_send_player(name, "[~] Gravity set to " .. tonumber(gravity) * 100 .. " %.")
end,
})
minetest.register_chatcommand("jump", {
params = "[height]",
description = "Sets your jump height (defaults to 1)",
privs = {physics = true},
func = function(name, jump)
local player = minetest.get_player_by_name(name)
if not player then return end
if jump == "" then jump = 1 end
if type(tonumber(jump)) ~= "number"
or tonumber(jump) < 0
or tonumber(jump) > 10 then
minetest.chat_send_player(name, "[~] Jump height must be between 0.0 and 10.0.")
return
end
player:set_physics_override(nil, tonumber(jump), nil)
minetest.chat_send_player(name, "[~] Jump height set to " .. tonumber(jump) * 100 .. " %.")
end,
})
minetest.register_chatcommand("hotbar", {
params = "[size]",
description = "Sets the size of your hotbar",
func = function(name, slots)
if slots == "" then slots = 16 end
if type(tonumber(slots)) ~= "number" or tonumber(slots) < 1 or tonumber(slots) > 23 then
minetest.chat_send_player(name, "[_] Hotbar size must be between 1 and 23.")
return
end
local player = minetest.get_player_by_name(name)
player:hud_set_hotbar_itemcount(tonumber(slots))
minetest.chat_send_player(name, "[_] Hotbar size set to " .. tonumber(slots) .. ".")
end,
})

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,185 @@
-- mods/default/craftitems.lua
minetest.register_craftitem("default:stick", {
description = "Stick",
stack_max = 1000,
inventory_image = "default_stick.png",
wield_image = "default_stick.png^[transformR90",
groups = {stick=1},
})
minetest.register_craftitem("default:paper", {
description = "Paper",
wield_scale = {x = 1, y = 1, z = 0.25},
inventory_image = "default_paper.png",
})
local function book_on_use(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local data = minetest.deserialize(itemstack:get_metadata())
local title, text, owner = "", "", player_name
if data then
title, text, owner = data.title, data.text, data.owner
end
local formspec
if owner == player_name then
formspec = "size[8,8]"..default.gui_bg..
"field[0.5,1;7.5,0;title;Title:;"..
minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;text;Contents:;"..
minetest.formspec_escape(text).."]"..
"button_exit[2.5,7.5;3,1;save;Save]"
else
formspec = "size[8,8]"..default.gui_bg..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
end
minetest.show_formspec(user:get_player_name(), "default:book", formspec)
end
minetest.register_on_player_receive_fields(function(player, form_name, fields)
if form_name ~= "default:book" or not fields.save or
fields.title == "" or fields.text == "" then
return
end
local inv = player:get_inventory()
local stack = player:get_wielded_item()
local new_stack, data
if stack:get_name() ~= "default:book_written" then
local count = stack:get_count()
if count == 1 then
stack:set_name("default:book_written")
else
stack:set_count(count - 1)
new_stack = ItemStack("default:book_written")
end
else
data = minetest.deserialize(stack:get_metadata())
end
if not data then data = {} end
data.title = fields.title
data.text = fields.text
data.owner = player:get_player_name()
local data_str = minetest.serialize(data)
if new_stack then
new_stack:set_metadata(data_str)
if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack)
else
minetest.add_item(player:getpos(), new_stack)
end
else
stack:set_metadata(data_str)
end
player:set_wielded_item(stack)
end)
minetest.register_craftitem("default:book", {
description = "Book",
inventory_image = "default_book.png",
groups = {book=1},
on_use = book_on_use,
})
minetest.register_craftitem("default:book_written", {
description = "Book With Text",
inventory_image = "default_book.png",
groups = {book=1, not_in_creative_inventory=1},
stack_max = 1,
on_use = book_on_use,
})
minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_coal_lump.png",
groups = {coal = 1}
})
minetest.register_craftitem("default:iron_lump", {
description = "Iron Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_iron_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:copper_lump", {
description = "Copper Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:mese_crystal", {
description = "Mese Crystal",
inventory_image = "default_mese_crystal.png",
})
minetest.register_craftitem("default:gold_lump", {
description = "Gold Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_gold_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:diamond", {
description = "Diamond",
inventory_image = "default_diamond.png",
})
minetest.register_craftitem("default:clay_lump", {
description = "Clay Lump",
stack_max = 200,
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_clay_lump.png",
})
minetest.register_craftitem("default:steel_ingot", {
description = "Steel Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_steel_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:copper_ingot", {
description = "Copper Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_bronze_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:gold_ingot", {
description = "Gold Ingot",
wield_scale = {x = 1, y = 1, z = 2},
groups = {ingot = 1},
inventory_image = "default_gold_ingot.png"
})
minetest.register_craftitem("default:mese_crystal_fragment", {
description = "Mese Crystal Fragment",
inventory_image = "default_mese_crystal_fragment.png",
})
minetest.register_craftitem("default:clay_brick", {
description = "Clay Brick",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_clay_brick.png",
})
minetest.register_craftitem("default:scorched_stuff", {
description = "Scorched Stuff",
inventory_image = "default_scorched_stuff.png",
})
minetest.register_craftitem("default:obsidian_shard", {
description = "Obsidian Shard",
inventory_image = "default_obsidian_shard.png",
})

View File

@ -0,0 +1,436 @@
-- mods/default/functions.lua
--
-- Sounds
--
function default.node_sound_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.8}
return table
end
function default.node_sound_stone_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_metal_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_metal_footstep", gain = 0.575}
table.dig = table.dig or
{name = "default_metal_footstep", gain = 0.65}
table.dug = table.dug or
{name = "default_metal_footstep", gain = 0.8}
table.place = table.place or
{name = "default_metal_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_dirt_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_gravel_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_sand_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_sand_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_sand_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_sand_footstep", gain = 0.8}
table.place = table.place or
{name = "default_sand_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_wood_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_wood_footstep", gain = 0.625}
table.dig = table.dig or
{name = "default_wood_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_wood_footstep", gain = 0.8}
table.place = table.place or
{name = "default_wood_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_leaves_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_grass_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_grass_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_snow_footstep", gain = 0.8}
table.place = table.place or
{name = "default_snow_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_glass_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.55}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.65}
table.dug = table.dug or
{name = "default_break_glass", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.75}
default.node_sound_defaults(table)
return table
end
--
-- Lavacooling
--
local function cool_wf_vm(pos, node1, node2)
local t1 = os.clock()
local minp = vector.subtract(pos, 10)
local maxp = vector.add(pos, 10)
local manip = minetest.get_voxel_manip()
local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp)
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local stone = minetest.get_content_id(node2)
local lava = minetest.get_content_id(node1)
for i in area:iterp(minp, maxp) do
local p = area:position(i)
if nodes[i] == lava and minetest.find_node_near(p, 1, {"group:water"}) then
nodes[i] = stone
end
end
manip:set_data(nodes)
manip:write_to_map()
-- minetest.log("action", "Lava cooling happened at (" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ").")
local t1 = os.clock()
manip:update_map()
-- minetest.log("action", string.format("Lava cooling updated the map after ca. %.2fs.", os.clock() - t1))
end
local del1 = 0
local count = 0
default.cool_lava_source = function(pos)
minetest.set_node(pos, {name = "default:obsidian"})
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
default.cool_lava_flowing = function(pos)
minetest.set_node(pos, {name = "default:stone"})
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
minetest.register_abm({
nodenames = {"default:lava_flowing"},
neighbors = {"group:water"},
interval = 1,
chance = 2,
action = function(...)
default.cool_lava_flowing(...)
end,
})
minetest.register_abm({
nodenames = {"default:lava_source"},
neighbors = {"group:water"},
interval = 1,
chance = 2,
action = function(...)
default.cool_lava_source(...)
end,
})
--
-- Papyrus and cactus growing
--
-- wrapping the functions in abm action is necessary to make overriding them possible
function default.grow_cactus(pos, node)
if node.param2 >= 4 then
return
end
pos.y = pos.y - 1
local name = minetest.get_node(pos).name --MFF
if minetest.get_item_group(name, "sand") == 0 and name ~= "default:dirt_with_dry_grass" then --MFF
return
end
pos.y = pos.y + 1
local height = 0
while node.name == "default:cactus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
node = minetest.get_node(pos)
end
if height == 4 or node.name ~= "air" then
return
end
minetest.set_node(pos, {name = "default:cactus"})
return true
end
function default.grow_papyrus(pos, node)
pos.y = pos.y - 1
local name = minetest.get_node(pos).name
if name ~= "default:dirt_with_grass" and name ~= "default:dirt" and name ~= "default:sand" and name ~= "default:desert_sand" then --MFF
return
end
if not minetest.find_node_near(pos, 3, {"group:water"}) then
return
end
pos.y = pos.y + 1
local height = 0
while node.name == "default:papyrus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
node = minetest.get_node(pos)
end
if height == 4 or node.name ~= "air" then
return
end
minetest.set_node(pos, {name = "default:papyrus"})
return true
end
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand", "default:dirt_with_dry_grass"}, --MFF
interval = 60,
chance = 25,
action = function(...)
default.grow_cactus(...)
end
})
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass", "default:sand", "default:desert_sand"}, --MFF
interval = 60,
chance = 25,
action = function(...)
default.grow_papyrus(...)
end
})
--
-- dig upwards
--
function default.dig_up(pos, node, digger)
if digger == nil then return end
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
local nn = minetest.get_node(np)
if nn.name == node.name then
minetest.node_dig(np, nn, digger)
end
end
--
-- Leafdecay
--
default.leafdecay_trunk_cache = {}
default.leafdecay_enable_cache = true
-- Spread the load of finding trunks
default.leafdecay_trunk_find_allow_accumulator = 0
minetest.register_globalstep(function(dtime)
local finds_per_second = 5000
default.leafdecay_trunk_find_allow_accumulator =
math.floor(dtime * finds_per_second)
end)
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
node.param2 = 1
minetest.set_node(pos, node)
end
minetest.register_abm({
nodenames = {"group:leafdecay"},
neighbors = {"air", "group:liquid"},
-- A low interval and a high inverse chance spreads the load
interval = 1,
chance = 2,
action = function(p0, node, _, _)
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
local do_preserve = false
local d = minetest.registered_nodes[node.name].groups.leafdecay
if not d or d == 0 then
--print("not groups.leafdecay")
return
end
local n0 = minetest.get_node(p0)
if n0.param2 ~= 0 then
--print("param2 ~= 0")
return
end
local p0_hash = nil
if default.leafdecay_enable_cache then
p0_hash = minetest.hash_node_position(p0)
local trunkp = default.leafdecay_trunk_cache[p0_hash]
if trunkp then
local n = minetest.get_node(trunkp)
local reg = minetest.registered_nodes[n.name]
-- Assume ignore is a trunk, to make the thing
-- work at the border of the active area
if n.name == "ignore" or (reg and reg.groups.tree and
reg.groups.tree ~= 0) then
--print("cached trunk still exists")
return
end
--print("cached trunk is invalid")
-- Cache is invalid
table.remove(default.leafdecay_trunk_cache, p0_hash)
end
end
if default.leafdecay_trunk_find_allow_accumulator <= 0 then
return
end
default.leafdecay_trunk_find_allow_accumulator =
default.leafdecay_trunk_find_allow_accumulator - 1
-- Assume ignore is a trunk, to make the thing
-- work at the border of the active area
local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"})
if p1 then
do_preserve = true
if default.leafdecay_enable_cache then
--print("caching trunk")
-- Cache the trunk
default.leafdecay_trunk_cache[p0_hash] = p1
end
end
if not do_preserve then
-- Drop stuff other than the node itself
local itemstacks = minetest.get_node_drops(n0.name)
for _, itemname in ipairs(itemstacks) do
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
itemname ~= n0.name then
local p_drop = {
x = p0.x - 0.5 + math.random(),
y = p0.y - 0.5 + math.random(),
z = p0.z - 0.5 + math.random(),
}
minetest.add_item(p_drop, itemname)
end
end
-- Remove node
local n = minetest.get_node(p0).name
minetest.remove_node(p0)
minetest.add_item(p0, {name = n})
nodeupdate(p0)
end
end
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if newnode.name ~= "default:torch" or minetest.get_item_group(oldnode.name, "water") == 0 then
return
end
minetest.remove_node(pos, newnode)
minetest.set_node(pos, oldnode)
minetest.add_item(pos, "default:torch")
end)
--
-- Grass growing
--
minetest.register_abm({
nodenames = {"default:dirt"},
interval = 30,
chance = 5,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and
nodedef.liquidtype == "none" and
pos.y >= 0 and
(minetest.get_node_light(above) or 0) >= 12 then
if name == "default:snow" or name == "default:snowblock" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
else
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
end
})
minetest.register_abm({
nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
interval = 2,
chance = 20,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or
nodedef.paramtype == "light") and
nodedef.liquidtype == "none") then
minetest.set_node(pos, {name = "default:dirt"})
end
end
})

View File

@ -0,0 +1,567 @@
--
-- Formspecs
--
local function active_formspec(fuel_percent, item_percent)
local formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
"list[current_name;dst;4.75,0.96;2,2;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
default.get_hotbar_bg(0, 4.25)
return formspec
end
local inactive_formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[current_name;dst;4.75,0.96;2,2;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
default.get_hotbar_bg(0, 4.25)
--
-- Node callback functions that are the same for active and inactive furnace
--
local function can_dig(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", "Furnace is empty")
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end
--
-- Node definitions
--
minetest.register_node("default:furnace", {
description = "Furnace",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_front.png"
},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
})
minetest.register_node("default:furnace_active", {
description = "Furnace",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}
},
paramtype2 = "facedir",
light_source = 8,
drop = "default:furnace",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
})
-- Locked Furnace thanks to kotolegokot:
local function has_locked_furnace_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") and player:get_player_name() ~= minetest.setting_get("name") then
return false
end
return true
end
minetest.register_node("default:furnace_locked", {
description = "Locked Furnace",
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_lock.png"},
paramtype2 = "facedir",
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name())
meta:set_string("infotext", "Locked Furnace (owned by " .. placer:get_player_name() .. ")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", inactive_formspec)
meta:set_string("infotext", "Locked Furnace")
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = can_dig,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_locked_furnace_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked furnace belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos) .. ".")
return 0
end
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_furnace_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked furnace belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos) .. ".")
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_furnace_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked furnace belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos) .. ".")
return 0
end
return stack:get_count()
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in locked furnace at "..minetest.pos_to_string(pos) ..".")
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to locked furnace at "..minetest.pos_to_string(pos) ..".")
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked furnace at "..minetest.pos_to_string(pos) ..".")
end,
})
minetest.register_node("default:furnace_locked_active", {
description = "Locked Furnace (active)",
tiles = {
"default_furnace_top.png",
"default_furnace_bottom.png",
"default_furnace_side.png",
"default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_lock_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1
},
}
},
paramtype2 = "facedir",
light_source = 9,
drop = "default:furnace_locked",
groups = {cracky = 2, not_in_creative_inventory = 1},
sounds = default.node_sound_stone_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name())
meta:set_string("owner", "Locked Furnace (owned by " .. player:get_player_name() .. ")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", inactive_formspec)
meta:set_string("infotext", "Locked Furnace");
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_locked_furnace_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked furnace belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos) .. ".")
return 0
end
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_furnace_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked furnace belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos) .. ".")
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_furnace_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked furnace belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos) .. ".")
return 0
end
return stack:get_count()
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in locked furnace at "..minetest.pos_to_string(pos) .. ".")
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to locked furnace at "..minetest.pos_to_string(pos) .. ".")
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked furnace at "..minetest.pos_to_string(pos) .. ".")
end,
})
--
-- ABM
--
local function swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
minetest.swap_node(pos, node)
end
minetest.register_abm({
nodenames = {"default:furnace", "default:furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
--
-- Inizialize metadata
--
local meta = minetest.get_meta(pos)
local fuel_time = meta:get_float("fuel_time") or 0
local src_time = meta:get_float("src_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
--
-- Inizialize inventory
--
local inv = meta:get_inventory()
for listname, size in pairs({
src = 1,
fuel = 1,
dst = 4,
}) do
if inv:get_size(listname) ~= size then
inv:set_size(listname, size)
end
end
local srclist = inv:get_list("src")
local fuellist = inv:get_list("fuel")
local dstlist = inv:get_list("dst")
--
-- Cooking
--
-- Check if we have cookable content
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cookable = true
if cooked.time == 0 then
cookable = false
end
-- Check if we have enough fuel to burn
if fuel_time < fuel_totaltime then
-- The furnace is currently active and has enough fuel
fuel_time = fuel_time + 1
-- If there is a cookable item then check if it is ready yet
if cookable then
src_time = src_time + 1
if src_time >= cooked.time then
-- Place result in dst list if possible
if inv:room_for_item("dst", cooked.item) then
inv:add_item("dst", cooked.item)
inv:set_stack("src", 1, aftercooked.items[1])
src_time = 0
end
end
end
else
-- Furnace ran out of fuel
if cookable then
-- We need to get new fuel
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
if fuel.time == 0 then
-- No valid fuel in fuel list
fuel_totaltime = 0
fuel_time = 0
src_time = 0
else
-- Take fuel from fuel list
inv:set_stack("fuel", 1, afterfuel.items[1])
fuel_totaltime = fuel.time
fuel_time = 0
end
else
-- We don't need to get new fuel since there is no cookable item
fuel_totaltime = 0
fuel_time = 0
src_time = 0
end
end
--
-- Update formspec, infotext and node
--
local formspec = inactive_formspec
local item_state = ""
local item_percent = 0
if cookable then
item_percent = math.floor(src_time / cooked.time * 100)
item_state = item_percent .. "%"
else
if srclist[1]:is_empty() then
item_state = "Empty"
else
item_state = "Not cookable"
end
end
local fuel_state = "Empty"
local active = "inactive "
if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then
active = "active "
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
fuel_state = fuel_percent .. "%"
formspec = active_formspec(fuel_percent, item_percent)
swap_node(pos, "default:furnace_active")
else
if not fuellist[1]:is_empty() then
fuel_state = "0%"
end
swap_node(pos, "default:furnace")
end
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
--
-- Set meta values
--
meta:set_float("fuel_totaltime", fuel_totaltime)
meta:set_float("fuel_time", fuel_time)
meta:set_float("src_time", src_time)
meta:set_string("formspec", formspec)
meta:set_string("infotext", infotext)
end,
})
minetest.register_abm({
nodenames = {"default:furnace_locked","default:furnace_locked_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
for i, name in ipairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time"
}) do
if meta:get_string(name) == "" then
meta:set_float(name, 0.0)
end
end
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local cooked = nil
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
meta:set_float("src_time", meta:get_float("src_time") + 1)
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
-- check if there's room for output in "dst" list
if inv:room_for_item("dst",cooked.item) then
-- Put result in "dst" list
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
local srcstack = inv:get_stack("src", 1)
srcstack:take_item()
inv:set_stack("src", 1, srcstack)
else
-- print("Could not insert " .. cooked.item .. ".")
end
meta:set_string("src_time", 0)
end
end
local item_percent = 0
if cooked then
item_percent = meta:get_float("src_time") * 100 / cooked.time
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Furnace active: " .. percent .. " % (owned by "..meta:get_string("owner") .. ")")
swap_node(pos,"default:furnace_locked_active")
meta:set_string("formspec", active_formspec(percent, item_percent))
return
end
local fuel = nil
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
if fuellist then
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
if fuel.time <= 0 then
meta:set_string("infotext","Locked Furnace is out of fuel (owned by "..meta:get_string("owner")..")")
swap_node(pos,"default:furnace_locked")
meta:set_string("formspec", inactive_formspec)
return
end
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext","Locked Furnace is empty (owned by "..meta:get_string("owner")..")")
swap_node(pos,"default:furnace_locked")
meta:set_string("formspec", inactive_formspec)
end
return
end
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
local stack = inv:get_stack("fuel", 1)
stack:take_item()
inv:set_stack("fuel", 1, stack)
end,
})

View File

@ -0,0 +1,148 @@
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
default = {} -- Definitions made by this mod are usable by all mods.
-- The API documentation in here was moved into game_api.txt
-- Definitions made by this mod that other mods can use too
default = {}
default.LIGHT_MAX = 14
-- GUI related stuff
default.gui_bg = "bgcolor[#080808BB;true]"
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
default.gui_slots = "listcolors[#606060AA;#808080;#101010;#202020;#FFF]"
function default.get_hotbar_bg(x,y)
local out = ""
for i=0,7,1 do
out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
end
return out
end
default.gui_survival_form = "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
default.get_hotbar_bg(0,4.25)..
default.get_hotbar_bg(0,5.25)
-- Load files
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/commands.lua")
dofile(minetest.get_modpath("default").."/nodes.lua")
dofile(minetest.get_modpath("default").."/furnace.lua")
dofile(minetest.get_modpath("default").."/tools.lua")
dofile(minetest.get_modpath("default").."/craftitems.lua")
dofile(minetest.get_modpath("default").."/crafting.lua")
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/player.lua")
dofile(minetest.get_modpath("default").."/trees.lua")
dofile(minetest.get_modpath("default").."/aliases.lua")
dofile(minetest.get_modpath("default").."/legacy.lua")
-- Code below by Casimir.
local function count_items()
local i = 0
local number = 0
for name, item in pairs(minetest.registered_items) do
if (name and name ~= "") then
number = number + 1
end
i = i + 1
end
minetest.log("action", "There are " .. number .. " registered nodes, items and tools.")
end
local function player_join_sounds()
minetest.register_on_joinplayer(function()
minetest.sound_play("player_join", {gain = 0.75})
end)
end
local function player_leave_sounds()
minetest.register_on_leaveplayer(function()
minetest.sound_play("player_leave", {gain = 1})
end)
end
minetest.after(1, count_items)
minetest.after(5, player_join_sounds)
minetest.after(5, player_leave_sounds)
hotbar_size = minetest.setting_get("hotbar_size") or 16
minetest.register_on_joinplayer(function(player)
player:set_physics_override({
sneak_glitch = false, -- Climable blocks are quite fast in Carbone.
})
player:hud_set_hotbar_itemcount(hotbar_size)
end)
minetest.register_on_respawnplayer(function(player)
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
local pos = player:getpos()
-- minetest.sound_play("player_join", {pos = pos, gain = 0.5})
end)
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if user:get_hp() >= 20 then return end
local pos = user:getpos()
minetest.sound_play("health_gain", {pos = pos, gain = 0.4})
end)
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
if minetest.setting_getbool("creative_mode") then
minetest.log("action", "Creative mode is enabled.")
else
minetest.log("action", "Creative mode is disabled.")
end
if minetest.setting_getbool("enable_damage") then
minetest.log("action", "Damage is enabled.")
else
minetest.log("action", "Damage is disabled.")
end
if minetest.setting_getbool("enable_pvp") then
minetest.log("action", "PvP is enabled.")
else
minetest.log("action", "PvP is disabled.")
end
if not minetest.is_singleplayer() and minetest.setting_getbool("server_announce") then
minetest.log("action", "") -- Empty line.
minetest.log("action", "Server name: " .. minetest.setting_get("server_name") or "(none)")
minetest.log("action", "Server description: " .. minetest.setting_get("server_description") or "(none)")
minetest.log("action", "Server URL: " .. minetest.setting_get("server_address") or "(none)")
minetest.log("action", "MOTD: " .. minetest.setting_get("motd") or "(none)")
minetest.log("action", "Maximum users: " .. minetest.setting_get("max_users") or 15)
end
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
-- Reserved slot handling:
minetest.register_on_prejoinplayer(function(name, ip)
if #minetest.get_connected_players() >= (minetest.setting_get("max_users") - 2)
and not minetest.check_player_privs(name, {server = true}) then
return "Sorry, 2 slots are reserved for administrators."
end
end)
if minetest.setting_getbool("log_mods") then
-- Highlight the default mod in the mod loading logs:
minetest.log("action", "Carbone: * [default] loaded.")
end

View File

@ -0,0 +1,25 @@
-- mods/default/legacy.lua
-- Horrible crap to support old code registering falling nodes
-- Don't use this and never do what this does, it's completely wrong!
-- (More specifically, the client and the C++ code doesn't get the group)
function default.register_falling_node(nodename, texture)
minetest.log("error", debug.traceback())
minetest.log('error', "WARNING: default.register_falling_node is deprecated")
if minetest.registered_nodes[nodename] then
minetest.registered_nodes[nodename].groups.falling_node = 1
end
end
function default.spawn_falling_node(p, nodename)
spawn_falling_node(p, nodename)
end
-- Liquids
WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha
WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity
LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity
LIGHT_MAX = default.LIGHT_MAX
-- Formspecs
default.gui_suvival_form = default.gui_survival_form

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,159 @@
-- Minetest 0.4 mod: player
-- See README.txt for licensing and other information.
-- Player animation blending
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
local animation_blend = 0
default.registered_player_models = { }
-- Local for speed.
local models = default.registered_player_models
function default.player_register_model(name, def)
models[name] = def
end
-- Default player appearance
default.player_register_model("character.b3d", {
animation_speed = 30,
textures = {"character.png", },
animations = {
-- Standard animations.
stand = { x= 0, y= 79, },
lay = { x=162, y=166, },
walk = { x=168, y=187, },
mine = { x=189, y=198, },
walk_mine = { x=200, y=219, },
-- Extra animations (not currently used by the game).
sit = { x= 81, y=160, },
},
})
-- Player stats and animations
local player_model = {}
local player_textures = {}
local player_anim = {}
local player_sneak = {}
default.player_attached = {}
function default.player_get_animation(player)
local name = player:get_player_name()
return {
model = player_model[name],
textures = player_textures[name],
animation = player_anim[name],
}
end
-- Called when a player's appearance needs to be updated
function default.player_set_model(player, model_name)
local name = player:get_player_name()
local model = models[model_name]
if model then
if player_model[name] == model_name then
return
end
player:set_properties({
mesh = model_name,
textures = player_textures[name] or model.textures,
visual = "mesh",
visual_size = model.visual_size or {x=1, y=1},
})
default.player_set_animation(player, "stand")
else
player:set_properties({
textures = { "player.png", "player_back.png", },
visual = "upright_sprite",
})
end
player_model[name] = model_name
end
function default.player_set_textures(player, textures)
local name = player:get_player_name()
player_textures[name] = textures
player:set_properties({textures = textures,})
end
function default.player_set_animation(player, anim_name, speed)
local name = player:get_player_name()
if player_anim[name] == anim_name then
return
end
local model = player_model[name] and models[player_model[name]]
if not (model and model.animations[anim_name]) then
return
end
local anim = model.animations[anim_name]
player_anim[name] = anim_name
player:set_animation(anim, speed or model.animation_speed, animation_blend)
end
-- Update appearance when the player joins
minetest.register_on_joinplayer(function(player)
default.player_attached[player:get_player_name()] = false
default.player_set_model(player, "character.b3d")
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI
if not minetest.setting_getbool("creative_mode") then
player:set_inventory_formspec(default.gui_survival_form)
end
player:hud_set_hotbar_image("gui_hotbar.png")
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
player_model[name] = nil
player_anim[name] = nil
player_textures[name] = nil
end)
-- Localize for better performance.
local player_set_animation = default.player_set_animation
local player_attached = default.player_attached
-- Check each player and apply animations
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local model_name = player_model[name]
local model = model_name and models[model_name]
if model and not player_attached[name] then
local controls = player:get_player_control()
local walking = false
local animation_speed_mod = model.animation_speed or 30
-- Determine if the player is walking
if controls.up or controls.down or controls.left or controls.right then
walking = true
end
-- Determine if the player is sneaking, and reduce animation speed if so
if controls.sneak then
animation_speed_mod = animation_speed_mod / 2
end
-- Apply animations based on what the player is doing
if player:get_hp() == 0 then
player_set_animation(player, "lay")
elseif walking then
if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil
player_sneak[name] = controls.sneak
end
if controls.LMB then
player_set_animation(player, "walk_mine", animation_speed_mod)
else
player_set_animation(player, "walk", animation_speed_mod)
end
elseif controls.LMB then
player_set_animation(player, "mine")
else
player_set_animation(player, "stand", animation_speed_mod)
end
end
end
end)

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