Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
url = https://gitlab.icynet.eu/evert/fluid_lib.git
[submodule "mods/fromscratch"]
path = mods/fromscratch
url = https://github.com/Quent42340/FromScratch.git
url = https://github.com/programmerjake/FromScratch
[submodule "mods/hopper"]
path = mods/hopper
url = https://github.com/minetest-mods/hopper
Expand Down Expand Up @@ -55,3 +55,6 @@
[submodule "mods/3d_armor"]
path = mods/3d_armor
url = https://github.com/stujones11/minetest-3d_armor
[submodule "mods/moreores"]
path = mods/moreores
url = https://github.com/minetest-mods/moreores.git
2 changes: 1 addition & 1 deletion mods/elepower
Submodule elepower updated from 0e5662 to 6eb44a
2 changes: 1 addition & 1 deletion mods/fromscratch
1 change: 0 additions & 1 deletion mods/minetest_game
Submodule minetest_game deleted from 04f3f6
22 changes: 22 additions & 0 deletions mods/minetest_game/.luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
unused_args = false
allow_defined_top = true

read_globals = {
"DIR_DELIM",
"minetest", "core",
"dump",
"vector",
"VoxelManip", "VoxelArea",
"PseudoRandom", "PcgRandom",
"ItemStack",
"Settings",
"unpack",
-- Silence errors about custom table methods.
table = { fields = { "copy", "indexof" } }
}

-- Overwrites minetest.handle_node_drops
files["mods/creative/init.lua"].globals = { "minetest" }

-- Don't report on legacy definitions of globals.
files["mods/default/legacy.lua"].global = false
12 changes: 12 additions & 0 deletions mods/minetest_game/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: generic
sudo: false
addons:
apt:
packages:
- luarocks
before_install:
- luarocks install --local luacheck
script:
- $HOME/.luarocks/bin/luacheck --no-color ./mods
notifications:
email: false
519 changes: 519 additions & 0 deletions mods/minetest_game/LICENSE.txt

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions mods/minetest_game/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Minetest Game [minetest_game]
=============================
The main game for the Minetest engine
=====================================

To use this game with the Minetest engine, insert this repository as
/games/minetest_game

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 the Minetest engine.

Additionally, when the Minetest engine is tagged to be a certain version (eg.
0.4.10), Minetest Game is tagged with the version too.

When stable releases are made, Minetest Game is packaged and made available in
http://minetest.net/downloads/
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!)

Licensing
---------

See LICENSE.txt
30 changes: 30 additions & 0 deletions mods/minetest_game/beds/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Minetest Game mod: beds
=======================
See license.txt for license information.

Authors of source code
----------------------
Originally by BlockMen (MIT)
Various Minetest developers and contributors (MIT)

Authors of media (textures)
---------------------------
BlockMen (CC BY-SA 3.0)
All textures unless otherwise noted

TumeniNodes (CC BY-SA 3.0)
beds_bed_under.png

This mod adds a bed to Minetest which allows to skip the night.
To sleep, rightclick the bed. If playing in singleplayer mode the night gets skipped
immediately. If playing multiplayer you get shown how many other players are in bed too,
if all players are sleeping the night gets skipped. The night skip can be forced if more
than 50% of the players are lying in bed and use this option.

Another feature is a controlled respawning. If you have slept in bed (not just lying in
it) your respawn point is set to the beds location and you will respawn there after
death.
You can disable the respawn at beds by setting "enable_bed_respawn = false" in
minetest.conf.
You can disable the night skip feature by setting "enable_bed_night_skip = false" in
minetest.conf or by using the /set command in-game.
180 changes: 180 additions & 0 deletions mods/minetest_game/beds/api.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@

local reverse = true

local function destruct_bed(pos, n)
local node = minetest.get_node(pos)
local other

if n == 2 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.subtract(pos, dir)
elseif n == 1 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.add(pos, dir)
end

if reverse then
reverse = not reverse
minetest.remove_node(other)
minetest.check_for_falling(other)
else
reverse = not reverse
end
end

function beds.register_bed(name, def)
minetest.register_node(name .. "_bottom", {
description = def.description,
inventory_image = def.inventory_image,
wield_image = def.wield_image,
drawtype = "nodebox",
tiles = def.tiles.bottom,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
stack_max = 1,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = def.sounds or default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.bottom,
},
selection_box = {
type = "fixed",
fixed = def.selectionbox,
},

on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end

local pos
if udef and udef.buildable_to then
pos = under
else
pos = pointed_thing.above
end

local player_name = placer and placer:get_player_name() or ""

if minetest.is_protected(pos, player_name) and
not minetest.check_player_privs(player_name, "protection_bypass") then
minetest.record_protection_violation(pos, player_name)
return itemstack
end

local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
if not node_def or not node_def.buildable_to then
return itemstack
end

local dir = placer and placer:get_look_dir() and
minetest.dir_to_facedir(placer:get_look_dir()) or 0
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))

if minetest.is_protected(botpos, player_name) and
not minetest.check_player_privs(player_name, "protection_bypass") then
minetest.record_protection_violation(botpos, player_name)
return itemstack
end

local botdef = minetest.registered_nodes[minetest.get_node(botpos).name]
if not botdef or not botdef.buildable_to then
return itemstack
end

minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})

if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
itemstack:take_item()
end
return itemstack
end,

on_destruct = function(pos)
destruct_bed(pos, 1)
end,

on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
beds.on_rightclick(pos, clicker)
return itemstack
end,

on_rotate = function(pos, node, user, mode, new_param2)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
local node2 = minetest.get_node_or_nil(p)
if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or
not node.param2 == node2.param2 then
return false
end
if minetest.is_protected(p, user:get_player_name()) then
minetest.record_protection_violation(p, user:get_player_name())
return false
end
if mode ~= screwdriver.ROTATE_FACE then
return false
end
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
local node3 = minetest.get_node_or_nil(newp)
local node_def = node3 and minetest.registered_nodes[node3.name]
if not node_def or not node_def.buildable_to then
return false
end
if minetest.is_protected(newp, user:get_player_name()) then
minetest.record_protection_violation(newp, user:get_player_name())
return false
end
node.param2 = new_param2
-- do not remove_node here - it will trigger destroy_bed()
minetest.set_node(p, {name = "air"})
minetest.set_node(pos, node)
minetest.set_node(newp, {name = name .. "_top", param2 = new_param2})
return true
end,
can_dig = function(pos, player)
return beds.can_dig(pos)
end,
})

minetest.register_node(name .. "_top", {
drawtype = "nodebox",
tiles = def.tiles.top,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
pointable = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = def.sounds or default.node_sound_wood_defaults(),
drop = name .. "_bottom",
node_box = {
type = "fixed",
fixed = def.nodebox.top,
},
on_destruct = function(pos)
destruct_bed(pos, 2)
end,
can_dig = function(pos, player)
local node = minetest.get_node(pos)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
return beds.can_dig(p)
end,
})

minetest.register_alias(name, name .. "_bottom")

minetest.register_craft({
output = name,
recipe = def.recipe
})
end
Loading