aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/environment.cpp6
-rw-r--r--src/environment.h19
-rw-r--r--src/main.cpp29
-rw-r--r--src/map.cpp13
-rw-r--r--src/mapnode.cpp4
-rw-r--r--src/mapnode.h10
-rw-r--r--src/server.cpp2
7 files changed, 68 insertions, 15 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index f233eaf7f..3ebfef0c5 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -739,7 +739,7 @@ void ServerEnvironment::step(float dtime)
if(1)
{
MapNode n_top = block->getNodeNoEx(p0+v3s16(0,1,0));
- if(content_features(n_top.d).walkable == false &&
+ if(content_features(n_top.d).air_equivalent &&
n_top.getLight(LIGHTBANK_DAY) >= 13)
{
n.d = CONTENT_GRASS;
@@ -796,10 +796,10 @@ void ServerEnvironment::step(float dtime)
// Convert mud under proper lighting to grass
if(n.d == CONTENT_MUD)
{
- if(myrand()%4 == 0)
+ if(myrand()%10 == 0)
{
MapNode n_top = block->getNodeNoEx(p0+v3s16(0,1,0));
- if(content_features(n_top.d).walkable == false &&
+ if(content_features(n_top.d).air_equivalent &&
n_top.getLightBlend(getDayNightRatio()) >= 13)
{
n.d = CONTENT_GRASS;
diff --git a/src/environment.h b/src/environment.h
index e32b15dbb..ac290f932 100644
--- a/src/environment.h
+++ b/src/environment.h
@@ -113,6 +113,25 @@ private:
};
/*
+ Active block modifier interface
+*/
+
+class ServerEnvironment;
+
+class ActiveBlockModifier
+{
+public:
+ ActiveBlockModifier(){};
+ virtual ~ActiveBlockModifier(){};
+
+ virtual u32 getTriggerContentCount(){ return 1;}
+ virtual u8 getTriggerContent(u32 i) = 0;
+ virtual float getActiveInterval() = 0;
+ virtual u32 getActiveChance() = 0;
+ virtual void triggerEvent(ServerEnvironment *env, v3s16 p) = 0;
+};
+
+/*
The server-side environment.
This is not thread-safe. Server uses an environment mutex.
diff --git a/src/main.cpp b/src/main.cpp
index 2913d019d..f67d53475 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -85,6 +85,10 @@ SUGG: Server-side objects could be moved based on nodes to enable very
lightweight operation and simple AI
- Not practical; client would still need to show smooth movement.
+SUGG: Make a system for pregenerating quick information for mapblocks, so
+ that the client can show them as cubes before they are actually sent
+ or even generated.
+
Gaming ideas:
-------------
@@ -211,6 +215,9 @@ FIXME: Server sometimes goes into some infinite PeerNotFoundException loop
FIXME: The new optimized map sending doesn't sometimes send enough blocks
from big caves and such
+Environment:
+------------
+
TODO: A list of "active blocks" in which stuff happens.
+ Add a never-resetted game timer to the server
+ Add a timestamp value to blocks
@@ -289,18 +296,22 @@ Mapgen v2:
Misc. stuff:
------------
-* Make an "environment metafile" to store at least time of day
-* Move digging property stuff from material.{h,cpp} to mapnode.cpp...
- - Or maybe move content_features to material.{h,cpp}?
-* Maybe:
- Make a system for pregenerating quick information for mapblocks, so
- that the client can show them as cubes before they are actually sent
- or even generated.
+* Move digging property stuff from material.{h,cpp} to mapnode.cpp
+ - ...Or maybe move content_features to material.{h,cpp}?
Making it more portable:
------------------------
-* Some MSVC: std::sto* are defined without a namespace and collide
- with the ones in utility.h
+
+Stuff to do before release:
+---------------------------
+- Player default privileges and default password
+- Chat privilege
+- Some simple block-based dynamic stuff in the world (finish the
+ ActiveBlockModifier stuff)
+- Protocol version field
+- Consider getting some textures from cisoun's texture pack
+- Add a long step function to objects that is called with the time
+ difference when block activates
======================================================================
diff --git a/src/map.cpp b/src/map.cpp
index c681a24b7..a49de3c46 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -3586,7 +3586,18 @@ void ServerMap::initChunkMake(ChunkMakeData &data, v2s16 chunkpos)
sectorpos_base - v2s16(1,1) * max_spread_amount_sectors;
s16 sectorpos_bigbase_size =
sectorpos_base_size + 2 * max_spread_amount_sectors;
-
+
+ // Check limits
+ const s16 limit = MAP_GENERATION_LIMIT / MAP_BLOCKSIZE;
+ if(sectorpos_bigbase.X < -limit
+ || sectorpos_bigbase.X + sectorpos_bigbase_size >= limit
+ || sectorpos_bigbase.Y < -limit
+ || sectorpos_bigbase.Y + sectorpos_bigbase_size >= limit)
+ {
+ data.no_op = true;
+ return;
+ }
+
data.seed = m_seed;
data.chunkpos = chunkpos;
data.y_blocks_min = y_blocks_min;
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index 199a5c656..ca36697ef 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -223,6 +223,7 @@ void init_mapnode()
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
f->solidness = 0; // drawn separately, makes no faces
+ f->air_equivalent = true; // grass grows underneath
// Deprecated
i = CONTENT_COALSTONE;
@@ -259,6 +260,7 @@ void init_mapnode()
f->pointable = false;
f->diggable = false;
f->buildable_to = true;
+ f->air_equivalent = true;
i = CONTENT_WATER;
f = &g_content_features[i];
@@ -310,6 +312,7 @@ void init_mapnode()
f->solidness = 0; // drawn separately, makes no faces
f->walkable = false;
f->wall_mounted = true;
+ f->air_equivalent = true;
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
i = CONTENT_SIGN_WALL;
@@ -321,6 +324,7 @@ void init_mapnode()
f->solidness = 0; // drawn separately, makes no faces
f->walkable = false;
f->wall_mounted = true;
+ f->air_equivalent = true;
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
if(f->initial_metadata == NULL)
f->initial_metadata = new SignNodeMetadata("Some sign");
diff --git a/src/mapnode.h b/src/mapnode.h
index 50b257ba2..57382aa2b 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -152,13 +152,20 @@ struct ContentFeatures
// This is used for collision detection.
// Also for general solidness queries.
bool walkable;
+ // Player can point to these
bool pointable;
+ // Player can dig these
bool diggable;
+ // Player can build on these
bool buildable_to;
+ // Whether the node has no liquid, source liquid or flowing liquid
enum LiquidType liquid_type;
- // If true, param2 is set to direction when placed
+ // If true, param2 is set to direction when placed. Used for torches.
// NOTE: the direction format is quite inefficient and should be changed
bool wall_mounted;
+ // If true, node is equivalent to air. Torches are, air is. Water is not.
+ // Is used for example to check whether a mud block can have grass on.
+ bool air_equivalent;
// Inventory item string as which the node appears in inventory when dug.
// Mineral overrides this.
@@ -184,6 +191,7 @@ struct ContentFeatures
buildable_to = false;
liquid_type = LIQUID_NONE;
wall_mounted = false;
+ air_equivalent = false;
dug_item = "";
initial_metadata = NULL;
}
diff --git a/src/server.cpp b/src/server.cpp
index 75b47e498..9248e6298 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3674,12 +3674,12 @@ void Server::UpdateCrafting(u16 peer_id)
if(!found)
{
ItemSpec specs[9];
+ specs[3] = ItemSpec(ITEM_CRAFT, "Stick");
specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
specs[5] = ItemSpec(ITEM_CRAFT, "Stick");
specs[6] = ItemSpec(ITEM_CRAFT, "Stick");
specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
specs[8] = ItemSpec(ITEM_CRAFT, "Stick");
- specs[9] = ItemSpec(ITEM_CRAFT, "Stick");
if(checkItemCombination(items, specs))
{
rlist->addItem(new MaterialItem(CONTENT_FENCE, 2));