mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-22 23:58:48 -05:00
Merge remote branch 'origin/master'
This commit is contained in:
commit
feb7de91ec
1
.gitignore
vendored
1
.gitignore
vendored
@ -37,6 +37,7 @@ src/jthread/Makefile
|
||||
src/jthread/cmake_config.h
|
||||
src/jthread/cmake_install.cmake
|
||||
src/jthread/libjthread.a
|
||||
src/json/libjson.a
|
||||
src/lua/build/
|
||||
src/lua/CMakeFiles/
|
||||
src/cguittfont/CMakeFiles/
|
||||
|
@ -12,7 +12,7 @@ set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||
# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH 5)
|
||||
set(VERSION_PATCH 6)
|
||||
if(VERSION_EXTRA)
|
||||
set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA})
|
||||
endif()
|
||||
@ -144,6 +144,18 @@ if(EXISTS ${MINETEST_GAME_SOURCE} AND IS_DIRECTORY ${MINETEST_GAME_SOURCE})
|
||||
install(FILES ${MINETEST_GAME_SOURCE}/README.txt DESTINATION "${SHAREDIR}/games/minetest_game/")
|
||||
install(DIRECTORY ${MINETEST_GAME_SOURCE}/mods DESTINATION "${SHAREDIR}/games/minetest_game")
|
||||
endif()
|
||||
set(MINETEST_BUILD_GAME_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/games/build")
|
||||
if(EXISTS ${MINETEST_BUILD_GAME_SOURCE} AND IS_DIRECTORY ${MINETEST_BUILD_GAME_SOURCE})
|
||||
install(FILES ${MINETEST_BUILD_GAME_SOURCE}/game.conf DESTINATION "${SHAREDIR}/games/build/")
|
||||
install(FILES ${MINETEST_BUILD_GAME_SOURCE}/README.txt DESTINATION "${SHAREDIR}/games/build/")
|
||||
install(DIRECTORY ${MINETEST_BUILD_GAME_SOURCE}/mods DESTINATION "${SHAREDIR}/games/build")
|
||||
endif()
|
||||
set(MINETEST_SURVIVAL_GAME_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/games/survival")
|
||||
if(EXISTS ${MINETEST_SURVIVAL_GAME_SOURCE} AND IS_DIRECTORY ${MINETEST_SURVIVAL_GAME_SOURCE})
|
||||
install(FILES ${MINETEST_SURVIVAL_GAME_SOURCE}/game.conf DESTINATION "${SHAREDIR}/games/survival/")
|
||||
install(FILES ${MINETEST_SURVIVAL_GAME_SOURCE}/README.txt DESTINATION "${SHAREDIR}/games/survival/")
|
||||
install(DIRECTORY ${MINETEST_SURVIVAL_GAME_SOURCE}/mods DESTINATION "${SHAREDIR}/games/survival")
|
||||
endif()
|
||||
if(BUILD_CLIENT)
|
||||
#install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/sounds/base/pack" DESTINATION "${SHAREDIR}/sounds/base")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base")
|
||||
|
@ -665,3 +665,23 @@ minetest.register_chatcommand("clearobjects", {
|
||||
minetest.chat_send_all("*** Cleared all objects.")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("msg", {
|
||||
params = "<name> <message>",
|
||||
description = "Send a private message",
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
local found, _, sendto, message = param:find("^([^%s]+)%s(.+)$")
|
||||
if found then
|
||||
if minetest.env:get_player_by_name(sendto) then
|
||||
minetest.log("action", "PM from "..name.." to "..sendto..": "..message)
|
||||
minetest.chat_send_player(sendto, "PM from "..name..": "..message)
|
||||
minetest.chat_send_player(name, "Message sent")
|
||||
else
|
||||
minetest.chat_send_player(name, "The player "..sendto.." is not online")
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "Invalid usage, see /help msg")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -142,7 +142,7 @@ end
|
||||
-- Some common functions
|
||||
--
|
||||
|
||||
function nodeupdate_single(p)
|
||||
function nodeupdate_single(p, delay)
|
||||
n = minetest.env:get_node(p)
|
||||
if minetest.get_node_group(n.name, "falling_node") ~= 0 then
|
||||
p_bottom = {x=p.x, y=p.y-1, z=p.z}
|
||||
@ -151,9 +151,13 @@ function nodeupdate_single(p)
|
||||
if minetest.registered_nodes[n_bottom.name] and
|
||||
(not minetest.registered_nodes[n_bottom.name].walkable or
|
||||
minetest.registered_nodes[n_bottom.name].buildable_to) then
|
||||
minetest.env:remove_node(p)
|
||||
spawn_falling_node(p, n.name)
|
||||
nodeupdate(p)
|
||||
if delay then
|
||||
minetest.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
|
||||
else
|
||||
minetest.env:remove_node(p)
|
||||
spawn_falling_node(p, n.name)
|
||||
nodeupdate(p)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -174,8 +178,7 @@ function nodeupdate(p)
|
||||
for x = -1,1 do
|
||||
for y = -1,1 do
|
||||
for z = -1,1 do
|
||||
p2 = {x=p.x+x, y=p.y+y, z=p.z+z}
|
||||
nodeupdate_single(p2)
|
||||
nodeupdate_single({x=p.x+x, y=p.y+y, z=p.z+z}, not (x==0 and y==0 and z==0))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -103,6 +103,10 @@ function minetest.register_item(name, itemdef)
|
||||
|
||||
-- Apply defaults and add to registered_* table
|
||||
if itemdef.type == "node" then
|
||||
-- Use the nodebox as selection box if it's not set manually
|
||||
if itemdef.drawtype == "nodebox" and not itemdef.selection_box then
|
||||
itemdef.selection_box = itemdef.node_box
|
||||
end
|
||||
setmetatable(itemdef, {__index = minetest.nodedef_default})
|
||||
minetest.registered_nodes[itemdef.name] = itemdef
|
||||
elseif itemdef.type == "craft" then
|
||||
@ -249,8 +253,8 @@ minetest.register_item(":unknown", {
|
||||
|
||||
minetest.register_node(":air", {
|
||||
description = "Air (you hacker you!)",
|
||||
inventory_image = "unknown_block.png",
|
||||
wield_image = "unknown_block.png",
|
||||
inventory_image = "unknown_node.png",
|
||||
wield_image = "unknown_node.png",
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
@ -265,8 +269,8 @@ minetest.register_node(":air", {
|
||||
|
||||
minetest.register_node(":ignore", {
|
||||
description = "Ignore (you hacker you!)",
|
||||
inventory_image = "unknown_block.png",
|
||||
wield_image = "unknown_block.png",
|
||||
inventory_image = "unknown_node.png",
|
||||
wield_image = "unknown_node.png",
|
||||
drawtype = "airlike",
|
||||
paramtype = "none",
|
||||
sunlight_propagates = false,
|
||||
|
@ -1,5 +1,5 @@
|
||||
Minetest Lua Modding API Reference 0.4.5
|
||||
==========================================
|
||||
Minetest Lua Modding API Reference 0.4.6
|
||||
========================================
|
||||
More information at http://c55.me/minetest/
|
||||
|
||||
Introduction
|
||||
@ -1185,7 +1185,21 @@ methods:
|
||||
- get_perlin(seeddiff, octaves, persistence, scale)
|
||||
^ Return world-specific perlin noise (int(worldseed)+seeddiff)
|
||||
- clear_objects()
|
||||
^ clear all objects in the environments
|
||||
^ clear all objects in the environments
|
||||
- line_of_sight(pos1,pos2,stepsize) ->true/false
|
||||
^ checkif there is a direct line of sight between pos1 and pos2
|
||||
^ pos1 First position
|
||||
^ pos2 Second position
|
||||
^ stepsize smaller gives more accurate results but requires more computing
|
||||
time. Default is 1.
|
||||
-find_path(pos1,pos2,searchdistance,max_jump,max_drop,algorithm) -> table containing path
|
||||
^ returns a table of 3d points representing a path from pos1 to pos2 or nil
|
||||
^ pos1: start position
|
||||
^ pos2: end position
|
||||
^ searchdistance: number of blocks to search in each direction
|
||||
^ max_jump: maximum height difference to consider walkable
|
||||
^ max_drop: maximum height difference to consider droppable
|
||||
^ algorithm: A*_noprefetch(default), A*, Dijkstra
|
||||
- spawn_tree (pos, {treedef})
|
||||
^ spawns L-System tree at given pos with definition in treedef table
|
||||
treedef={
|
||||
@ -1348,6 +1362,10 @@ Player-only: (no-op for other objects)
|
||||
{jump=bool,right=bool,left=bool,LMB=bool,RMB=bool,sneak=bool,aux1=bool,down=bool,up=bool}
|
||||
- get_player_control_bits(): returns integer with bit packed player pressed keys
|
||||
bit nr/meaning: 0/up ,1/down ,2/left ,3/right ,4/jump ,5/aux1 ,6/sneak ,7/LMB ,8/RMB
|
||||
- set_physics_override(speed, jump, gravity)
|
||||
modifies per-player walking speed, jump height, and gravity.
|
||||
Values default to 1 and act as offsets to the physics settings
|
||||
in minetest.conf. nil will keep the current setting.
|
||||
|
||||
InvRef: Reference to an inventory
|
||||
methods:
|
||||
@ -1585,6 +1603,7 @@ Node definition (register_node)
|
||||
damage_per_second = 0, -- If player is inside node, this damage is caused
|
||||
node_box = {type="regular"}, -- See "Node boxes"
|
||||
selection_box = {type="regular"}, -- See "Node boxes"
|
||||
^ If drawtype "nodebox" is used and selection_box is nil, then node_box is used
|
||||
legacy_facedir_simple = false, -- Support maps made in and before January 2012
|
||||
legacy_wallmounted = false, -- Support maps made in and before January 2012
|
||||
sounds = {
|
||||
|
@ -1588,99 +1588,6 @@ minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
|
||||
minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
|
||||
minetest.register_alias("mapgen_mese", "default:mese")
|
||||
|
||||
minetest.register_biome_groups({
|
||||
0.35, 0.10, 0.30
|
||||
})
|
||||
|
||||
--
|
||||
-- Register the biomes for the map generator
|
||||
--
|
||||
minetest.register_biome({
|
||||
group_id = 0,
|
||||
name = "Ocean",
|
||||
terrain_type = "liquid",
|
||||
node_top = "default:gravel",
|
||||
node_filler = "default:stone",
|
||||
num_top_nodes = 4,
|
||||
height_min = -3000,
|
||||
height_max = 3000,
|
||||
heat_min = -20.0,
|
||||
heat_max = 100.0,
|
||||
humidity_min = 0.0,
|
||||
humidity_max = 100.0,
|
||||
scale = 10.0,
|
||||
offset = -10.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
group_id = 1,
|
||||
name = "Beach",
|
||||
terrain_type = "normal",
|
||||
node_top = "default:sand",
|
||||
node_filler = "default:stone",
|
||||
num_top_nodes = 5,
|
||||
height_min = -3000,
|
||||
height_max = 3000,
|
||||
heat_min = 5.0,
|
||||
heat_max = 100.0,
|
||||
humidity_min = 0.0,
|
||||
humidity_max = 100.0,
|
||||
scale = 5.0,
|
||||
offset = 5.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
group_id = 1,
|
||||
name = "Gravel Beach",
|
||||
terrain_type = "normal",
|
||||
node_top = "default:gravel",
|
||||
node_filler = "default:cobble",
|
||||
num_top_nodes = 5,
|
||||
height_min = -3000,
|
||||
height_max = 3000,
|
||||
heat_min = -50.0,
|
||||
heat_max = 5.0,
|
||||
humidity_min = 0.0,
|
||||
humidity_max = 100.0,
|
||||
scale = 5.0,
|
||||
offset = 5.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
group_id = 2,
|
||||
name = "Land",
|
||||
terrain_type = "normal",
|
||||
node_top = "default:dirt_with_grass",
|
||||
node_filler = "default:stone",
|
||||
num_top_nodes = 5,
|
||||
height_min = -3000,
|
||||
height_max = 3000,
|
||||
heat_min = -50.0,
|
||||
heat_max = 100.0,
|
||||
humidity_min = 0.0,
|
||||
humidity_max = 100.0,
|
||||
scale = 12.0,
|
||||
offset = 20.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
group_id = 3,
|
||||
name = "Hills",
|
||||
terrain_type = "normal",
|
||||
node_top = "default:dirt",
|
||||
node_filler = "default:stone",
|
||||
num_top_nodes = 3,
|
||||
height_min = -3000,
|
||||
height_max = 3000,
|
||||
heat_min = -50.0,
|
||||
heat_max = 100.0,
|
||||
humidity_min = 0.0,
|
||||
humidity_max = 100.0,
|
||||
scale = 60.0,
|
||||
offset = 20.0,
|
||||
})
|
||||
|
||||
|
||||
-- Support old code
|
||||
function default.spawn_falling_node(p, nodename)
|
||||
spawn_falling_node(p, nodename)
|
||||
|
@ -28,10 +28,10 @@ minetest.after(1.0, switch_player_visual)
|
||||
]]
|
||||
|
||||
minetest.register_node("experimental:soundblock", {
|
||||
tile_images = {"unknown_block.png", "default_tnt_bottom.png",
|
||||
tile_images = {"unknown_node.png", "default_tnt_bottom.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"},
|
||||
inventory_image = minetest.inventorycube("unknown_block.png",
|
||||
inventory_image = minetest.inventorycube("unknown_node.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"),
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
757
po/uk/minetest.po
Normal file
757
po/uk/minetest.po
Normal file
@ -0,0 +1,757 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: minetest\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-03-30 19:56+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: src/guiConfigureWorld.cpp:125
|
||||
msgid ""
|
||||
"Warning: Some mods are not configured yet.\n"
|
||||
"They will be enabled by default when you save the configuration. "
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:144
|
||||
msgid ""
|
||||
"Warning: Some configured mods are missing.\n"
|
||||
"Their setting will be removed when you save the configuration. "
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:208
|
||||
msgid "enabled"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:215
|
||||
msgid "Enable All"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:222
|
||||
msgid "Disable All"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:228
|
||||
msgid "depends on:"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:240
|
||||
msgid "is required by:"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:262 src/guiCreateWorld.cpp:165
|
||||
#: src/guiKeyChangeMenu.cpp:179 src/keycode.cpp:223
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:268 src/guiKeyChangeMenu.cpp:173
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:394
|
||||
msgid "Configuration saved. "
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfigureWorld.cpp:402
|
||||
msgid "Warning: Configuration not consistent. "
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfirmMenu.cpp:120
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiConfirmMenu.cpp:126
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiCreateWorld.cpp:116
|
||||
msgid "World name"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiCreateWorld.cpp:135
|
||||
msgid "Game"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiCreateWorld.cpp:159
|
||||
msgid "Create"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiDeathScreen.cpp:96
|
||||
msgid "You died."
|
||||
msgstr ""
|
||||
|
||||
#: src/guiDeathScreen.cpp:104
|
||||
msgid "Respawn"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiFormSpecMenu.cpp:582
|
||||
msgid "Left click: Move all items, Right click: Move single item"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiFormSpecMenu.cpp:607 src/guiMessageMenu.cpp:109
|
||||
#: src/guiTextInputMenu.cpp:131
|
||||
msgid "Proceed"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:114
|
||||
msgid "Keybindings. (If this menu screws up, remove stuff from minetest.conf)"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:151
|
||||
msgid "\"Use\" = climb down"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:164
|
||||
msgid "Double tap \"jump\" to toggle fly"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:269
|
||||
msgid "Key already in use"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:347
|
||||
msgid "press key"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:372
|
||||
msgid "Forward"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:373
|
||||
msgid "Backward"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:374 src/keycode.cpp:228
|
||||
msgid "Left"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:375 src/keycode.cpp:228
|
||||
msgid "Right"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:376
|
||||
msgid "Use"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:377
|
||||
msgid "Jump"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:378
|
||||
msgid "Sneak"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:379
|
||||
msgid "Drop"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:380
|
||||
msgid "Inventory"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:381
|
||||
msgid "Chat"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:382
|
||||
msgid "Command"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:383
|
||||
msgid "Console"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:384
|
||||
msgid "Toggle fly"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:385
|
||||
msgid "Toggle fast"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:386
|
||||
msgid "Toggle noclip"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:387
|
||||
msgid "Range select"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:388
|
||||
msgid "Print stacks"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:92
|
||||
msgid "Cannot create world: Name contains invalid characters"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:101
|
||||
msgid "Cannot create world: A world by this name already exists"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:283
|
||||
msgid "Singleplayer"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:284
|
||||
msgid "Multiplayer"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:285
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:286
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:287
|
||||
msgid "Credits"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:317
|
||||
msgid "Select World:"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:339 src/guiMainMenu.cpp:511 src/keycode.cpp:229
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:346
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:354
|
||||
msgid "Configure"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:369 src/keycode.cpp:248
|
||||
msgid "Play"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:380 src/guiMainMenu.cpp:619
|
||||
msgid "Creative Mode"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:386 src/guiMainMenu.cpp:625
|
||||
msgid "Enable Damage"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:406 src/guiMainMenu.cpp:541
|
||||
msgid "Name/Password"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:442 src/guiMainMenu.cpp:459 src/guiMainMenu.cpp:1184
|
||||
msgid "Favorites:"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:450 src/guiMainMenu.cpp:1194
|
||||
msgid "Public Server List:"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:470 src/guiMainMenu.cpp:568
|
||||
msgid "Address/Port"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:497 src/guiMainMenu.cpp:1183
|
||||
msgid "Show Public"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:501 src/guiMainMenu.cpp:1193
|
||||
msgid "Show Favorites"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:521
|
||||
msgid "Connect"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:591
|
||||
msgid "Leave address blank to start a local server."
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:600
|
||||
msgid "Start Game / Connect"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:632
|
||||
msgid "Public"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:640 src/guiMainMenu.cpp:1113
|
||||
msgid "Delete world"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:647
|
||||
msgid "Create world"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:681
|
||||
msgid "Fancy trees"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:687
|
||||
msgid "Smooth Lighting"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:693
|
||||
msgid "3D Clouds"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:699
|
||||
msgid "Opaque water"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:709
|
||||
msgid "Mip-Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:716
|
||||
msgid "Anisotropic Filtering"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:723
|
||||
msgid "Bi-Linear Filtering"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:730
|
||||
msgid "Tri-Linear Filtering"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:738
|
||||
msgid "Shaders"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:745
|
||||
msgid "Preload item visuals"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:752
|
||||
msgid "Enable Particles"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:759
|
||||
msgid "Finite liquid"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:769
|
||||
msgid "Change keys"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:1084
|
||||
msgid "Address required."
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:1102
|
||||
msgid "Cannot delete world: Nothing selected"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:1117
|
||||
msgid "Files to be deleted"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:1133
|
||||
msgid "Cannot create world: No games found"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:1149
|
||||
msgid "Cannot configure world: Nothing selected"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiMainMenu.cpp:1256
|
||||
msgid "Failed to delete all world files"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPasswordChange.cpp:108
|
||||
msgid "Old Password"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPasswordChange.cpp:125
|
||||
msgid "New Password"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPasswordChange.cpp:141
|
||||
msgid "Confirm Password"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPasswordChange.cpp:158
|
||||
msgid "Change"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPasswordChange.cpp:167
|
||||
msgid "Passwords do not match!"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPauseMenu.cpp:123
|
||||
msgid "Continue"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPauseMenu.cpp:132
|
||||
msgid "Change Password"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPauseMenu.cpp:140
|
||||
msgid "Sound Volume"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPauseMenu.cpp:147
|
||||
msgid "Exit to Menu"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPauseMenu.cpp:154
|
||||
msgid "Exit to OS"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiPauseMenu.cpp:161
|
||||
msgid ""
|
||||
"Default Controls:\n"
|
||||
"- WASD: Walk\n"
|
||||
"- Mouse left: dig/hit\n"
|
||||
"- Mouse right: place/use\n"
|
||||
"- Mouse wheel: select item\n"
|
||||
"- 0...9: select item\n"
|
||||
"- Shift: sneak\n"
|
||||
"- R: Toggle viewing all loaded chunks\n"
|
||||
"- I: Inventory menu\n"
|
||||
"- ESC: This menu\n"
|
||||
"- T: Chat\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/guiVolumeChange.cpp:108
|
||||
msgid "Sound Volume: "
|
||||
msgstr ""
|
||||
|
||||
#: src/guiVolumeChange.cpp:121
|
||||
msgid "Exit"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:223
|
||||
msgid "Left Button"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:223
|
||||
msgid "Middle Button"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:223
|
||||
msgid "Right Button"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:223
|
||||
msgid "X Button 1"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "Back"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "Clear"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "Return"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "Tab"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "X Button 2"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Capital"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Control"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Kana"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Menu"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Pause"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Shift"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Convert"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Escape"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Final"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Junja"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Kanji"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Nonconvert"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:227
|
||||
msgid "Accept"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:227
|
||||
msgid "End"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:227
|
||||
msgid "Home"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:227
|
||||
msgid "Mode Change"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:227
|
||||
msgid "Next"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:227
|
||||
msgid "Prior"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:227
|
||||
msgid "Space"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:228
|
||||
msgid "Down"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:228
|
||||
msgid "Execute"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:228
|
||||
msgid "Print"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:228
|
||||
msgid "Select"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:228
|
||||
msgid "Up"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:229
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:229
|
||||
msgid "Insert"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:229
|
||||
msgid "Snapshot"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:232
|
||||
msgid "Left Windows"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:233
|
||||
msgid "Apps"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:233
|
||||
msgid "Numpad 0"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:233
|
||||
msgid "Numpad 1"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:233
|
||||
msgid "Right Windows"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:233
|
||||
msgid "Sleep"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 2"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 3"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 4"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 5"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 6"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 7"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad *"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad +"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad -"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad /"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 8"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 9"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:239
|
||||
msgid "Num Lock"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:239
|
||||
msgid "Scroll Lock"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:240
|
||||
msgid "Left Shift"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:240
|
||||
msgid "Right Shift"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:241
|
||||
msgid "Left Control"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:241
|
||||
msgid "Left Menu"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:241
|
||||
msgid "Right Control"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:241
|
||||
msgid "Right Menu"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:243
|
||||
msgid "Comma"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:243
|
||||
msgid "Minus"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:243
|
||||
msgid "Period"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:243
|
||||
msgid "Plus"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:247
|
||||
msgid "Attn"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:247
|
||||
msgid "CrSel"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:248
|
||||
msgid "Erase OEF"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:248
|
||||
msgid "ExSel"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:248
|
||||
msgid "OEM Clear"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:248
|
||||
msgid "PA1"
|
||||
msgstr ""
|
||||
|
||||
#: src/keycode.cpp:248
|
||||
msgid "Zoom"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:1506
|
||||
msgid "Main Menu"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:1830
|
||||
msgid "Failed to initialize world"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:1842
|
||||
msgid "No world selected and no address provided. Nothing to do."
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:1850
|
||||
msgid "Could not find or load game \""
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:1864
|
||||
msgid "Invalid gamespec."
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:1904
|
||||
msgid "Connection error (timed out?)"
|
||||
msgstr ""
|
||||
|
||||
#: src/main.cpp:1915
|
||||
msgid ""
|
||||
"\n"
|
||||
"Check debug.txt for details."
|
||||
msgstr ""
|
@ -227,6 +227,7 @@ set(common_SRCS
|
||||
emerge.cpp
|
||||
mapgen.cpp
|
||||
mapgen_v6.cpp
|
||||
mapgen_v7.cpp
|
||||
mapgen_indev.cpp
|
||||
mapgen_singlenode.cpp
|
||||
treegen.cpp
|
||||
@ -264,6 +265,7 @@ set(common_SRCS
|
||||
clientserver.cpp
|
||||
staticobject.cpp
|
||||
serverlist.cpp
|
||||
pathfinder.cpp
|
||||
util/serialize.cpp
|
||||
util/directiontables.cpp
|
||||
util/numeric.cpp
|
||||
|
267
src/biome.cpp
267
src/biome.cpp
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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
|
||||
@ -23,68 +23,50 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "log.h"
|
||||
#include "main.h"
|
||||
|
||||
#define BT_NONE 0
|
||||
#define BT_OCEAN 1
|
||||
#define BT_LAKE 2
|
||||
#define BT_SBEACH 3
|
||||
#define BT_GBEACH 4
|
||||
#define BT_PLAINS 5
|
||||
#define BT_HILLS 6
|
||||
#define BT_EXTREMEHILLS 7
|
||||
#define BT_MOUNTAINS 8
|
||||
#define BT_DESERT 9
|
||||
#define BT_DESERTHILLS 10
|
||||
#define BT_HELL 11
|
||||
#define BT_AETHER 12
|
||||
|
||||
#define BT_BTMASK 0x3F
|
||||
|
||||
#define BTF_SNOW 0x40
|
||||
#define BTF_FOREST 0x80
|
||||
|
||||
#define BGFREQ_1 ( 0.40)
|
||||
#define BGFREQ_2 (BGFREQ_1 + 0.05)
|
||||
#define BGFREQ_3 (BGFREQ_2 + 0.08)
|
||||
#define BGFREQ_4 (BGFREQ_3 + 0.35)
|
||||
#define BGFREQ_5 (BGFREQ_4 + 0.18)
|
||||
//BGFREQ_5 is not checked as an upper bound; it ought to sum up to 1.00, but it's okay if it doesn't.
|
||||
NoiseParams nparams_biome_def_heat =
|
||||
{50, 50, v3f(500.0, 500.0, 500.0), 5349, 3, 0.70};
|
||||
NoiseParams nparams_biome_def_humidity =
|
||||
{50, 50, v3f(500.0, 500.0, 500.0), 842, 3, 0.55};
|
||||
|
||||
|
||||
/*float bg1_temps[] = {0.0};
|
||||
int bg1_biomes[] = {BT_OCEAN};
|
||||
BiomeDefManager::BiomeDefManager() {
|
||||
biome_registration_finished = false;
|
||||
np_heat = &nparams_biome_def_heat;
|
||||
np_humidity = &nparams_biome_def_humidity;
|
||||
|
||||
float bg2_temps[] = {10.0};
|
||||
int bg2_biomes[] = {BT_GBEACH, BT_SBEACH};
|
||||
// Create default biome to be used in case none exist
|
||||
Biome *b = new Biome;
|
||||
|
||||
b->id = 0;
|
||||
b->name = "Default";
|
||||
b->flags = 0;
|
||||
|
||||
float bg3_temps[] = {30.0, 40.0};
|
||||
int bg3_biomes[] = {BT_HILLS, BT_EXTREMEHILLS, BT_MOUNTAINS};
|
||||
b->c_top = CONTENT_AIR;
|
||||
b->top_depth = 0;
|
||||
b->c_filler = b->c_top;
|
||||
b->filler_height = MAP_GENERATION_LIMIT;
|
||||
|
||||
float bg4_temps[] = {25.0, 30.0, 35.0, 40.0};
|
||||
int bg4_biomes[] = {BT_HILLS, BT_EXTREMEHILLS, BT_MOUNTAINS, BT_DESERT, BT_DESERTHILLS};
|
||||
b->height_min = -MAP_GENERATION_LIMIT;
|
||||
b->height_max = MAP_GENERATION_LIMIT;
|
||||
b->heat_point = 0.0;
|
||||
b->humidity_point = 0.0;
|
||||
|
||||
float bg5_temps[] = {5.0, 40.0};
|
||||
int bg5_biomes[] = {BT_LAKE, BT_PLAINS, BT_DESERT};*/
|
||||
|
||||
NoiseParams np_default = {20.0, 15.0, v3f(250., 250., 250.), 82341, 5, 0.6};
|
||||
|
||||
|
||||
BiomeDefManager::BiomeDefManager(IGameDef *gamedef) {
|
||||
this->m_gamedef = gamedef;
|
||||
this->ndef = gamedef->ndef();
|
||||
|
||||
//the initial biome group
|
||||
bgroups.push_back(new std::vector<Biome *>);
|
||||
biomes.push_back(b);
|
||||
}
|
||||
|
||||
|
||||
BiomeDefManager::~BiomeDefManager() {
|
||||
for (unsigned int i = 0; i != bgroups.size(); i++)
|
||||
delete bgroups[i];
|
||||
//if (biomecache)
|
||||
// delete[] biomecache;
|
||||
|
||||
for (size_t i = 0; i != biomes.size(); i++)
|
||||
delete biomes[i];
|
||||
}
|
||||
|
||||
|
||||
Biome *BiomeDefManager::createBiome(BiomeTerrainType btt) {
|
||||
switch (btt) {
|
||||
/*switch (btt) {
|
||||
case BIOME_TERRAIN_NORMAL:
|
||||
return new Biome;
|
||||
case BIOME_TERRAIN_LIQUID:
|
||||
@ -92,142 +74,97 @@ Biome *BiomeDefManager::createBiome(BiomeTerrainType btt) {
|
||||
case BIOME_TERRAIN_NETHER:
|
||||
return new BiomeHell;
|
||||
case BIOME_TERRAIN_AETHER:
|
||||
return new BiomeAether;
|
||||
return new BiomeSky;
|
||||
case BIOME_TERRAIN_FLAT:
|
||||
return new BiomeSuperflat;
|
||||
}
|
||||
return NULL;
|
||||
return NULL;*/
|
||||
return new Biome;
|
||||
}
|
||||
|
||||
|
||||
void BiomeDefManager::addBiomeGroup(float freq) {
|
||||
int size = bgroup_freqs.size();
|
||||
float newfreq = freq;
|
||||
// just a PoC, obviously needs optimization later on (precalculate this)
|
||||
void BiomeDefManager::calcBiomes(BiomeNoiseInput *input, u8 *biomeid_map) {
|
||||
int i = 0;
|
||||
for (int y = 0; y != input->mapsize.Y; y++) {
|
||||
for (int x = 0; x != input->mapsize.X; x++, i++) {
|
||||
float heat = (input->heat_map[i] + 1) * 50;
|
||||
float humidity = (input->humidity_map[i] + 1) * 50;
|
||||
biomeid_map[i] = getBiome(heat, humidity, input->height_map[i])->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (size)
|
||||
newfreq += bgroup_freqs[size - 1];
|
||||
bgroup_freqs.push_back(newfreq);
|
||||
bgroups.push_back(new std::vector<Biome *>);
|
||||
|
||||
verbosestream << "BiomeDefManager: added biome group with frequency " <<
|
||||
newfreq << std::endl;
|
||||
void BiomeDefManager::resolveNodeNames(INodeDefManager *ndef) {
|
||||
Biome *b;
|
||||
|
||||
biome_registration_finished = true;
|
||||
|
||||
for (size_t i = 0; i != biomes.size(); i++) {
|
||||
b = biomes[i];
|
||||
|
||||
if (b->c_top == CONTENT_IGNORE) {
|
||||
b->c_top = ndef->getId(b->top_nodename);
|
||||
if (b->c_top == CONTENT_IGNORE) {
|
||||
errorstream << "BiomeDefManager::resolveNodeNames: node '"
|
||||
<< b->top_nodename << "' not defined" << std::endl;
|
||||
b->c_top = CONTENT_AIR;
|
||||
b->top_depth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (b->c_filler == CONTENT_IGNORE) {
|
||||
b->c_filler = ndef->getId(b->filler_nodename);
|
||||
if (b->c_filler == CONTENT_IGNORE) {
|
||||
errorstream << "BiomeDefManager::resolveNodeNames: node '"
|
||||
<< b->filler_nodename << "' not defined" << std::endl;
|
||||
b->c_filler = CONTENT_AIR;
|
||||
b->filler_height = MAP_GENERATION_LIMIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BiomeDefManager::addBiome(Biome *b) {
|
||||
std::vector<Biome *> *bgroup;
|
||||
|
||||
if ((unsigned int)b->groupid >= bgroups.size()) {
|
||||
errorstream << "BiomeDefManager: attempted to add biome '" << b->name
|
||||
<< "' to nonexistent biome group " << b->groupid << std::endl;
|
||||
if (biome_registration_finished) {
|
||||
errorstream << "BIomeDefManager: biome registration already finished, dropping " << b->name <<std::endl;
|
||||
delete b;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t nbiomes = biomes.size();
|
||||
if (nbiomes >= 0xFF) {
|
||||
errorstream << "BiomeDefManager: too many biomes, dropping " << b->name << std::endl;
|
||||
delete b;
|
||||
return;
|
||||
}
|
||||
|
||||
bgroup = bgroups[b->groupid];
|
||||
bgroup->push_back(b);
|
||||
|
||||
verbosestream << "BiomeDefManager: added biome '" << b->name <<
|
||||
"' to biome group " << (int)b->groupid << std::endl;
|
||||
b->id = (u8)nbiomes;
|
||||
biomes.push_back(b);
|
||||
verbosestream << "BiomeDefManager: added biome " << b->name << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void BiomeDefManager::addDefaultBiomes() {
|
||||
Biome *b;
|
||||
Biome *BiomeDefManager::getBiome(float heat, float humidity, s16 y) {
|
||||
Biome *b, *biome_closest = NULL;
|
||||
float dist_min = FLT_MAX;
|
||||
|
||||
b = new Biome;
|
||||
b->name = "Default";
|
||||
b->n_top = MapNode(ndef->getId("mapgen_stone"));
|
||||
b->n_filler = b->n_top;
|
||||
b->ntopnodes = 0;
|
||||
b->height_min = -MAP_GENERATION_LIMIT;
|
||||
b->height_max = MAP_GENERATION_LIMIT;
|
||||
b->heat_min = FLT_MIN;
|
||||
b->heat_max = FLT_MAX;
|
||||
b->humidity_min = FLT_MIN;
|
||||
b->humidity_max = FLT_MAX;
|
||||
b->np = &np_default;
|
||||
biome_default = b;
|
||||
}
|
||||
for (size_t i = 1; i < biomes.size(); i++) {
|
||||
b = biomes[i];
|
||||
if (y > b->height_max || y < b->height_min)
|
||||
continue;
|
||||
|
||||
|
||||
Biome *BiomeDefManager::getBiome(float bgfreq, float heat, float humidity) {
|
||||
std::vector<Biome *> *bgroup;
|
||||
Biome *b;
|
||||
int i;
|
||||
|
||||
int ngroups = bgroup_freqs.size();
|
||||
if (!ngroups)
|
||||
return biome_default;
|
||||
for (i = 0; (i != ngroups) && (bgfreq > bgroup_freqs[i]); i++);
|
||||
bgroup = bgroups[i];
|
||||
|
||||
int nbiomes = bgroup->size();
|
||||
for (i = 0; i != nbiomes; i++) {
|
||||
b = bgroup->operator[](i);
|
||||
if (heat >= b->heat_min && heat <= b->heat_max &&
|
||||
humidity >= b->humidity_min && humidity <= b->humidity_max)
|
||||
return b;
|
||||
float d_heat = heat - b->heat_point;
|
||||
float d_humidity = humidity - b->humidity_point;
|
||||
float dist = (d_heat * d_heat) +
|
||||
(d_humidity * d_humidity);
|
||||
if (dist < dist_min) {
|
||||
dist_min = dist;
|
||||
biome_closest = b;
|
||||
}
|
||||
}
|
||||
|
||||
return biome_default;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////// [ Generic biome ] ////////////////////////////////
|
||||
|
||||
|
||||
int Biome::getSurfaceHeight(float noise_terrain) {
|
||||
return np->offset + np->scale * noise_terrain;
|
||||
}
|
||||
|
||||
|
||||
void Biome::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////// [ Ocean biome ] /////////////////////////////////
|
||||
|
||||
|
||||
void BiomeLiquid::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////// [ Nether biome ] /////////////////////////////////
|
||||
|
||||
|
||||
int BiomeHell::getSurfaceHeight(float noise_terrain) {
|
||||
return np->offset + np->scale * noise_terrain;
|
||||
}
|
||||
|
||||
|
||||
void BiomeHell::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////// [ Aether biome ] ////////////////////////////////
|
||||
|
||||
|
||||
int BiomeAether::getSurfaceHeight(float noise_terrain) {
|
||||
return np->offset + np->scale * noise_terrain;
|
||||
}
|
||||
|
||||
|
||||
void BiomeAether::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////// [ Superflat biome ] ///////////////////////////////
|
||||
|
||||
|
||||
int BiomeSuperflat::getSurfaceHeight(float noise_terrain) {
|
||||
return ntopnodes;
|
||||
}
|
||||
|
||||
|
||||
void BiomeSuperflat::genColumn(Mapgen *mapgen, int x, int z, int y1, int y2) {
|
||||
|
||||
|
||||
return biome_closest ? biome_closest : biomes[0];
|
||||
}
|
||||
|
77
src/biome.h
77
src/biome.h
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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
|
||||
@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "noise.h"
|
||||
#include "mapgen.h"
|
||||
|
||||
|
||||
enum BiomeTerrainType
|
||||
{
|
||||
BIOME_TERRAIN_NORMAL,
|
||||
@ -37,62 +36,54 @@ enum BiomeTerrainType
|
||||
BIOME_TERRAIN_FLAT
|
||||
};
|
||||
|
||||
extern NoiseParams nparams_biome_def_heat;
|
||||
extern NoiseParams nparams_biome_def_humidity;
|
||||
|
||||
class Biome {
|
||||
public:
|
||||
MapNode n_top;
|
||||
MapNode n_filler;
|
||||
s16 ntopnodes;
|
||||
s8 groupid;
|
||||
s8 flags;
|
||||
u8 id;
|
||||
std::string name;
|
||||
u32 flags;
|
||||
|
||||
std::string top_nodename;
|
||||
std::string filler_nodename;
|
||||
|
||||
content_t c_top;
|
||||
s16 top_depth;
|
||||
|
||||
content_t c_filler;
|
||||
s16 filler_height;
|
||||
|
||||
s16 height_min;
|
||||
s16 height_max;
|
||||
float heat_min;
|
||||
float heat_max;
|
||||
float humidity_min;
|
||||
float humidity_max;
|
||||
std::string name;
|
||||
NoiseParams *np;
|
||||
|
||||
virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
|
||||
virtual int getSurfaceHeight(float noise_terrain);
|
||||
float heat_point;
|
||||
float humidity_point;
|
||||
};
|
||||
|
||||
class BiomeLiquid : public Biome {
|
||||
virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
|
||||
};
|
||||
|
||||
class BiomeHell : public Biome {
|
||||
virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
|
||||
virtual int getSurfaceHeight(float noise_terrain);
|
||||
};
|
||||
|
||||
class BiomeAether : public Biome {
|
||||
virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
|
||||
virtual int getSurfaceHeight(float noise_terrain);
|
||||
};
|
||||
|
||||
class BiomeSuperflat : public Biome {
|
||||
virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
|
||||
virtual int getSurfaceHeight(float noise_terrain);
|
||||
struct BiomeNoiseInput {
|
||||
v2s16 mapsize;
|
||||
float *heat_map;
|
||||
float *humidity_map;
|
||||
s16 *height_map;
|
||||
};
|
||||
|
||||
class BiomeDefManager {
|
||||
public:
|
||||
std::vector<float> bgroup_freqs;
|
||||
std::vector<std::vector<Biome *> *> bgroups;
|
||||
Biome *biome_default;
|
||||
IGameDef *m_gamedef;
|
||||
INodeDefManager *ndef;
|
||||
std::vector<Biome *> biomes;
|
||||
|
||||
BiomeDefManager(IGameDef *gamedef);
|
||||
bool biome_registration_finished;
|
||||
NoiseParams *np_heat;
|
||||
NoiseParams *np_humidity;
|
||||
|
||||
BiomeDefManager();
|
||||
~BiomeDefManager();
|
||||
|
||||
|
||||
Biome *createBiome(BiomeTerrainType btt);
|
||||
Biome *getBiome(float bgfreq, float heat, float humidity);
|
||||
void calcBiomes(BiomeNoiseInput *input, u8 *biomeid_map);
|
||||
Biome *getBiome(float heat, float humidity, s16 y);
|
||||
|
||||
void addBiomeGroup(float freq);
|
||||
void addBiome(Biome *b);
|
||||
void addDefaultBiomes();
|
||||
void resolveNodeNames(INodeDefManager *ndef);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -218,6 +218,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
|
||||
// Smooth the movement when walking up stairs
|
||||
v3f old_player_position = m_playernode->getPosition();
|
||||
v3f player_position = player->getPosition();
|
||||
if (player->isAttached && player->parent)
|
||||
player_position = player->parent->getPosition();
|
||||
//if(player->touching_ground && player_position.Y > old_player_position.Y)
|
||||
if(player->touching_ground &&
|
||||
player_position.Y > old_player_position.Y)
|
||||
|
@ -464,7 +464,7 @@ void ChatPrompt::historyNext()
|
||||
}
|
||||
}
|
||||
|
||||
void ChatPrompt::nickCompletion(const std::list<std::wstring>& names, bool backwards)
|
||||
void ChatPrompt::nickCompletion(const std::list<std::string>& names, bool backwards)
|
||||
{
|
||||
// Two cases:
|
||||
// (a) m_nick_completion_start == m_nick_completion_end == 0
|
||||
@ -493,13 +493,13 @@ void ChatPrompt::nickCompletion(const std::list<std::wstring>& names, bool backw
|
||||
|
||||
// find all names that start with the selected prefix
|
||||
std::vector<std::wstring> completions;
|
||||
for (std::list<std::wstring>::const_iterator
|
||||
for (std::list<std::string>::const_iterator
|
||||
i = names.begin();
|
||||
i != names.end(); ++i)
|
||||
{
|
||||
if (str_starts_with(*i, prefix, true))
|
||||
if (str_starts_with(narrow_to_wide(*i), prefix, true))
|
||||
{
|
||||
std::wstring completion = *i;
|
||||
std::wstring completion = narrow_to_wide(*i);
|
||||
if (prefix_start == 0)
|
||||
completion += L":";
|
||||
completions.push_back(completion);
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
void historyNext();
|
||||
|
||||
// Nick completion
|
||||
void nickCompletion(const std::list<std::wstring>& names, bool backwards);
|
||||
void nickCompletion(const std::list<std::string>& names, bool backwards);
|
||||
|
||||
// Update console size and reformat the visible portion of the prompt
|
||||
void reformat(u32 cols);
|
||||
|
@ -2501,18 +2501,9 @@ void Client::printDebugInfo(std::ostream &os)
|
||||
<<std::endl;*/
|
||||
}
|
||||
|
||||
std::list<std::wstring> Client::getConnectedPlayerNames()
|
||||
std::list<std::string> Client::getConnectedPlayerNames()
|
||||
{
|
||||
std::list<Player*> players = m_env.getPlayers(true);
|
||||
std::list<std::wstring> playerNames;
|
||||
for(std::list<Player*>::iterator
|
||||
i = players.begin();
|
||||
i != players.end(); ++i)
|
||||
{
|
||||
Player *player = *i;
|
||||
playerNames.push_back(narrow_to_wide(player->getName()));
|
||||
}
|
||||
return playerNames;
|
||||
return m_env.getPlayerNames();
|
||||
}
|
||||
|
||||
float Client::getAnimationTime()
|
||||
|
@ -315,7 +315,7 @@ public:
|
||||
// Prints a line or two of info
|
||||
void printDebugInfo(std::ostream &os);
|
||||
|
||||
std::list<std::wstring> getConnectedPlayerNames();
|
||||
std::list<std::string> getConnectedPlayerNames();
|
||||
|
||||
float getAnimationTime();
|
||||
|
||||
|
@ -88,9 +88,11 @@ SharedBuffer<u8> makePacket_TOCLIENT_TIME_OF_DAY(u16 time, float time_speed);
|
||||
PROTOCOL_VERSION 18:
|
||||
damageGroups added to ToolCapabilities
|
||||
sound_place added to ItemDefinition
|
||||
PROTOCOL_VERSION 19:
|
||||
GENERIC_CMD_SET_PHYSICS_OVERRIDE
|
||||
*/
|
||||
|
||||
#define LATEST_PROTOCOL_VERSION 18
|
||||
#define LATEST_PROTOCOL_VERSION 19
|
||||
|
||||
// Server's supported network protocol range
|
||||
#define SERVER_PROTOCOL_VERSION_MIN 13
|
||||
|
@ -209,10 +209,15 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
||||
}
|
||||
speed_f += accel_f * dtime;
|
||||
|
||||
// If there is no speed, there are no collisions
|
||||
// If there is no speed, there are no collisions
|
||||
if(speed_f.getLength() == 0)
|
||||
return result;
|
||||
|
||||
// Limit speed for avoiding hangs
|
||||
speed_f.Y=rangelim(speed_f.Y,-5000,5000);
|
||||
speed_f.X=rangelim(speed_f.X,-5000,5000);
|
||||
speed_f.Z=rangelim(speed_f.Z,-5000,5000);
|
||||
|
||||
/*
|
||||
Collect node boxes in movement range
|
||||
*/
|
||||
|
@ -708,11 +708,15 @@ public:
|
||||
if(player && player->isLocal()){
|
||||
m_is_local_player = true;
|
||||
}
|
||||
m_env->addPlayerName(m_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
~GenericCAO()
|
||||
{
|
||||
if(m_is_player){
|
||||
m_env->removePlayerName(m_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
static ClientActiveObject* create(IGameDef *gamedef, ClientEnvironment *env)
|
||||
@ -860,7 +864,7 @@ public:
|
||||
m_spritenode = smgr->addBillboardSceneNode(
|
||||
NULL, v2f(1, 1), v3f(0,0,0), -1);
|
||||
m_spritenode->setMaterialTexture(0,
|
||||
tsrc->getTextureRaw("unknown_block.png"));
|
||||
tsrc->getTextureRaw("unknown_node.png"));
|
||||
m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
|
||||
@ -1129,6 +1133,7 @@ public:
|
||||
{
|
||||
LocalPlayer *player = m_env->getLocalPlayer();
|
||||
player->overridePosition = getParent()->getPosition();
|
||||
m_env->getLocalPlayer()->parent = getParent();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1263,7 +1268,7 @@ public:
|
||||
{
|
||||
if(m_prop.visual == "sprite")
|
||||
{
|
||||
std::string texturestring = "unknown_block.png";
|
||||
std::string texturestring = "unknown_node.png";
|
||||
if(m_prop.textures.size() >= 1)
|
||||
texturestring = m_prop.textures[0];
|
||||
texturestring += mod;
|
||||
@ -1329,7 +1334,7 @@ public:
|
||||
{
|
||||
for (u32 i = 0; i < 6; ++i)
|
||||
{
|
||||
std::string texturestring = "unknown_block.png";
|
||||
std::string texturestring = "unknown_node.png";
|
||||
if(m_prop.textures.size() > i)
|
||||
texturestring = m_prop.textures[i];
|
||||
texturestring += mod;
|
||||
@ -1678,6 +1683,19 @@ public:
|
||||
|
||||
updateTexturePos();
|
||||
}
|
||||
else if(cmd == GENERIC_CMD_SET_PHYSICS_OVERRIDE)
|
||||
{
|
||||
float override_speed = readF1000(is);
|
||||
float override_jump = readF1000(is);
|
||||
float override_gravity = readF1000(is);
|
||||
if(m_is_local_player)
|
||||
{
|
||||
LocalPlayer *player = m_env->getLocalPlayer();
|
||||
player->physics_override_speed = override_speed;
|
||||
player->physics_override_jump = override_jump;
|
||||
player->physics_override_gravity = override_gravity;
|
||||
}
|
||||
}
|
||||
else if(cmd == GENERIC_CMD_SET_ANIMATION)
|
||||
{
|
||||
m_animation_range = readV2F1000(is);
|
||||
|
@ -935,7 +935,11 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
||||
m_moved(false),
|
||||
m_inventory_not_sent(false),
|
||||
m_hp_not_sent(false),
|
||||
m_wielded_item_not_sent(false)
|
||||
m_wielded_item_not_sent(false),
|
||||
m_physics_override_speed(1),
|
||||
m_physics_override_jump(1),
|
||||
m_physics_override_gravity(1),
|
||||
m_physics_override_sent(false)
|
||||
{
|
||||
assert(m_player);
|
||||
assert(m_peer_id != 0);
|
||||
@ -1019,7 +1023,7 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version)
|
||||
writeF1000(os, m_player->getYaw());
|
||||
writeS16(os, getHP());
|
||||
|
||||
writeU8(os, 4 + m_bone_position.size()); // number of messages stuffed in here
|
||||
writeU8(os, 5 + m_bone_position.size()); // number of messages stuffed in here
|
||||
os<<serializeLongString(getPropertyPacket()); // message 1
|
||||
os<<serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2
|
||||
os<<serializeLongString(gob_cmd_update_animation(m_animation_range, m_animation_speed, m_animation_blend)); // 3
|
||||
@ -1027,6 +1031,7 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version)
|
||||
os<<serializeLongString(gob_cmd_update_bone_position((*ii).first, (*ii).second.X, (*ii).second.Y)); // m_bone_position.size
|
||||
}
|
||||
os<<serializeLongString(gob_cmd_update_attachment(m_attachment_parent_id, m_attachment_bone, m_attachment_position, m_attachment_rotation)); // 4
|
||||
os<<serializeLongString(gob_cmd_update_physics_override(m_physics_override_speed, m_physics_override_jump, m_physics_override_gravity)); // 5
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1196,6 +1201,14 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
||||
m_messages_out.push_back(aom);
|
||||
}
|
||||
|
||||
if(m_physics_override_sent == false){
|
||||
m_physics_override_sent = true;
|
||||
std::string str = gob_cmd_update_physics_override(m_physics_override_speed, m_physics_override_jump, m_physics_override_gravity);
|
||||
// create message and add to list
|
||||
ActiveObjectMessage aom(getId(), true, str);
|
||||
m_messages_out.push_back(aom);
|
||||
}
|
||||
|
||||
if(m_animation_sent == false){
|
||||
m_animation_sent = true;
|
||||
std::string str = gob_cmd_update_animation(m_animation_range, m_animation_speed, m_animation_blend);
|
||||
|
@ -101,7 +101,7 @@ private:
|
||||
float m_last_sent_position_timer;
|
||||
float m_last_sent_move_precision;
|
||||
bool m_armor_groups_sent;
|
||||
|
||||
|
||||
v2f m_animation_range;
|
||||
float m_animation_speed;
|
||||
float m_animation_blend;
|
||||
@ -257,8 +257,6 @@ private:
|
||||
ItemGroupList m_armor_groups;
|
||||
bool m_armor_groups_sent;
|
||||
|
||||
|
||||
|
||||
bool m_properties_sent;
|
||||
struct ObjectProperties m_prop;
|
||||
// Cached privileges for enforcement
|
||||
@ -285,6 +283,11 @@ public:
|
||||
bool m_inventory_not_sent;
|
||||
bool m_hp_not_sent;
|
||||
bool m_wielded_item_not_sent;
|
||||
|
||||
float m_physics_override_speed;
|
||||
float m_physics_override_jump;
|
||||
float m_physics_override_gravity;
|
||||
bool m_physics_override_sent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -231,10 +231,12 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("mgv6_np_trees", "0, 1, (125, 125, 125), 2, 4, 0.66");
|
||||
settings->setDefault("mgv6_np_apple_trees", "0, 1, (100, 100, 100), 342902, 3, 0.45");
|
||||
|
||||
settings->setDefault("mgv7_np_terrain", "10, 12, (350, 350, 350), 82341, 5, 0.6");
|
||||
settings->setDefault("mgv7_np_bgroup", "0.5, 0.3125, (350, 350, 350), 5923, 2, 0.6");
|
||||
settings->setDefault("mgv7_np_heat", "25, 50, (500, 500, 500), 35293, 1, 0");
|
||||
settings->setDefault("mgv7_np_humidity", "50, 31.25, (750, 750, 750), 12094, 2, 0.6");
|
||||
settings->setDefault("mgv7_np_terrain_base", "0, 80, (250, 250, 250), 82341, 5, 0.6");
|
||||
settings->setDefault("mgv7_np_terrain_alt", "0, 20, (250, 250, 250), 5934, 5, 0.6");
|
||||
settings->setDefault("mgv7_np_terrain_mod", "0, 1, (350, 350, 350), 85039, 5, 0.6");
|
||||
settings->setDefault("mgv7_np_terrain_persist", "0, 1, (500, 500, 500), 539, 3, 0.6");
|
||||
settings->setDefault("mgv7_np_height_select", "0.5, 0.5, (250, 250, 250), 4213, 5, 0.69");
|
||||
settings->setDefault("mgv7_np_ridge", "0.5, 1, (100, 100, 100), 6467, 4, 0.75");
|
||||
|
||||
settings->setDefault("mgindev_np_terrain_base", "-4, 20, (250, 250, 250), 82341, 5, 0.6, 10, 10");
|
||||
settings->setDefault("mgindev_np_terrain_higher", "20, 16, (500, 500, 500), 85039, 5, 0.6, 10, 10");
|
||||
@ -245,7 +247,6 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("mgindev_np_float_islands3", "0, 1, (256, 256, 256), 6412, 2, 0.5, 1, 0.5");
|
||||
settings->setDefault("mgindev_np_biome", "0, 1, (250, 250, 250), 9130, 3, 0.50, 1, 10");
|
||||
settings->setDefault("mgindev_float_islands", "500");
|
||||
|
||||
}
|
||||
|
||||
void override_default_settings(Settings *settings, Settings *from)
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
Minetest-c55
|
||||
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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
|
||||
@ -39,19 +40,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "biome.h"
|
||||
#include "emerge.h"
|
||||
#include "mapgen_v6.h"
|
||||
#include "mapgen_v7.h"
|
||||
#include "mapgen_indev.h"
|
||||
#include "mapgen_singlenode.h"
|
||||
|
||||
|
||||
/////////////////////////////// Emerge Manager ////////////////////////////////
|
||||
|
||||
EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) {
|
||||
EmergeManager::EmergeManager(IGameDef *gamedef) {
|
||||
//register built-in mapgens
|
||||
registerMapgen("v6", new MapgenFactoryV6());
|
||||
//registerMapgen("v7", new MapgenFactoryV7());
|
||||
registerMapgen("indev", new MapgenFactoryIndev());
|
||||
registerMapgen("singlenode", new MapgenFactorySinglenode());
|
||||
|
||||
this->biomedef = bdef ? bdef : new BiomeDefManager(gamedef);
|
||||
this->ndef = gamedef->getNodeDefManager();
|
||||
this->biomedef = new BiomeDefManager();
|
||||
this->params = NULL;
|
||||
|
||||
mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
|
||||
@ -104,6 +108,8 @@ void EmergeManager::initMapgens(MapgenParams *mgparams) {
|
||||
if (mapgen.size())
|
||||
return;
|
||||
|
||||
biomedef->resolveNodeNames(ndef);
|
||||
|
||||
this->params = mgparams;
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++) {
|
||||
mg = createMapgen(params->mg_name, 0, params);
|
||||
@ -237,6 +243,8 @@ MapgenParams *EmergeManager::createMapgenParams(std::string mgname) {
|
||||
MapgenParams *EmergeManager::getParamsFromSettings(Settings *settings) {
|
||||
std::string mg_name = settings->get("mg_name");
|
||||
MapgenParams *mgparams = createMapgenParams(mg_name);
|
||||
if (!mgparams)
|
||||
return NULL;
|
||||
|
||||
mgparams->mg_name = mg_name;
|
||||
mgparams->seed = settings->getU64(settings == g_settings ? "fixed_map_seed" : "seed");
|
||||
|
23
src/emerge.h
23
src/emerge.h
@ -1,3 +1,22 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef EMERGE_HEADER
|
||||
#define EMERGE_HEADER
|
||||
|
||||
@ -46,6 +65,8 @@ struct BlockEmergeData {
|
||||
|
||||
class EmergeManager {
|
||||
public:
|
||||
INodeDefManager *ndef;
|
||||
|
||||
std::map<std::string, MapgenFactory *> mglist;
|
||||
|
||||
std::vector<Mapgen *> mapgen;
|
||||
@ -67,7 +88,7 @@ public:
|
||||
BiomeDefManager *biomedef;
|
||||
std::vector<Ore *> ores;
|
||||
|
||||
EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef);
|
||||
EmergeManager(IGameDef *gamedef);
|
||||
~EmergeManager();
|
||||
|
||||
void initMapgens(MapgenParams *mgparams);
|
||||
|
@ -364,6 +364,29 @@ ServerMap & ServerEnvironment::getServerMap()
|
||||
return *m_map;
|
||||
}
|
||||
|
||||
bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize)
|
||||
{
|
||||
float distance = pos1.getDistanceFrom(pos2);
|
||||
|
||||
//calculate normalized direction vector
|
||||
v3f normalized_vector = v3f((pos2.X - pos1.X)/distance,
|
||||
(pos2.Y - pos1.Y)/distance,
|
||||
(pos2.Z - pos1.Z)/distance);
|
||||
|
||||
//find out if there's a node on path between pos1 and pos2
|
||||
for (float i = 1; i < distance; i += stepsize) {
|
||||
v3s16 pos = floatToInt(v3f(normalized_vector.X * i,
|
||||
normalized_vector.Y * i,
|
||||
normalized_vector.Z * i) +pos1,BS);
|
||||
|
||||
MapNode n = getMap().getNodeNoEx(pos);
|
||||
|
||||
if(n.param0 != CONTENT_AIR) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ServerEnvironment::serializePlayers(const std::string &savedir)
|
||||
{
|
||||
@ -2057,7 +2080,7 @@ void ClientEnvironment::step(float dtime)
|
||||
// Gravity
|
||||
v3f speed = lplayer->getSpeed();
|
||||
if(lplayer->in_liquid == false)
|
||||
speed.Y -= lplayer->movement_gravity * dtime_part * 2;
|
||||
speed.Y -= lplayer->movement_gravity * lplayer->physics_override_gravity * dtime_part * 2;
|
||||
|
||||
// Liquid floating / sinking
|
||||
if(lplayer->in_liquid && !lplayer->swimming_vertical)
|
||||
|
@ -298,6 +298,9 @@ public:
|
||||
// This makes stuff happen
|
||||
void step(f32 dtime);
|
||||
|
||||
//check if there's a line of sight between two positions
|
||||
bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0);
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
@ -470,6 +473,13 @@ public:
|
||||
ClientEnvEvent getClientEvent();
|
||||
|
||||
std::vector<core::vector2d<int> > attachment_list; // X is child ID, Y is parent ID
|
||||
|
||||
std::list<std::string> getPlayerNames()
|
||||
{ return m_player_names; }
|
||||
void addPlayerName(std::string name)
|
||||
{ m_player_names.push_back(name); }
|
||||
void removePlayerName(std::string name)
|
||||
{ m_player_names.remove(name); }
|
||||
|
||||
private:
|
||||
ClientMap *m_map;
|
||||
@ -482,6 +492,7 @@ private:
|
||||
Queue<ClientEnvEvent> m_client_event_queue;
|
||||
IntervalLimiter m_active_object_light_update_interval;
|
||||
IntervalLimiter m_lava_hurt_interval;
|
||||
std::list<std::string> m_player_names;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -2388,7 +2388,7 @@ void the_game(
|
||||
infotext = narrow_to_wide(meta->getString("infotext"));
|
||||
} else {
|
||||
MapNode n = map.getNode(nodepos);
|
||||
if(nodedef->get(n).tiledef[0].name == "unknown_block.png"){
|
||||
if(nodedef->get(n).tiledef[0].name == "unknown_node.png"){
|
||||
infotext = L"Unknown node: ";
|
||||
infotext += narrow_to_wide(nodedef->get(n).name);
|
||||
}
|
||||
|
@ -117,6 +117,18 @@ std::string gob_cmd_update_armor_groups(const ItemGroupList &armor_groups)
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_update_physics_override(float physics_override_speed, float physics_override_jump, float physics_override_gravity)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command
|
||||
writeU8(os, GENERIC_CMD_SET_PHYSICS_OVERRIDE);
|
||||
// parameters
|
||||
writeF1000(os, physics_override_speed);
|
||||
writeF1000(os, physics_override_jump);
|
||||
writeF1000(os, physics_override_gravity);
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_blend)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
|
@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define GENERIC_CMD_SET_ANIMATION 6
|
||||
#define GENERIC_CMD_SET_BONE_POSITION 7
|
||||
#define GENERIC_CMD_SET_ATTACHMENT 8
|
||||
#define GENERIC_CMD_SET_PHYSICS_OVERRIDE 9
|
||||
|
||||
#include "object_properties.h"
|
||||
std::string gob_cmd_set_properties(const ObjectProperties &prop);
|
||||
@ -62,6 +63,8 @@ std::string gob_cmd_punched(s16 damage, s16 result_hp);
|
||||
#include "itemgroup.h"
|
||||
std::string gob_cmd_update_armor_groups(const ItemGroupList &armor_groups);
|
||||
|
||||
std::string gob_cmd_update_physics_override(float physics_override_speed, float physics_override_jump, float physics_override_gravity);
|
||||
|
||||
std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_blend);
|
||||
|
||||
std::string gob_cmd_update_bone_position(std::string bone, v3f position, v3f rotation);
|
||||
|
@ -535,7 +535,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
|
||||
{
|
||||
// Tab or Shift-Tab pressed
|
||||
// Nick completion
|
||||
std::list<std::wstring> names = m_client->getConnectedPlayerNames();
|
||||
std::list<std::string> names = m_client->getConnectedPlayerNames();
|
||||
bool backwards = event.KeyInput.Shift;
|
||||
m_chat_backend->getPrompt().nickCompletion(names, backwards);
|
||||
return true;
|
||||
|
@ -1207,6 +1207,15 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
switch(event.GUIEvent.Caller->getID())
|
||||
{
|
||||
case GUI_ID_ADDRESS_INPUT: case GUI_ID_PORT_INPUT: case GUI_ID_NAME_INPUT: case 264:
|
||||
MainMenuData cur;
|
||||
readInput(&cur);
|
||||
if (getTab() == TAB_MULTIPLAYER && cur.address == L"")
|
||||
{
|
||||
(new GUIMessageMenu(env, parent, -1, menumgr,
|
||||
wgettext("Address required."))
|
||||
)->drop();
|
||||
return true;
|
||||
}
|
||||
acceptInput();
|
||||
quitMenu();
|
||||
return true;
|
||||
|
@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
LocalPlayer::LocalPlayer(IGameDef *gamedef):
|
||||
Player(gamedef),
|
||||
parent(0),
|
||||
isAttached(false),
|
||||
overridePosition(v3f(0,0,0)),
|
||||
last_position(v3f(0,0,0)),
|
||||
@ -388,7 +389,8 @@ void LocalPlayer::applyControl(float dtime)
|
||||
|
||||
bool free_move = fly_allowed && g_settings->getBool("free_move");
|
||||
bool fast_move = fast_allowed && g_settings->getBool("fast_move");
|
||||
bool fast_or_aux1_descends = (fast_move && control.aux1) || (fast_move && g_settings->getBool("aux1_descends"));
|
||||
// When aux1_descends is enabled the fast key is used to go down, so fast isn't possible
|
||||
bool fast_climb = fast_move && control.aux1 && !g_settings->getBool("aux1_descends");
|
||||
bool continuous_forward = g_settings->getBool("continuous_forward");
|
||||
|
||||
// Whether superspeed mode is used or not
|
||||
@ -417,14 +419,12 @@ void LocalPlayer::applyControl(float dtime)
|
||||
}
|
||||
else if(in_liquid || in_liquid_stable)
|
||||
{
|
||||
// Always use fast when aux1_descends & fast_move are enabled in liquid, since the aux1 button would mean both turbo and "swim down" causing a conflict
|
||||
speedV.Y = -movement_speed_fast;
|
||||
speedV.Y = -movement_speed_walk;
|
||||
swimming_vertical = true;
|
||||
}
|
||||
else if(is_climbing)
|
||||
{
|
||||
// Always use fast when aux1_descends & fast_move are enabled when climbing, since the aux1 button would mean both turbo and "descend" causing a conflict
|
||||
speedV.Y = -movement_speed_fast;
|
||||
speedV.Y = -movement_speed_climb;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -461,8 +461,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
}
|
||||
else if(in_liquid || in_liquid_stable)
|
||||
{
|
||||
if(fast_or_aux1_descends)
|
||||
// Always use fast when aux1_descends & fast_move are enabled in liquid, since the aux1 button would mean both turbo and "swim down" causing a conflict
|
||||
if(fast_climb)
|
||||
speedV.Y = -movement_speed_fast;
|
||||
else
|
||||
speedV.Y = -movement_speed_walk;
|
||||
@ -470,8 +469,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
}
|
||||
else if(is_climbing)
|
||||
{
|
||||
if(fast_or_aux1_descends)
|
||||
// Always use fast when aux1_descends & fast_move are enabled when climbing, since the aux1 button would mean both turbo and "descend" causing a conflict
|
||||
if(fast_climb)
|
||||
speedV.Y = -movement_speed_fast;
|
||||
else
|
||||
speedV.Y = -movement_speed_climb;
|
||||
@ -528,7 +526,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
v3f speedJ = getSpeed();
|
||||
if(speedJ.Y >= -0.5 * BS)
|
||||
{
|
||||
speedJ.Y = movement_speed_jump;
|
||||
speedJ.Y = movement_speed_jump * physics_override_jump;
|
||||
setSpeed(speedJ);
|
||||
|
||||
MtEvent *e = new SimpleTriggerEvent("PlayerJump");
|
||||
@ -537,8 +535,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
}
|
||||
else if(in_liquid)
|
||||
{
|
||||
if(fast_or_aux1_descends)
|
||||
// Always use fast when aux1_descends & fast_move are enabled in liquid, since the aux1 button would mean both turbo and "swim down" causing a conflict
|
||||
if(fast_climb)
|
||||
speedV.Y = movement_speed_fast;
|
||||
else
|
||||
speedV.Y = movement_speed_walk;
|
||||
@ -546,8 +543,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
}
|
||||
else if(is_climbing)
|
||||
{
|
||||
if(fast_or_aux1_descends)
|
||||
// Always use fast when aux1_descends & fast_move are enabled when climbing, since the aux1 button would mean both turbo and "descend" causing a conflict
|
||||
if(fast_climb)
|
||||
speedV.Y = movement_speed_fast;
|
||||
else
|
||||
speedV.Y = movement_speed_climb;
|
||||
@ -555,7 +551,7 @@ void LocalPlayer::applyControl(float dtime)
|
||||
}
|
||||
|
||||
// The speed of the player (Y is ignored)
|
||||
if(superspeed || (is_climbing && fast_or_aux1_descends) || ((in_liquid || in_liquid_stable) && fast_or_aux1_descends))
|
||||
if(superspeed || (is_climbing && fast_climb) || ((in_liquid || in_liquid_stable) && fast_climb))
|
||||
speedH = speedH.normalize() * movement_speed_fast;
|
||||
else if(control.sneak && !free_move && !in_liquid && !in_liquid_stable)
|
||||
speedH = speedH.normalize() * movement_speed_crouch;
|
||||
@ -574,17 +570,14 @@ void LocalPlayer::applyControl(float dtime)
|
||||
incH = movement_acceleration_air * BS * dtime;
|
||||
incV = 0; // No vertical acceleration in air
|
||||
}
|
||||
else if(superspeed || (fast_move && control.aux1))
|
||||
incH = incV = movement_acceleration_fast * BS * dtime;
|
||||
else if ((in_liquid || in_liquid_stable) && fast_or_aux1_descends)
|
||||
// Always use fast when aux1_descends & fast_move are enabled in liquid, since the aux1 button would mean both turbo and "swim down" causing a conflict
|
||||
else if (superspeed || (is_climbing && fast_climb) || ((in_liquid || in_liquid_stable) && fast_climb))
|
||||
incH = incV = movement_acceleration_fast * BS * dtime;
|
||||
else
|
||||
incH = incV = movement_acceleration_default * BS * dtime;
|
||||
|
||||
// Accelerate to target speed with maximum increment
|
||||
accelerateHorizontal(speedH, incH);
|
||||
accelerateVertical(speedV, incV);
|
||||
accelerateHorizontal(speedH * physics_override_speed, incH * physics_override_speed);
|
||||
accelerateVertical(speedV * physics_override_speed, incV * physics_override_speed);
|
||||
}
|
||||
|
||||
v3s16 LocalPlayer::getStandingNodePos()
|
||||
|
@ -25,6 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
class ClientEnvironment;
|
||||
|
||||
class ClientActiveObject;
|
||||
|
||||
class LocalPlayer : public Player
|
||||
{
|
||||
public:
|
||||
@ -35,6 +37,8 @@ public:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ClientActiveObject *parent;
|
||||
|
||||
bool isAttached;
|
||||
|
||||
|
24
src/map.cpp
24
src/map.cpp
@ -1763,6 +1763,11 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
|
||||
total_level = LIQUID_LEVEL_SOURCE * can_liquid_same_level;
|
||||
}
|
||||
|
||||
// prevent lakes in air above unloaded blocks
|
||||
if (p0.Y > water_level && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE) {
|
||||
--total_level;
|
||||
}
|
||||
|
||||
// calculate self level 5 blocks
|
||||
u8 want_level =
|
||||
total_level >= LIQUID_LEVEL_SOURCE * can_liquid_same_level
|
||||
@ -1807,8 +1812,8 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
|
||||
}
|
||||
|
||||
for (u16 ii = 0; ii < 7; ii++) // infinity and cave flood optimization
|
||||
if (liquid_levels_want[ii] >= 0 &&
|
||||
(neighbors[ii].i ||
|
||||
if ( neighbors[ii].i ||
|
||||
(liquid_levels_want[ii] >= 0 &&
|
||||
(fast_flood && p0.Y < water_level &&
|
||||
(initial_size >= 1000
|
||||
&& ii != D_TOP
|
||||
@ -1916,8 +1921,7 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
|
||||
|
||||
if(!suspect.empty()){
|
||||
// Blame suspect
|
||||
RollbackScopeActor rollback_scope(m_gamedef->rollback(),
|
||||
suspect, true);
|
||||
RollbackScopeActor rollback_scope(m_gamedef->rollback(), suspect, true);
|
||||
// Get old node for rollback
|
||||
RollbackNode rollback_oldnode(this, p0, m_gamedef);
|
||||
// Set node
|
||||
@ -3462,8 +3466,16 @@ void ServerMap::loadMapMeta()
|
||||
break;
|
||||
params.parseConfigLine(line);
|
||||
}
|
||||
|
||||
MapgenParams *mgparams = m_emerge->getParamsFromSettings(¶ms);
|
||||
|
||||
MapgenParams *mgparams;
|
||||
try {
|
||||
mgparams = m_emerge->getParamsFromSettings(¶ms);
|
||||
} catch (SettingNotFoundException &e) {
|
||||
infostream << "Couldn't get a setting from map_meta.txt: "
|
||||
<< e.what() << std::endl;
|
||||
mgparams = NULL;
|
||||
}
|
||||
|
||||
if (mgparams) {
|
||||
if (m_mgparams)
|
||||
delete m_mgparams;
|
||||
|
@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "main.h" // For g_profiler
|
||||
#include "treegen.h"
|
||||
#include "mapgen_v6.h"
|
||||
#include "mapgen_v7.h"
|
||||
|
||||
FlagDesc flagdesc_mapgen[] = {
|
||||
{"trees", MG_TREES},
|
||||
@ -240,8 +241,7 @@ void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nm
|
||||
|
||||
void Mapgen::setLighting(v3s16 nmin, v3s16 nmax, u8 light) {
|
||||
ScopeProfiler sp(g_profiler, "EmergeThread: mapgen lighting update", SPT_AVG);
|
||||
VoxelArea a(nmin - v3s16(1,0,1) * MAP_BLOCKSIZE,
|
||||
nmax + v3s16(1,0,1) * MAP_BLOCKSIZE);
|
||||
VoxelArea a(nmin, nmax);
|
||||
|
||||
for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) {
|
||||
for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) {
|
||||
@ -277,8 +277,7 @@ void Mapgen::lightSpread(VoxelArea &a, v3s16 p, u8 light) {
|
||||
|
||||
|
||||
void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
|
||||
VoxelArea a(nmin - v3s16(1,0,1) * MAP_BLOCKSIZE,
|
||||
nmax + v3s16(1,0,1) * MAP_BLOCKSIZE);
|
||||
VoxelArea a(nmin, nmax);
|
||||
bool block_is_underground = (water_level >= nmax.Y);
|
||||
|
||||
ScopeProfiler sp(g_profiler, "EmergeThread: mapgen lighting update", SPT_AVG);
|
||||
@ -341,9 +340,7 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
|
||||
|
||||
void Mapgen::calcLightingOld(v3s16 nmin, v3s16 nmax) {
|
||||
enum LightBank banks[2] = {LIGHTBANK_DAY, LIGHTBANK_NIGHT};
|
||||
|
||||
VoxelArea a(nmin - v3s16(1,0,1) * MAP_BLOCKSIZE,
|
||||
nmax + v3s16(1,0,1) * MAP_BLOCKSIZE);
|
||||
VoxelArea a(nmin, nmax);
|
||||
bool block_is_underground = (water_level > nmax.Y);
|
||||
bool sunlight = !block_is_underground;
|
||||
|
||||
@ -409,6 +406,31 @@ void MapgenV6Params::writeParams(Settings *settings) {
|
||||
}
|
||||
|
||||
|
||||
bool MapgenV7Params::readParams(Settings *settings) {
|
||||
np_terrain_base = settings->getNoiseParams("mgv7_np_terrain_base");
|
||||
np_terrain_alt = settings->getNoiseParams("mgv7_np_terrain_alt");
|
||||
np_terrain_mod = settings->getNoiseParams("mgv7_np_terrain_mod");
|
||||
np_terrain_persist = settings->getNoiseParams("mgv7_np_terrain_persist");
|
||||
np_height_select = settings->getNoiseParams("mgv7_np_height_select");
|
||||
np_ridge = settings->getNoiseParams("mgv7_np_ridge");
|
||||
|
||||
bool success =
|
||||
np_terrain_base && np_terrain_alt && np_terrain_mod &&
|
||||
np_terrain_persist && np_height_select && np_ridge;
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7Params::writeParams(Settings *settings) {
|
||||
settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base);
|
||||
settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt);
|
||||
settings->setNoiseParams("mgv7_np_terrain_mod", np_terrain_mod);
|
||||
settings->setNoiseParams("mgv7_np_terrain_persist", np_terrain_persist);
|
||||
settings->setNoiseParams("mgv7_np_height_select", np_height_select);
|
||||
settings->setNoiseParams("mgv7_np_ridge", np_ridge);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////// legacy static functions for farmesh
|
||||
|
||||
|
||||
|
@ -265,9 +265,9 @@ void MapgenIndev::defineCave(Cave & cave, PseudoRandom ps, v3s16 node_min, bool
|
||||
cave.part_max_length_rs = ps.range(2,4);
|
||||
if (node_min.Y < -100 && !ps.range(0, farscale(0.2, node_min.X,node_min.Y,node_min.Z)*30)) { //huge
|
||||
cave.flooded = !ps.range(0, 3);
|
||||
cave.tunnel_routepoints = ps.range(5, 20);
|
||||
cave.tunnel_routepoints = ps.range(5, 30);
|
||||
cave.min_tunnel_diameter = 30;
|
||||
cave.max_tunnel_diameter = ps.range(40, ps.range(80,120));
|
||||
cave.max_tunnel_diameter = ps.range(40, ps.range(80,200));
|
||||
} else {
|
||||
cave.tunnel_routepoints = ps.range(5, ps.range(15,30));
|
||||
cave.min_tunnel_diameter = 5;
|
||||
|
@ -91,7 +91,8 @@ void MapgenSinglenode::makeChunk(BlockMakeData *data) {
|
||||
updateLiquid(&data->transforming_liquid, node_min, node_max);
|
||||
|
||||
// Calculate lighting
|
||||
calcLighting(node_min, node_max);
|
||||
calcLighting(node_min - v3s16(1, 0, 1) * MAP_BLOCKSIZE,
|
||||
node_max + v3s16(1, 0, 1) * MAP_BLOCKSIZE);
|
||||
|
||||
this->generating = false;
|
||||
}
|
||||
|
@ -471,7 +471,8 @@ void MapgenV6::makeChunk(BlockMakeData *data) {
|
||||
}
|
||||
|
||||
// Calculate lighting
|
||||
calcLighting(node_min, node_max);
|
||||
calcLighting(node_min - v3s16(1, 1, 1) * MAP_BLOCKSIZE,
|
||||
node_max + v3s16(1, 0, 1) * MAP_BLOCKSIZE);
|
||||
|
||||
this->generating = false;
|
||||
}
|
||||
|
490
src/mapgen_v7.cpp
Normal file
490
src/mapgen_v7.cpp
Normal file
@ -0,0 +1,490 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
#include "mapgen.h"
|
||||
#include "voxel.h"
|
||||
#include "noise.h"
|
||||
#include "mapblock.h"
|
||||
#include "mapnode.h"
|
||||
#include "map.h"
|
||||
//#include "serverobject.h"
|
||||
#include "content_sao.h"
|
||||
#include "nodedef.h"
|
||||
#include "content_mapnode.h" // For content_mapnode_get_new_name
|
||||
#include "voxelalgorithms.h"
|
||||
#include "profiler.h"
|
||||
#include "settings.h" // For g_settings
|
||||
#include "main.h" // For g_profiler
|
||||
#include "emerge.h"
|
||||
#include "dungeongen.h"
|
||||
#include "treegen.h"
|
||||
#include "biome.h"
|
||||
#include "mapgen_v7.h"
|
||||
|
||||
|
||||
/////////////////// Mapgen V7 perlin noise default values
|
||||
NoiseParams nparams_v7_def_terrain_base =
|
||||
{0, 80.0, v3f(250.0, 250.0, 250.0), 82341, 5, 0.6};
|
||||
NoiseParams nparams_v7_def_terrain_alt =
|
||||
{0, 20.0, v3f(250.0, 250.0, 250.0), 5934, 5, 0.6};
|
||||
NoiseParams nparams_v7_def_terrain_mod =
|
||||
{0, 1.0, v3f(350.0, 350.0, 350.0), 85039, 5, 0.6};
|
||||
NoiseParams nparams_v7_def_terrain_persist =
|
||||
{0, 1.0, v3f(500.0, 500.0, 500.0), 539, 3, 0.6};
|
||||
NoiseParams nparams_v7_def_height_select =
|
||||
{0.5, 0.5, v3f(250.0, 250.0, 250.0), 4213, 5, 0.69};
|
||||
NoiseParams nparams_v7_def_ridge =
|
||||
{0.5, 1.0, v3f(100.0, 100.0, 100.0), 6467, 4, 0.75};
|
||||
/*
|
||||
NoiseParams nparams_v6_def_beach =
|
||||
{0.0, 1.0, v3f(250.0, 250.0, 250.0), 59420, 3, 0.50};
|
||||
NoiseParams nparams_v6_def_cave =
|
||||
{6.0, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50};
|
||||
NoiseParams nparams_v6_def_humidity =
|
||||
{0.5, 0.5, v3f(500.0, 500.0, 500.0), 72384, 4, 0.66};
|
||||
NoiseParams nparams_v6_def_trees =
|
||||
{0.0, 1.0, v3f(125.0, 125.0, 125.0), 2, 4, 0.66};
|
||||
NoiseParams nparams_v6_def_apple_trees =
|
||||
{0.0, 1.0, v3f(100.0, 100.0, 100.0), 342902, 3, 0.45};
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge) {
|
||||
this->generating = false;
|
||||
this->id = mapgenid;
|
||||
this->emerge = emerge;
|
||||
this->bmgr = emerge->biomedef;
|
||||
|
||||
this->seed = (int)params->seed;
|
||||
this->water_level = params->water_level;
|
||||
this->flags = params->flags;
|
||||
this->csize = v3s16(1, 1, 1) * params->chunksize * MAP_BLOCKSIZE;
|
||||
// this->ystride = csize.X; //////fix this
|
||||
|
||||
this->biomemap = new u8[csize.X * csize.Z];
|
||||
this->heightmap = new s16[csize.X * csize.Z];
|
||||
this->ridge_heightmap = new s16[csize.X * csize.Z];
|
||||
|
||||
// Terrain noise
|
||||
noise_terrain_base = new Noise(params->np_terrain_base, seed, csize.X, csize.Z);
|
||||
noise_terrain_alt = new Noise(params->np_terrain_alt, seed, csize.X, csize.Z);
|
||||
noise_terrain_mod = new Noise(params->np_terrain_mod, seed, csize.X, csize.Z);
|
||||
noise_terrain_persist = new Noise(params->np_terrain_persist, seed, csize.X, csize.Z);
|
||||
noise_height_select = new Noise(params->np_height_select, seed, csize.X, csize.Z);
|
||||
noise_ridge = new Noise(params->np_ridge, seed, csize.X, csize.Y, csize.Z);
|
||||
|
||||
// Biome noise
|
||||
noise_heat = new Noise(bmgr->np_heat, seed, csize.X, csize.Z);
|
||||
noise_humidity = new Noise(bmgr->np_humidity, seed, csize.X, csize.Z);
|
||||
}
|
||||
|
||||
|
||||
MapgenV7::~MapgenV7() {
|
||||
delete noise_terrain_base;
|
||||
delete noise_terrain_mod;
|
||||
delete noise_terrain_persist;
|
||||
delete noise_height_select;
|
||||
delete noise_terrain_alt;
|
||||
delete noise_ridge;
|
||||
delete noise_heat;
|
||||
delete noise_humidity;
|
||||
|
||||
delete[] ridge_heightmap;
|
||||
delete[] heightmap;
|
||||
delete[] biomemap;
|
||||
}
|
||||
|
||||
|
||||
int MapgenV7::getGroundLevelAtPoint(v2s16 p) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::makeChunk(BlockMakeData *data) {
|
||||
assert(data->vmanip);
|
||||
assert(data->nodedef);
|
||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
||||
|
||||
this->generating = true;
|
||||
this->vm = data->vmanip;
|
||||
this->ndef = data->nodedef;
|
||||
//TimeTaker t("makeChunk");
|
||||
|
||||
v3s16 blockpos_min = data->blockpos_min;
|
||||
v3s16 blockpos_max = data->blockpos_max;
|
||||
v3s16 blockpos_full_min = blockpos_min - v3s16(1, 1, 1);
|
||||
v3s16 blockpos_full_max = blockpos_max + v3s16(1, 1, 1);
|
||||
node_min = blockpos_min * MAP_BLOCKSIZE;
|
||||
node_max = (blockpos_max + v3s16(1, 1, 1)) * MAP_BLOCKSIZE - v3s16(1, 1, 1);
|
||||
full_node_min = (blockpos_min - 1) * MAP_BLOCKSIZE;
|
||||
full_node_max = (blockpos_max + 2) * MAP_BLOCKSIZE - v3s16(1, 1, 1);
|
||||
|
||||
//blockseed = emerge->getBlockSeed(full_node_min);
|
||||
|
||||
// Make some noise
|
||||
calculateNoise();
|
||||
|
||||
// Calculate height map
|
||||
s16 stone_surface_max_y = calcHeightMap();
|
||||
|
||||
// Calculate biomes
|
||||
BiomeNoiseInput binput;
|
||||
binput.mapsize = v2s16(csize.X, csize.Z);
|
||||
binput.heat_map = noise_heat->result;
|
||||
binput.humidity_map = noise_humidity->result;
|
||||
binput.height_map = heightmap;
|
||||
bmgr->calcBiomes(&binput, biomemap);
|
||||
|
||||
c_stone = ndef->getId("mapgen_stone");
|
||||
c_dirt = ndef->getId("mapgen_dirt");
|
||||
c_dirt_with_grass = ndef->getId("mapgen_dirt_with_grass");
|
||||
c_sand = ndef->getId("mapgen_sand");
|
||||
c_water_source = ndef->getId("mapgen_water_source");
|
||||
|
||||
generateTerrain();
|
||||
carveRidges();
|
||||
|
||||
//carveRivers();
|
||||
addTopNodes();
|
||||
growGrass();
|
||||
|
||||
//v3s16 central_area_size = node_max - node_min + v3s16(1,1,1);
|
||||
|
||||
if (flags & MG_DUNGEONS) {
|
||||
DungeonGen dgen(ndef, data->seed, water_level);
|
||||
dgen.generate(vm, blockseed, full_node_min, full_node_max);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i != emerge->ores.size(); i++) {
|
||||
Ore *ore = emerge->ores[i];
|
||||
ore->generate(this, blockseed + i, node_min, node_max);
|
||||
}
|
||||
|
||||
//printf("makeChunk: %dms\n", t.stop());
|
||||
|
||||
updateLiquid(&data->transforming_liquid, full_node_min, full_node_max);
|
||||
|
||||
calcLighting(node_min - v3s16(1, 0, 1) * MAP_BLOCKSIZE,
|
||||
node_max + v3s16(1, 0, 1) * MAP_BLOCKSIZE);
|
||||
//setLighting(node_min, node_max, 0xFF);
|
||||
|
||||
this->generating = false;
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::calculateNoise() {
|
||||
//TimeTaker t("calculateNoise", NULL, PRECISION_MICRO);
|
||||
int x = node_min.X;
|
||||
int y = node_min.Y;
|
||||
int z = node_min.Z;
|
||||
|
||||
noise_terrain_mod->perlinMap2D(x, z);
|
||||
|
||||
noise_height_select->perlinMap2D(x, z);
|
||||
noise_height_select->transformNoiseMap();
|
||||
|
||||
noise_terrain_persist->perlinMap2D(x, z);
|
||||
float *persistmap = noise_terrain_persist->result;
|
||||
for (int i = 0; i != csize.X * csize.Z; i++)
|
||||
persistmap[i] = abs(persistmap[i]);
|
||||
|
||||
noise_terrain_base->perlinMap2DModulated(x, z, persistmap);
|
||||
noise_terrain_base->transformNoiseMap();
|
||||
|
||||
noise_terrain_alt->perlinMap2DModulated(x, z, persistmap);
|
||||
noise_terrain_alt->transformNoiseMap();
|
||||
|
||||
noise_ridge->perlinMap3D(x, y, z);
|
||||
|
||||
noise_heat->perlinMap2D(x, z);
|
||||
|
||||
noise_humidity->perlinMap2D(x, z);
|
||||
|
||||
//printf("calculateNoise: %dus\n", t.stop());
|
||||
}
|
||||
|
||||
|
||||
Biome *MapgenV7::getBiomeAtPoint(v3s16 p) {
|
||||
float heat = NoisePerlin2D(bmgr->np_heat, p.X, p.Z, seed);
|
||||
float humidity = NoisePerlin2D(bmgr->np_humidity, p.X, p.Z, seed);
|
||||
s16 groundlevel = baseTerrainLevelAtPoint(p.X, p.Z);
|
||||
|
||||
return bmgr->getBiome(heat, humidity, groundlevel);
|
||||
}
|
||||
|
||||
|
||||
float MapgenV7::baseTerrainLevelAtPoint(int x, int z) {
|
||||
float terrain_mod = NoisePerlin2DNoTxfm(noise_terrain_mod->np, x, z, seed);
|
||||
float hselect = NoisePerlin2D(noise_height_select->np, x, z, seed);
|
||||
float persist = abs(NoisePerlin2DNoTxfm(noise_terrain_persist->np, x, z, seed));
|
||||
|
||||
noise_terrain_base->np->persist = persist;
|
||||
float terrain_base = NoisePerlin2D(noise_terrain_base->np, x, z, seed);
|
||||
float height_base = terrain_base * terrain_mod;
|
||||
|
||||
noise_terrain_alt->np->persist = persist;
|
||||
float height_alt = NoisePerlin2D(noise_terrain_alt->np, x, z, seed);
|
||||
|
||||
return (height_base * hselect) + (height_alt * (1.0 - hselect));
|
||||
}
|
||||
|
||||
|
||||
float MapgenV7::baseTerrainLevelFromMap(int index) {
|
||||
float terrain_mod = noise_terrain_mod->result[index];
|
||||
float hselect = noise_height_select->result[index];
|
||||
float terrain_base = noise_terrain_base->result[index];
|
||||
float height_base = terrain_base * terrain_mod;
|
||||
float height_alt = noise_terrain_alt->result[index];
|
||||
|
||||
return (height_base * hselect) + (height_alt * (1.0 - hselect));
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// Crap code to test log rivers as a proof-of-concept. Didn't work out too well.
|
||||
void MapgenV7::carveRivers() {
|
||||
MapNode n_air(CONTENT_AIR), n_water_source(c_water_source);
|
||||
MapNode n_stone(c_stone);
|
||||
u32 index = 0;
|
||||
|
||||
int river_depth = 4;
|
||||
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
|
||||
float terrain_mod = noise_terrain_mod->result[index];
|
||||
NoiseParams *np = noise_terrain_river->np;
|
||||
np->persist = noise_terrain_persist->result[index];
|
||||
float terrain_river = NoisePerlin2DNoTxfm(np, x, z, seed);
|
||||
float height = terrain_river * (1 - abs(terrain_mod)) *
|
||||
noise_terrain_river->np->scale;
|
||||
height = log(height * height); //log(h^3) is pretty interesting for terrain
|
||||
|
||||
s16 y = heightmap[index];
|
||||
if (height < 1.0 && y > river_depth &&
|
||||
y - river_depth >= node_min.Y && y <= node_max.Y) {
|
||||
|
||||
for (s16 ry = y; ry != y - river_depth; ry--) {
|
||||
u32 vi = vm->m_area.index(x, ry, z);
|
||||
vm->m_data[vi] = n_air;
|
||||
}
|
||||
|
||||
u32 vi = vm->m_area.index(x, y - river_depth, z);
|
||||
vm->m_data[vi] = n_water_source;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int MapgenV7::calcHeightMap() {
|
||||
int stone_surface_max_y = -MAP_GENERATION_LIMIT;
|
||||
u32 index = 0;
|
||||
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
|
||||
float surface_height = baseTerrainLevelFromMap(index);
|
||||
s16 surface_y = (s16)surface_height;
|
||||
|
||||
heightmap[index] = surface_y;
|
||||
ridge_heightmap[index] = surface_y;
|
||||
|
||||
if (surface_y > stone_surface_max_y)
|
||||
stone_surface_max_y = surface_y;
|
||||
}
|
||||
|
||||
return stone_surface_max_y;
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::generateTerrain() {
|
||||
MapNode n_air(CONTENT_AIR), n_water_source(c_water_source);
|
||||
MapNode n_stone(c_stone);
|
||||
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
u32 index = 0;
|
||||
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
|
||||
s16 surface_y = heightmap[index];
|
||||
Biome *biome = bmgr->biomes[biomemap[index]];
|
||||
|
||||
u32 i = vm->m_area.index(x, node_min.Y, z);
|
||||
for (s16 y = node_min.Y; y <= node_max.Y; y++) {
|
||||
if (vm->m_data[i].getContent() == CONTENT_IGNORE) {
|
||||
if (y <= surface_y) {
|
||||
vm->m_data[i] = (y > water_level + biome->filler_height) ?
|
||||
MapNode(biome->c_filler) : n_stone;
|
||||
} else if (y <= water_level) {
|
||||
vm->m_data[i] = n_water_source;
|
||||
} else {
|
||||
vm->m_data[i] = n_air;
|
||||
}
|
||||
}
|
||||
vm->m_area.add_y(em, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::carveRidges() {
|
||||
if (node_max.Y <= water_level)
|
||||
return;
|
||||
|
||||
MapNode n_air(CONTENT_AIR);
|
||||
u32 index = 0;
|
||||
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
for (s16 y = node_min.Y; y <= node_max.Y; y++) {
|
||||
u32 vi = vm->m_area.index(node_min.X, y, z);
|
||||
for (s16 x = node_min.X; x <= node_max.X; x++, index++, vi++) {
|
||||
// Removing this check will create huge underwater caverns,
|
||||
// which are interesting but not desirable for gameplay
|
||||
if (y <= water_level)
|
||||
continue;
|
||||
|
||||
if (noise_ridge->result[index] * (float)(y * y) < 15.0)
|
||||
continue;
|
||||
|
||||
int j = (z - node_min.Z) * csize.Z + (x - node_min.X); //////obviously just temporary
|
||||
if (y < ridge_heightmap[j])
|
||||
ridge_heightmap[j] = y - 1;
|
||||
|
||||
vm->m_data[vi] = n_air;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void MapgenV7::testBiomes() {
|
||||
u32 index = 0;
|
||||
|
||||
for (s16 z = node_min.Z; z <= node_min.Z; z++)
|
||||
for (s16 x = node_min.X; x <= node_min.X; x++) {;
|
||||
Biome *b = bmgr->getBiome(heat, humidity, 0);
|
||||
}
|
||||
// make an 80x80 grid with axes heat/humidity as a voroni diagram for biomes
|
||||
// clear out y space for it first with air
|
||||
// use absolute positioning, each chunk will be a +1 height
|
||||
}*/
|
||||
|
||||
|
||||
void MapgenV7::addTopNodes() {
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
s16 ntopnodes;
|
||||
u32 index = 0;
|
||||
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
|
||||
// First, add top nodes below the ridge
|
||||
s16 y = ridge_heightmap[index];
|
||||
|
||||
// This cutoff is good enough, but not perfect.
|
||||
// It will cut off potentially placed top nodes at chunk boundaries
|
||||
if (y < node_min.Y)
|
||||
continue;
|
||||
if (y > node_max.Y) {
|
||||
y = node_max.Y; // Let's see if we can still go downward anyway
|
||||
u32 vi = vm->m_area.index(x, y, z);
|
||||
if (vm->m_data[vi].getContent() != CONTENT_AIR)
|
||||
continue;
|
||||
}
|
||||
|
||||
// N.B. It is necessary to search downward since range_heightmap[i]
|
||||
// might not be the actual height, just the lowest part in the chunk
|
||||
// where a ridge had been carved
|
||||
u32 i = vm->m_area.index(x, y, z);
|
||||
for (; y >= node_min.Y; y--) {
|
||||
if (vm->m_data[i].getContent() != CONTENT_AIR)
|
||||
break;
|
||||
vm->m_area.add_y(em, i, -1);
|
||||
}
|
||||
|
||||
Biome *biome = bmgr->biomes[biomemap[index]];
|
||||
|
||||
if (y != node_min.Y - 1) {
|
||||
ridge_heightmap[index] = y; //update ridgeheight
|
||||
ntopnodes = biome->top_depth;
|
||||
for (; y <= node_max.Y && ntopnodes; y++) {
|
||||
ntopnodes--;
|
||||
vm->m_data[i] = MapNode(biome->c_top);
|
||||
vm->m_area.add_y(em, i, 1);
|
||||
}
|
||||
//heightmap[index] = y;
|
||||
}
|
||||
|
||||
// Now, add top nodes on top of the ridge
|
||||
y = heightmap[index];
|
||||
|
||||
i = vm->m_area.index(x, y, z);
|
||||
for (; y >= node_min.Y; y--) {
|
||||
if (vm->m_data[i].getContent() != CONTENT_AIR)
|
||||
break;
|
||||
vm->m_area.add_y(em, i, -1);
|
||||
}
|
||||
|
||||
if (y != node_min.Y - 1) {
|
||||
ntopnodes = biome->top_depth;
|
||||
// Let's see if we've already added it...
|
||||
if (y == ridge_heightmap[index] + ntopnodes - 1)
|
||||
continue;
|
||||
|
||||
for (; y <= node_max.Y && ntopnodes; y++) {
|
||||
ntopnodes--;
|
||||
vm->m_data[i] = MapNode(biome->c_top);
|
||||
vm->m_area.add_y(em, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::growGrass() {
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
for (s16 x = node_min.X; x <= node_max.X; x++) {
|
||||
// Find the lowest surface to which enough light ends up to make
|
||||
// grass grow. Basically just wait until not air and not leaves.
|
||||
s16 surface_y = 0;
|
||||
{
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
u32 i = vm->m_area.index(x, node_max.Y, z);
|
||||
s16 y;
|
||||
// Go to ground level
|
||||
for (y = node_max.Y; y >= node_min.Y; y--) {
|
||||
MapNode &n = vm->m_data[i];
|
||||
if (ndef->get(n).param_type != CPT_LIGHT ||
|
||||
ndef->get(n).liquid_type != LIQUID_NONE)
|
||||
break;
|
||||
vm->m_area.add_y(em, i, -1);
|
||||
}
|
||||
surface_y = (y >= node_min.Y) ? y : node_min.Y;
|
||||
}
|
||||
|
||||
u32 i = vm->m_area.index(x, surface_y, z);
|
||||
MapNode *n = &vm->m_data[i];
|
||||
if (n->getContent() == c_dirt && surface_y >= water_level - 20)
|
||||
n->setContent(c_dirt_with_grass);
|
||||
}
|
||||
}
|
125
src/mapgen_v7.h
Normal file
125
src/mapgen_v7.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef MAPGEN_V7_HEADER
|
||||
#define MAPGEN_V7_HEADER
|
||||
|
||||
#include "mapgen.h"
|
||||
|
||||
extern NoiseParams nparams_v7_def_terrain_base;
|
||||
extern NoiseParams nparams_v7_def_terrain_alt;
|
||||
extern NoiseParams nparams_v7_def_terrain_mod;
|
||||
extern NoiseParams nparams_v7_def_terrain_persist;
|
||||
extern NoiseParams nparams_v7_def_height_select;
|
||||
extern NoiseParams nparams_v7_def_ridge;
|
||||
|
||||
struct MapgenV7Params : public MapgenParams {
|
||||
NoiseParams *np_terrain_base;
|
||||
NoiseParams *np_terrain_alt;
|
||||
NoiseParams *np_terrain_mod;
|
||||
NoiseParams *np_terrain_persist;
|
||||
NoiseParams *np_height_select;
|
||||
NoiseParams *np_ridge;
|
||||
|
||||
MapgenV7Params() {
|
||||
np_terrain_base = &nparams_v7_def_terrain_base;
|
||||
np_terrain_alt = &nparams_v7_def_terrain_alt;
|
||||
np_terrain_mod = &nparams_v7_def_terrain_mod;
|
||||
np_terrain_persist = &nparams_v7_def_terrain_persist;
|
||||
np_height_select = &nparams_v7_def_height_select;
|
||||
np_ridge = &nparams_v7_def_ridge;
|
||||
}
|
||||
|
||||
bool readParams(Settings *settings);
|
||||
void writeParams(Settings *settings);
|
||||
};
|
||||
|
||||
class MapgenV7 : public Mapgen {
|
||||
public:
|
||||
EmergeManager *emerge;
|
||||
BiomeDefManager *bmgr;
|
||||
|
||||
int ystride;
|
||||
v3s16 csize;
|
||||
u32 flags;
|
||||
|
||||
u32 blockseed;
|
||||
v3s16 node_min;
|
||||
v3s16 node_max;
|
||||
v3s16 full_node_min;
|
||||
v3s16 full_node_max;
|
||||
|
||||
s16 *heightmap;
|
||||
s16 *ridge_heightmap;
|
||||
u8 *biomemap;
|
||||
|
||||
Noise *noise_terrain_base;
|
||||
Noise *noise_terrain_alt;
|
||||
Noise *noise_terrain_mod;
|
||||
Noise *noise_terrain_persist;
|
||||
Noise *noise_height_select;
|
||||
|
||||
Noise *noise_ridge;
|
||||
|
||||
Noise *noise_heat;
|
||||
Noise *noise_humidity;
|
||||
|
||||
content_t c_stone;
|
||||
content_t c_dirt;
|
||||
content_t c_dirt_with_grass;
|
||||
content_t c_sand;
|
||||
content_t c_water_source;
|
||||
content_t c_lava_source;
|
||||
content_t c_gravel;
|
||||
content_t c_cobble;
|
||||
content_t c_desert_sand;
|
||||
content_t c_desert_stone;
|
||||
|
||||
MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge);
|
||||
~MapgenV7();
|
||||
|
||||
void makeChunk(BlockMakeData *data);
|
||||
int getGroundLevelAtPoint(v2s16 p);
|
||||
Biome *getBiomeAtPoint(v3s16 p);
|
||||
|
||||
float baseTerrainLevelAtPoint(int x, int z);
|
||||
float baseTerrainLevelFromMap(int index);
|
||||
void calculateNoise();
|
||||
int calcHeightMap();
|
||||
|
||||
void generateTerrain();
|
||||
void carveRidges();
|
||||
//void carveRivers(); //experimental
|
||||
|
||||
void testBiomes();
|
||||
void addTopNodes();
|
||||
void growGrass();
|
||||
};
|
||||
|
||||
struct MapgenFactoryV7 : public MapgenFactory {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
|
||||
return new MapgenV7(mgid, (MapgenV7Params *)params, emerge);
|
||||
};
|
||||
|
||||
MapgenParams *createMapgenParams() {
|
||||
return new MapgenV7Params();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@ -593,7 +593,7 @@ public:
|
||||
{
|
||||
tiledef[j] = f->tiledef[j];
|
||||
if(tiledef[j].name == "")
|
||||
tiledef[j].name = "unknown_block.png";
|
||||
tiledef[j].name = "unknown_node.png";
|
||||
}
|
||||
|
||||
bool is_liquid = false;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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
|
||||
@ -536,6 +537,41 @@ float *Noise::perlinMap2D(float x, float y) {
|
||||
}
|
||||
|
||||
|
||||
float *Noise::perlinMap2DModulated(float x, float y, float *persist_map) {
|
||||
float f = 1.0;
|
||||
int i, j, index, oct;
|
||||
|
||||
x /= np->spread.X;
|
||||
y /= np->spread.Y;
|
||||
|
||||
memset(result, 0, sizeof(float) * sx * sy);
|
||||
|
||||
float *g = new float[sx * sy];
|
||||
for (index = 0; index != sx * sy; index++)
|
||||
g[index] = 1.0;
|
||||
|
||||
for (oct = 0; oct < np->octaves; oct++) {
|
||||
gradientMap2D(x * f, y * f,
|
||||
f / np->spread.X, f / np->spread.Y,
|
||||
seed + np->seed + oct);
|
||||
|
||||
index = 0;
|
||||
for (j = 0; j != sy; j++) {
|
||||
for (i = 0; i != sx; i++) {
|
||||
result[index] += g[index] * buf[index];
|
||||
g[index] *= persist_map[index];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
f *= 2.0;
|
||||
}
|
||||
|
||||
delete[] g;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
float *Noise::perlinMap3D(float x, float y, float z) {
|
||||
float f = 1.0, g = 1.0;
|
||||
int i, j, k, index, oct;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
|
||||
|
||||
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
|
||||
@ -105,6 +106,7 @@ public:
|
||||
float step_x, float step_y, float step_z,
|
||||
int seed);
|
||||
float *perlinMap2D(float x, float y);
|
||||
float *perlinMap2DModulated(float x, float y, float *persist_map);
|
||||
float *perlinMap3D(float x, float y, float z);
|
||||
void transformNoiseMap();
|
||||
};
|
||||
|
1081
src/pathfinder.cpp
Normal file
1081
src/pathfinder.cpp
Normal file
File diff suppressed because it is too large
Load Diff
345
src/pathfinder.h
Normal file
345
src/pathfinder.h
Normal file
@ -0,0 +1,345 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2013 sapier, sapier at gmx dot net
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef PATHFINDER_H_
|
||||
#define PATHFINDER_H_
|
||||
|
||||
/******************************************************************************/
|
||||
/* Includes */
|
||||
/******************************************************************************/
|
||||
#include <vector>
|
||||
|
||||
#include "server.h"
|
||||
#include "irr_v3d.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Typedefs and macros */
|
||||
/******************************************************************************/
|
||||
|
||||
//#define PATHFINDER_DEBUG
|
||||
|
||||
typedef enum {
|
||||
DIR_XP,
|
||||
DIR_XM,
|
||||
DIR_ZP,
|
||||
DIR_ZM
|
||||
} path_directions;
|
||||
|
||||
/** List of supported algorithms */
|
||||
typedef enum {
|
||||
DIJKSTRA, /**< Dijkstra shortest path algorithm */
|
||||
A_PLAIN, /**< A* algorithm using heuristics to find a path */
|
||||
A_PLAIN_NP /**< A* algorithm without prefetching of map data */
|
||||
} algorithm;
|
||||
|
||||
/******************************************************************************/
|
||||
/* declarations */
|
||||
/******************************************************************************/
|
||||
|
||||
/** c wrapper function to use from scriptapi */
|
||||
std::vector<v3s16> get_Path(ServerEnvironment* env,
|
||||
v3s16 source,
|
||||
v3s16 destination,
|
||||
unsigned int searchdistance,
|
||||
unsigned int max_jump,
|
||||
unsigned int max_drop,
|
||||
algorithm algo);
|
||||
|
||||
/** representation of cost in specific direction */
|
||||
class path_cost {
|
||||
public:
|
||||
|
||||
/** default constructor */
|
||||
path_cost();
|
||||
|
||||
/** copy constructor */
|
||||
path_cost(const path_cost& b);
|
||||
|
||||
/** assignment operator */
|
||||
path_cost& operator= (const path_cost& b);
|
||||
|
||||
bool valid; /**< movement is possible */
|
||||
int value; /**< cost of movement */
|
||||
int direction; /**< y-direction of movement */
|
||||
bool updated; /**< this cost has ben calculated */
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** representation of a mapnode to be used for pathfinding */
|
||||
class path_gridnode {
|
||||
|
||||
public:
|
||||
/** default constructor */
|
||||
path_gridnode();
|
||||
|
||||
/** copy constructor */
|
||||
path_gridnode(const path_gridnode& b);
|
||||
|
||||
/**
|
||||
* assignment operator
|
||||
* @param b node to copy
|
||||
*/
|
||||
path_gridnode& operator= (const path_gridnode& b);
|
||||
|
||||
/**
|
||||
* read cost in a specific direction
|
||||
* @param dir direction of cost to fetch
|
||||
*/
|
||||
path_cost get_cost(v3s16 dir);
|
||||
|
||||
/**
|
||||
* set cost value for movement
|
||||
* @param dir direction to set cost for
|
||||
* @cost cost to set
|
||||
*/
|
||||
void set_cost(v3s16 dir,path_cost cost);
|
||||
|
||||
bool valid; /**< node is on surface */
|
||||
bool target; /**< node is target position */
|
||||
bool source; /**< node is stating position */
|
||||
int totalcost; /**< cost to move here from starting point */
|
||||
v3s16 sourcedir; /**< origin of movement for current cost */
|
||||
int surfaces; /**< number of surfaces with same x,z value*/
|
||||
v3s16 pos; /**< real position of node */
|
||||
path_cost directions[4]; /**< cost in different directions */
|
||||
|
||||
/* debug values */
|
||||
bool is_element; /**< node is element of path detected */
|
||||
char type; /**< type of node */
|
||||
};
|
||||
|
||||
/** class doing pathfinding */
|
||||
class pathfinder {
|
||||
|
||||
public:
|
||||
/**
|
||||
* default constructor
|
||||
*/
|
||||
pathfinder();
|
||||
|
||||
/**
|
||||
* path evaluation function
|
||||
* @param env environment to look for path
|
||||
* @param source origin of path
|
||||
* @param destination end position of path
|
||||
* @param searchdistance maximum number of nodes to look in each direction
|
||||
* @param max_jump maximum number of blocks a path may jump up
|
||||
* @param max_drop maximum number of blocks a path may drop
|
||||
* @param algo algorithm to use for finding a path
|
||||
*/
|
||||
std::vector<v3s16> get_Path(ServerEnvironment* env,
|
||||
v3s16 source,
|
||||
v3s16 destination,
|
||||
unsigned int searchdistance,
|
||||
unsigned int max_jump,
|
||||
unsigned int max_drop,
|
||||
algorithm algo);
|
||||
|
||||
private:
|
||||
/** data struct for storing internal information */
|
||||
struct limits {
|
||||
struct limit {
|
||||
int min;
|
||||
int max;
|
||||
};
|
||||
|
||||
limit X;
|
||||
limit Y;
|
||||
limit Z;
|
||||
};
|
||||
|
||||
/* helper functions */
|
||||
|
||||
/**
|
||||
* transform index pos to mappos
|
||||
* @param ipos a index position
|
||||
* @return map position
|
||||
*/
|
||||
v3s16 getRealPos(v3s16 ipos);
|
||||
|
||||
/**
|
||||
* transform mappos to index pos
|
||||
* @param pos a real pos
|
||||
* @return index position
|
||||
*/
|
||||
v3s16 getIndexPos(v3s16 pos);
|
||||
|
||||
/**
|
||||
* get gridnode at a specific index position
|
||||
* @param ipos index position
|
||||
* @return gridnode for index
|
||||
*/
|
||||
path_gridnode& getIndexElement(v3s16 ipos);
|
||||
|
||||
/**
|
||||
* invert a 3d position
|
||||
* @param pos 3d position
|
||||
* @return pos *-1
|
||||
*/
|
||||
v3s16 invert(v3s16 pos);
|
||||
|
||||
/**
|
||||
* check if a index is within current search area
|
||||
* @param index position to validate
|
||||
* @return true/false
|
||||
*/
|
||||
bool valid_index(v3s16 index);
|
||||
|
||||
/**
|
||||
* translate position to float position
|
||||
* @param pos integer position
|
||||
* @return float position
|
||||
*/
|
||||
v3f tov3f(v3s16 pos);
|
||||
|
||||
|
||||
/* algorithm functions */
|
||||
|
||||
/**
|
||||
* calculate 2d manahttan distance to target
|
||||
* @param pos position to calc distance
|
||||
* @return integer distance
|
||||
*/
|
||||
int get_manhattandistance(v3s16 pos);
|
||||
|
||||
/**
|
||||
* get best direction based uppon heuristics
|
||||
* @param directions list of unchecked directions
|
||||
* @param g_pos mapnode to start from
|
||||
* @return direction to check
|
||||
*/
|
||||
v3s16 get_dir_heuristic(std::vector<v3s16>& directions,path_gridnode& g_pos);
|
||||
|
||||
/**
|
||||
* build internal data representation of search area
|
||||
* @return true/false if costmap creation was successfull
|
||||
*/
|
||||
bool build_costmap();
|
||||
|
||||
/**
|
||||
* calculate cost of movement
|
||||
* @param pos real world position to start movement
|
||||
* @param dir direction to move to
|
||||
* @return cost information
|
||||
*/
|
||||
path_cost calc_cost(v3s16 pos,v3s16 dir);
|
||||
|
||||
/**
|
||||
* recursive update whole search areas total cost information
|
||||
* @param ipos position to check next
|
||||
* @param srcdir positionc checked last time
|
||||
* @param total_cost cost of moving to ipos
|
||||
* @param level current recursion depth
|
||||
* @return true/false path to destination has been found
|
||||
*/
|
||||
bool update_all_costs(v3s16 ipos,v3s16 srcdir,int total_cost,int level);
|
||||
|
||||
/**
|
||||
* recursive try to find a patrh to destionation
|
||||
* @param ipos position to check next
|
||||
* @param srcdir positionc checked last time
|
||||
* @param total_cost cost of moving to ipos
|
||||
* @param level current recursion depth
|
||||
* @return true/false path to destination has been found
|
||||
*/
|
||||
bool update_cost_heuristic(v3s16 ipos,v3s16 srcdir,int current_cost,int level);
|
||||
|
||||
/**
|
||||
* recursive build a vector containing all nodes from source to destination
|
||||
* @param path vector to add nodes to
|
||||
* @param pos pos to check next
|
||||
* @param level recursion depth
|
||||
*/
|
||||
void build_path(std::vector<v3s16>& path,v3s16 pos, int level);
|
||||
|
||||
/* variables */
|
||||
int m_max_index_x; /**< max index of search area in x direction */
|
||||
int m_max_index_y; /**< max index of search area in y direction */
|
||||
int m_max_index_z; /**< max index of search area in z direction */
|
||||
|
||||
|
||||
int m_searchdistance; /**< max distance to search in each direction */
|
||||
int m_maxdrop; /**< maximum number of blocks a path may drop */
|
||||
int m_maxjump; /**< maximum number of blocks a path may jump */
|
||||
int m_min_target_distance; /**< current smalest path to target */
|
||||
|
||||
bool m_prefetch; /**< prefetch cost data */
|
||||
|
||||
v3s16 m_start; /**< source position */
|
||||
v3s16 m_destination; /**< destination position */
|
||||
|
||||
limits m_limits; /**< position limits in real map coordinates */
|
||||
|
||||
/** 3d grid containing all map data already collected and analyzed */
|
||||
std::vector<std::vector<std::vector<path_gridnode> > > m_data;
|
||||
|
||||
ServerEnvironment* m_env; /**< minetest environment pointer */
|
||||
|
||||
#ifdef PATHFINDER_DEBUG
|
||||
|
||||
/**
|
||||
* print collected cost information
|
||||
*/
|
||||
void print_cost();
|
||||
|
||||
/**
|
||||
* print collected cost information in a specific direction
|
||||
* @param dir direction to print
|
||||
*/
|
||||
void print_cost(path_directions dir);
|
||||
|
||||
/**
|
||||
* print type of node as evaluated
|
||||
*/
|
||||
void print_type();
|
||||
|
||||
/**
|
||||
* print pathlenght for all nodes in search area
|
||||
*/
|
||||
void print_pathlen();
|
||||
|
||||
/**
|
||||
* print a path
|
||||
* @param path path to show
|
||||
*/
|
||||
void print_path(std::vector<v3s16> path);
|
||||
|
||||
/**
|
||||
* print y direction for all movements
|
||||
*/
|
||||
void print_ydir();
|
||||
|
||||
/**
|
||||
* print y direction for moving in a specific direction
|
||||
* @param dir direction to show data
|
||||
*/
|
||||
void print_ydir(path_directions dir);
|
||||
|
||||
/**
|
||||
* helper function to translate a direction to speaking text
|
||||
* @param dir direction to translate
|
||||
* @return textual name of direction
|
||||
*/
|
||||
std::string dir_to_name(path_directions dir);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* PATHFINDER_H_ */
|
@ -71,6 +71,11 @@ Player::Player(IGameDef *gamedef):
|
||||
movement_liquid_fluidity_smooth = 0.5 * BS;
|
||||
movement_liquid_sink = 10 * BS;
|
||||
movement_gravity = 9.81 * BS;
|
||||
|
||||
// Movement overrides are multipliers and must be 1 by default
|
||||
physics_override_speed = 1;
|
||||
physics_override_jump = 1;
|
||||
physics_override_gravity = 1;
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
@ -222,6 +222,10 @@ public:
|
||||
f32 movement_liquid_sink;
|
||||
f32 movement_gravity;
|
||||
|
||||
float physics_override_speed;
|
||||
float physics_override_jump;
|
||||
float physics_override_gravity;
|
||||
|
||||
u16 hp;
|
||||
|
||||
float hurt_tilt_timer;
|
||||
|
@ -616,76 +616,36 @@ static int l_get_server_status(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// register_biome_groups({frequencies})
|
||||
static int l_register_biome_groups(lua_State *L)
|
||||
{
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
int index = 1;
|
||||
|
||||
BiomeDefManager *bmgr = get_server(L)->getBiomeDef();
|
||||
if (!bmgr) {
|
||||
verbosestream << "register_biome_groups: BiomeDefManager not active" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lua_pushnil(L);
|
||||
for (int i = 1; lua_next(L, index) != 0; i++) {
|
||||
bmgr->addBiomeGroup(lua_tonumber(L, -1));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// register_biome({lots of stuff})
|
||||
static int l_register_biome(lua_State *L)
|
||||
{
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
int index = 1, groupid;
|
||||
std::string nodename;
|
||||
int index = 1;
|
||||
luaL_checktype(L, index, LUA_TTABLE);
|
||||
|
||||
IWritableNodeDefManager *ndef = get_server(L)->getWritableNodeDefManager();
|
||||
BiomeDefManager *bmgr = get_server(L)->getBiomeDef();
|
||||
BiomeDefManager *bmgr = get_server(L)->getEmergeManager()->biomedef;
|
||||
if (!bmgr) {
|
||||
verbosestream << "register_biome: BiomeDefManager not active" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
groupid = getintfield_default(L, index, "group_id", 0);
|
||||
|
||||
|
||||
enum BiomeTerrainType terrain = (BiomeTerrainType)getenumfield(L, index,
|
||||
"terrain_type", es_BiomeTerrainType, BIOME_TERRAIN_NORMAL);
|
||||
Biome *b = bmgr->createBiome(terrain);
|
||||
|
||||
b->name = getstringfield_default(L, index, "name", "");
|
||||
|
||||
if (getstringfield(L, index, "node_top", nodename))
|
||||
b->n_top = MapNode(ndef->getId(nodename));
|
||||
else
|
||||
b->n_top = MapNode(CONTENT_IGNORE);
|
||||
|
||||
if (getstringfield(L, index, "node_filler", nodename))
|
||||
b->n_filler = MapNode(ndef->getId(nodename));
|
||||
else
|
||||
b->n_filler = b->n_top;
|
||||
|
||||
b->ntopnodes = getintfield_default(L, index, "num_top_nodes", 0);
|
||||
|
||||
b->height_min = getintfield_default(L, index, "height_min", 0);
|
||||
b->height_max = getintfield_default(L, index, "height_max", 0);
|
||||
b->heat_min = getfloatfield_default(L, index, "heat_min", 0.);
|
||||
b->heat_max = getfloatfield_default(L, index, "heat_max", 0.);
|
||||
b->humidity_min = getfloatfield_default(L, index, "humidity_min", 0.);
|
||||
b->humidity_max = getfloatfield_default(L, index, "humidity_max", 0.);
|
||||
|
||||
b->np = new NoiseParams; // should read an entire NoiseParams later on...
|
||||
getfloatfield(L, index, "scale", b->np->scale);
|
||||
getfloatfield(L, index, "offset", b->np->offset);
|
||||
|
||||
b->groupid = (s8)groupid;
|
||||
b->flags = 0; //reserved
|
||||
b->name = getstringfield_default(L, index, "name", "");
|
||||
b->top_nodename = getstringfield_default(L, index, "top_node", "");
|
||||
b->top_depth = getintfield_default(L, index, "top_depth", 0);
|
||||
b->filler_nodename = getstringfield_default(L, index, "filler_node", "");
|
||||
b->filler_height = getintfield_default(L, index, "filler_height", 0);
|
||||
b->height_min = getintfield_default(L, index, "height_min", 0);
|
||||
b->height_max = getintfield_default(L, index, "height_max", 0);
|
||||
b->heat_point = getfloatfield_default(L, index, "heat_point", 0.);
|
||||
b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.);
|
||||
|
||||
b->flags = 0; //reserved
|
||||
b->c_top = CONTENT_IGNORE;
|
||||
b->c_filler = CONTENT_IGNORE;
|
||||
bmgr->addBiome(b);
|
||||
|
||||
verbosestream << "register_biome: " << b->name << std::endl;
|
||||
@ -698,7 +658,6 @@ static int l_register_ore(lua_State *L)
|
||||
int index = 1;
|
||||
luaL_checktype(L, index, LUA_TTABLE);
|
||||
|
||||
IWritableNodeDefManager *ndef = get_server(L)->getWritableNodeDefManager();
|
||||
EmergeManager *emerge = get_server(L)->getEmergeManager();
|
||||
|
||||
enum OreType oretype = (OreType)getenumfield(L, index,
|
||||
@ -1113,7 +1072,6 @@ static const struct luaL_Reg minetest_f [] = {
|
||||
{"register_alias_raw", l_register_alias_raw},
|
||||
{"register_craft", l_register_craft},
|
||||
{"register_biome", l_register_biome},
|
||||
{"register_biome_groups", l_register_biome_groups},
|
||||
{"register_ore", l_register_ore},
|
||||
{"setting_set", l_setting_set},
|
||||
{"setting_get", l_setting_get},
|
||||
|
@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "content_sao.h"
|
||||
#include "script.h"
|
||||
#include "treegen.h"
|
||||
#include "pathfinder.h"
|
||||
#include "util/pointedthing.h"
|
||||
#include "scriptapi_types.h"
|
||||
#include "scriptapi_noise.h"
|
||||
@ -647,6 +648,69 @@ int EnvRef::l_clear_objects(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EnvRef::l_line_of_sight(lua_State *L) {
|
||||
float stepsize = 1.0;
|
||||
|
||||
//infostream<<"EnvRef::l_get_node()"<<std::endl;
|
||||
EnvRef *o = checkobject(L, 1);
|
||||
ServerEnvironment *env = o->m_env;
|
||||
if(env == NULL) return 0;
|
||||
|
||||
// read position 1 from lua
|
||||
v3f pos1 = checkFloatPos(L, 2);
|
||||
// read position 2 from lua
|
||||
v3f pos2 = checkFloatPos(L, 2);
|
||||
//read step size from lua
|
||||
if(lua_isnumber(L, 3))
|
||||
stepsize = lua_tonumber(L, 3);
|
||||
|
||||
return (env->line_of_sight(pos1,pos2,stepsize));
|
||||
}
|
||||
|
||||
int EnvRef::l_find_path(lua_State *L)
|
||||
{
|
||||
EnvRef *o = checkobject(L, 1);
|
||||
ServerEnvironment *env = o->m_env;
|
||||
|
||||
if(env == NULL) return 0;
|
||||
|
||||
v3s16 pos1 = read_v3s16(L, 2);
|
||||
v3s16 pos2 = read_v3s16(L, 3);
|
||||
unsigned int searchdistance = luaL_checkint(L, 4);
|
||||
unsigned int max_jump = luaL_checkint(L, 5);
|
||||
unsigned int max_drop = luaL_checkint(L, 6);
|
||||
algorithm algo = A_PLAIN_NP;
|
||||
if(! lua_isnil(L, 7)) {
|
||||
std::string algorithm = luaL_checkstring(L,7);
|
||||
|
||||
if (algorithm == "A*")
|
||||
algo = A_PLAIN;
|
||||
|
||||
if (algorithm == "Dijkstra")
|
||||
algo = DIJKSTRA;
|
||||
}
|
||||
|
||||
std::vector<v3s16> path =
|
||||
get_Path(env,pos1,pos2,searchdistance,max_jump,max_drop,algo);
|
||||
|
||||
if (path.size() > 0)
|
||||
{
|
||||
lua_newtable(L);
|
||||
int top = lua_gettop(L);
|
||||
unsigned int index = 1;
|
||||
for (std::vector<v3s16>::iterator i = path.begin(); i != path.end();i++)
|
||||
{
|
||||
lua_pushnumber(L,index);
|
||||
push_v3s16(L, *i);
|
||||
lua_settable(L, top);
|
||||
index++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EnvRef::l_spawn_tree(lua_State *L)
|
||||
{
|
||||
EnvRef *o = checkobject(L, 1);
|
||||
@ -780,6 +844,8 @@ const luaL_reg EnvRef::methods[] = {
|
||||
luamethod(EnvRef, get_perlin_map),
|
||||
luamethod(EnvRef, clear_objects),
|
||||
luamethod(EnvRef, spawn_tree),
|
||||
luamethod(EnvRef, line_of_sight),
|
||||
luamethod(EnvRef, find_path),
|
||||
{0,0}
|
||||
};
|
||||
|
||||
|
@ -137,6 +137,12 @@ private:
|
||||
|
||||
static int l_spawn_tree(lua_State *L);
|
||||
|
||||
|
||||
static int l_line_of_sight(lua_State *L);
|
||||
|
||||
//find a path between two positions
|
||||
static int l_find_path(lua_State *L);
|
||||
|
||||
public:
|
||||
EnvRef(ServerEnvironment *env);
|
||||
|
||||
|
@ -297,6 +297,28 @@ int ObjectRef::l_set_armor_groups(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// set_physics_override(self, physics_override_speed, physics_override_jump, physics_override_gravity)
|
||||
int ObjectRef::l_set_physics_override(lua_State *L)
|
||||
{
|
||||
ObjectRef *ref = checkobject(L, 1);
|
||||
PlayerSAO *co = (PlayerSAO *) getobject(ref);
|
||||
if(co == NULL) return 0;
|
||||
// Do it
|
||||
if(!lua_isnil(L, 2)){
|
||||
co->m_physics_override_speed = lua_tonumber(L, 2);
|
||||
co->m_physics_override_sent = false;
|
||||
}
|
||||
if(!lua_isnil(L, 3)){
|
||||
co->m_physics_override_jump = lua_tonumber(L, 3);
|
||||
co->m_physics_override_sent = false;
|
||||
}
|
||||
if(!lua_isnil(L, 4)){
|
||||
co->m_physics_override_gravity = lua_tonumber(L, 4);
|
||||
co->m_physics_override_sent = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// set_animation(self, frame_range, frame_speed, frame_blend)
|
||||
int ObjectRef::l_set_animation(lua_State *L)
|
||||
{
|
||||
@ -756,6 +778,7 @@ const luaL_reg ObjectRef::methods[] = {
|
||||
luamethod(ObjectRef, get_wielded_item),
|
||||
luamethod(ObjectRef, set_wielded_item),
|
||||
luamethod(ObjectRef, set_armor_groups),
|
||||
luamethod(ObjectRef, set_physics_override),
|
||||
luamethod(ObjectRef, set_animation),
|
||||
luamethod(ObjectRef, set_bone_position),
|
||||
luamethod(ObjectRef, set_attach),
|
||||
|
@ -103,6 +103,9 @@ private:
|
||||
// set_armor_groups(self, groups)
|
||||
static int l_set_armor_groups(lua_State *L);
|
||||
|
||||
// set_physics_override(self, physics_override_speed, physics_override_jump, physics_override_gravity)
|
||||
static int l_set_physics_override(lua_State *L);
|
||||
|
||||
// set_animation(self, frame_range, frame_speed, frame_blend)
|
||||
static int l_set_animation(lua_State *L);
|
||||
|
||||
|
@ -646,7 +646,6 @@ Server::Server(
|
||||
m_rollback_sink_enabled(true),
|
||||
m_enable_rollback_recording(false),
|
||||
m_emerge(NULL),
|
||||
m_biomedef(NULL),
|
||||
m_lua(NULL),
|
||||
m_itemdef(createItemDefManager()),
|
||||
m_nodedef(createNodeDefManager()),
|
||||
@ -694,12 +693,9 @@ Server::Server(
|
||||
Settings gamedefaults;
|
||||
getGameMinetestConfig(gamespec.path, gamedefaults);
|
||||
override_default_settings(g_settings, &gamedefaults);
|
||||
|
||||
// Create biome definition manager
|
||||
m_biomedef = new BiomeDefManager(this);
|
||||
|
||||
// Create emerge manager
|
||||
m_emerge = new EmergeManager(this, m_biomedef);
|
||||
m_emerge = new EmergeManager(this);
|
||||
|
||||
// Create rollback manager
|
||||
std::string rollback_path = m_path_world+DIR_DELIM+"rollback.txt";
|
||||
@ -813,9 +809,6 @@ Server::Server(
|
||||
// Apply item aliases in the node definition manager
|
||||
m_nodedef->updateAliases(m_itemdef);
|
||||
|
||||
// Add default biomes after nodedef had its aliases added
|
||||
m_biomedef->addDefaultBiomes();
|
||||
|
||||
// Initialize Environment
|
||||
ServerMap *servermap = new ServerMap(path_world, this, m_emerge);
|
||||
m_env = new ServerEnvironment(servermap, m_lua, this, this);
|
||||
|
@ -485,7 +485,6 @@ public:
|
||||
void deleteParticleSpawner(const char *playername, u32 id);
|
||||
void deleteParticleSpawnerAll(u32 id);
|
||||
|
||||
|
||||
void queueBlockEmerge(v3s16 blockpos, bool allow_generate);
|
||||
|
||||
// Creates or resets inventory
|
||||
@ -497,11 +496,9 @@ public:
|
||||
// Envlock should be locked when using the rollback manager
|
||||
IRollbackManager *getRollbackManager(){ return m_rollback; }
|
||||
|
||||
//TODO: determine what should be locked when accessing the emerge manager
|
||||
//TODO: determine what (if anything) should be locked to access EmergeManager
|
||||
EmergeManager *getEmergeManager(){ return m_emerge; }
|
||||
|
||||
BiomeDefManager *getBiomeDef(){ return m_biomedef; }
|
||||
|
||||
// actions: time-reversed list
|
||||
// Return value: success/failure
|
||||
bool rollbackRevertActions(const std::list<RollbackAction> &actions,
|
||||
@ -734,9 +731,6 @@ private:
|
||||
// Emerge manager
|
||||
EmergeManager *m_emerge;
|
||||
|
||||
// Biome Definition Manager
|
||||
BiomeDefManager *m_biomedef;
|
||||
|
||||
// Scripting
|
||||
// Envlock and conlock should be locked when using Lua
|
||||
lua_State *m_lua;
|
||||
|
@ -152,6 +152,8 @@ public:
|
||||
|
||||
virtual void setArmorGroups(const ItemGroupList &armor_groups)
|
||||
{}
|
||||
virtual void setPhysicsOverride(float physics_override_speed, float physics_override_jump, float physics_override_gravity)
|
||||
{}
|
||||
virtual void setAnimation(v2f frames, float frame_speed, float frame_blend)
|
||||
{}
|
||||
virtual void setBonePosition(std::string bone, v3f position, v3f rotation)
|
||||
|
@ -826,7 +826,7 @@ void TextureSource::rebuildImagesAndTextures()
|
||||
video::ITexture *t = NULL;
|
||||
if(img)
|
||||
t = driver->addTexture(sap->name.c_str(), img);
|
||||
|
||||
video::ITexture *t_old = sap->a.atlas;
|
||||
// Replace texture
|
||||
sap->a.atlas = t;
|
||||
sap->a.pos = v2f(0,0);
|
||||
@ -835,6 +835,9 @@ void TextureSource::rebuildImagesAndTextures()
|
||||
sap->atlas_img = img;
|
||||
sap->intpos = v2s32(0,0);
|
||||
sap->intsize = img->getDimension();
|
||||
|
||||
if (t_old != 0)
|
||||
driver->removeTexture(t_old);
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 582 B |
BIN
textures/base/pack/unknown_node.png
Normal file
BIN
textures/base/pack/unknown_node.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 608 B |
Loading…
Reference in New Issue
Block a user