Compare commits

...

5 Commits

Author SHA1 Message Date
Robert Zenz db48373b95 Added /suicide command. 2016-01-21 00:02:59 +01:00
Robert Zenz bb03a0bd11 Fixed flooding of caves and the ocean. 2016-01-20 23:54:34 +01:00
Robert Zenz dcc580b447 Fixed surface detection. 2016-01-20 23:54:20 +01:00
Robert Zenz d69299d016 Fixed order of nodes. 2016-01-18 23:20:22 +01:00
Robert Zenz ee15dd4ff8 Updated dependencies. 2016-01-17 13:08:42 +01:00
7 changed files with 81 additions and 39 deletions

2
deps/utils vendored

@ -1 +1 @@
Subproject commit 3b1e374bc1db5f92b6888b95aeac2799e88f5122
Subproject commit c77eb02c4388e8667ae1670e7e126ce18d7ac8d1

2
deps/worldgen-utils vendored

@ -1 +1 @@
Subproject commit ab829d21b5a0bc571690337adbe373a83d69c6c4
Subproject commit 10a4fdbad38305b977ace3b1eb5600ac41b37f0e

19
doc/chatcommands.markdown Normal file
View File

@ -0,0 +1,19 @@
Australopithecus - Chat commands
================================
1. What is a chat command?
--------------------------
A chat command is a command which can be executed by pressing `/` and typing
the command.
2. Commands
-----------
### 2.1 /suicide
Commits suicide, which means that the health is set to 0, which leads to instant
death.

View File

@ -0,0 +1,37 @@
--[[
Australopithecus, a game for Minetest.
Copyright (C) 2016, Robert 'Bobby' Zenz
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
--]]
minetest.register_chatcommand("suicide", {
description = "Commit suicide.",
params = "",
func = function(player_name, params)
if not settings.get_bool("enable_damage", true) then
return false, "Damage is disabled."
end
local player = minetest.get_player_by_name(player_name)
player:set_hp(0)
return true
end
})

View File

@ -1031,11 +1031,6 @@ ap.core.helpers.register_wood = function(name, prototype)
log_definition = tableutil.clone(log_definition)
log_definition.groups.simple_wallmounted = nil
register_corners(log_definition)
register_plates(log_definition)
register_ramps(log_definition)
register_stairs(log_definition)
local planks_name = postfix_name(name, "planks")
local planks_definition = {
description = make_description(planks_name),
@ -1052,15 +1047,20 @@ ap.core.helpers.register_wood = function(name, prototype)
register_node(planks_definition)
ap.core.artisanry:register("Blocks", "core:" .. planks_name, {
{ "core:" .. log_name }
})
register_corners(log_definition)
register_plates(log_definition)
register_ramps(log_definition)
register_stairs(log_definition)
register_corners(planks_definition)
register_plates(planks_definition)
register_pyramids(planks_definition)
register_pyramids_stepped(planks_definition)
register_ramps(planks_definition)
register_stairs(planks_definition)
ap.core.artisanry:register("Blocks", "core:" .. planks_name, {
{ "core:" .. log_name }
})
end

View File

@ -37,6 +37,7 @@ dofile(base_path .. "/helpers/helpers.lua")
dofile(base_path .. "/helpers/nodes.lua")
-- Main files
dofile(base_path .. "/chatcommands.lua")
dofile(base_path .. "/debug.lua")
dofile(base_path .. "/nodes.lua")
dofile(base_path .. "/setup.lua")

View File

@ -255,11 +255,12 @@ ap.mapgen.crust:register("baking.surface-detection", function(constructor)
return metadata.heightmap_range.max >= minp.y
and maxp.y >= module.params.ocean_level
and maxp.y >= (metadata.heightmap_range.min - module.params.max_depth)
end)
constructor:set_run_2d(function(module, metadata, manipulator, x, z)
-- The +1 -1 is for overshooting our range, this fixes that the surface
-- is not correctly detected on block borders.
for y = metadata.maxp.y + 1, metadata.minp.y - 1, -1 do
for y = metadata.maxp.y + 16, math.max(metadata.minp.y - 16, metadata.heightmap_range.min - module.params.max_depth), -1 do
local current_node = manipulator:get_node(x, z, y)
if current_node == module.nodes.ignore then
@ -471,41 +472,25 @@ ap.mapgen.crust:register("baking.ramps", function(constructor)
end)
ap.mapgen.crust:register("baking.ocean", function(constructor)
constructor:add_param("cave_flood_depth", 23)
constructor:add_param("max_depth", 47 + 3)
constructor:add_param("cave_flood_depth", 73)
constructor:add_param("ocean_level", -58)
constructor:require_node("air", "air")
constructor:set_condition(function(module, metadata, minp, maxp)
return minp.y <= (module.params.ocean_level - module.params.cave_flood_depth)
and maxp.y >= (metadata.heightmap_range.min - module.params.max_depth)
return minp.y <= module.params.ocean_level
and maxp.y >= (metadata.heightmap_range.min - module.params.cave_flood_depth)
end)
constructor:set_run_2d(function(module, metadata, manipulator, x, z)
local current_height = metadata.surfacemap[x][z] or metadata.heightmap[x][z]
if current_height <= module.params.ocean_level then
local biome = metadata.biomes[x][z]
metadata.current_biome = metadata.biomes[x][z]
metadata.current_height = metadata.surfacemap[x][z] or metadata.heightmap[x][z]
end)
constructor:set_run_3d(function(module, metadata, manipulator, x, z, y)
if y <= module.params.ocean_level
and y >= (metadata.current_height - module.params.cave_flood_depth)
and manipulator:get_node(x, z, y) == module.nodes.air then
-- Main operation for flodding everything with water.
for y = metadata.maxp.y, math.max(metadata.minp.y, current_height), -1 do
if manipulator:get_node(x, z, y) == module.nodes.air then
if y == module.params.ocean_level then
manipulator:set_node(x, z, y, biome.nodes.water_surface)
elseif y <= module.params.ocean_level then
manipulator:set_node(x, z, y, biome.nodes.water_subsurface)
end
end
end
-- Now we will flood the caves below us.
if current_height > metadata.minp.y then
for y = current_height, math.max(metadata.minp.y, current_height - module.params.cave_flood_depth), -1 do
if manipulator:get_node(x, z, y) == module.nodes.air then
manipulator:set_node(x, z, y, biome.nodes.water_subsurface)
end
end
end
manipulator:set_node(x, z, y, metadata.current_biome.nodes.water_subsurface)
end
end)
end)