added BorderStone block

master
jachoo 2011-09-19 19:10:24 +02:00
parent 056708fbe3
commit 2d72c4b0cf
6 changed files with 71 additions and 9 deletions

View File

@ -429,6 +429,24 @@ InventoryItem *craft_get_result(InventoryItem **items)
}
}
//j Border stone
{
ItemSpec specs[9];
specs[0] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
specs[1] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
specs[2] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
specs[3] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
specs[4] = ItemSpec(ITEM_MATERIAL, CONTENT_STEEL); //steel
specs[5] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
specs[6] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
specs[7] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
specs[8] = ItemSpec(ITEM_MATERIAL, CONTENT_STONE);
if(checkItemCombination(items, specs))
{
return new MaterialItem(CONTENT_BORDERSTONE, 4); //?
}
}
return NULL;
}
@ -487,6 +505,7 @@ void craft_set_creative_inventory(Player *player)
CONTENT_FURNACE,
CONTENT_SIGN_WALL,
CONTENT_LAVASOURCE,
CONTENT_BORDERSTONE,
CONTENT_IGNORE
};

View File

@ -629,6 +629,19 @@ void content_mapnode_init()
f->setInventoryTexture("nc_rb.png");
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
setStoneLikeDiggingProperties(f->digging_properties, 3.0);
i = CONTENT_BORDERSTONE;
f = &content_features(i);
f->setAllTextures("borderstone.png");
f->setTexture(0,"borderstone_top.png");
f->setTexture(1,"borderstone_top.png");
f->setInventoryTextureCube("borderstone_top.png", "borderstone.png", "borderstone.png");
f->param_type = CPT_NONE;
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 4";
if(f->initial_metadata == NULL)
f->initial_metadata = new SignNodeMetadata("Property of nobody");
setStoneLikeDiggingProperties(f->digging_properties, 10.0);
// NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp

View File

@ -83,6 +83,7 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_JUNGLEGRASS 0x816
#define CONTENT_NC 0x817
#define CONTENT_NC_RB 0x818
#define CONTENT_BORDERSTONE 0x819
#endif

View File

@ -2014,6 +2014,10 @@ void the_game(
std::wstring wtext =
narrow_to_wide(signmeta->getText());
if(map->getNodeNoEx(nodepos).getContent() == CONTENT_BORDERSTONE)
if(wtext.substr(0,12) == L"Property of ")
wtext = wtext.substr(12);
(new GUITextInputMenu(guienv, guiroot, -1,
&g_menumgr, dest,

View File

@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting.h"
#include "mapgen.h"
#include "nodemetadata.h"
#include "content_mapnode.h"
/*
SQLite format specification:
@ -896,6 +897,15 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
m_dout<<DTIME<<"Map::addNodeAndUpdate(): p=("
<<p.X<<","<<p.Y<<","<<p.Z<<")"<<std::endl;*/
//j
//one block may have only one border stone
if(n.getContent() == CONTENT_BORDERSTONE)
{
MapBlock * block = getBlockNoCreate(getNodeBlockPos(p));
assert(block != NULL);
if(block->getOwner()) return;
}
/*
From this node to nodes underneath:
If lighting is sunlight (1.0), unlight neighbours and
@ -1166,6 +1176,17 @@ void Map::removeNodeAndUpdate(v3s16 p,
This also clears the lighting.
*/
// Add the block of the removed node to modified_blocks
v3s16 blockpos = getNodeBlockPos(p);
MapBlock * block = getBlockNoCreate(blockpos);
assert(block != NULL);
modified_blocks.insert(blockpos, block);
//j
// If removing border stone -> clear ownership
if(block->getOwner() && getNode(p).getContent() == CONTENT_BORDERSTONE)
block->setOwner(0);
MapNode n;
n.setContent(replace_material);
setNode(p, n);
@ -1180,12 +1201,6 @@ void Map::removeNodeAndUpdate(v3s16 p,
spreadLight(bank, light_sources, modified_blocks);
}
// Add the block of the removed node to modified_blocks
v3s16 blockpos = getNodeBlockPos(p);
MapBlock * block = getBlockNoCreate(blockpos);
assert(block != NULL);
modified_blocks.insert(blockpos, block);
/*
If the removed node was under sunlight, propagate the
sunlight down from it and then light all neighbors

View File

@ -2554,6 +2554,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
if( !player->canModify(&m_env.getMap(),NULL,NULL,&p_under) || !player->canModify(&m_env.getMap(),NULL,NULL,&p_over) )
{
derr_server<<"Player isn't owner of a block"<<std::endl;
RemoteClient *client = getClient(peer_id);
client->SetBlockNotSent(getNodeBlockPos(p_under));
client->SetBlockNotSent(getNodeBlockPos(p_over));
return;
}
@ -3139,10 +3142,14 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
return;
}
if(text.length()>1 && text[0]=='#'){
MapNode node = m_env.getMap().getNodeNoEx(p);
//if(text.length()>1 && text[0]=='#'){
if( node.getContent() == CONTENT_BORDERSTONE ){
//j: ustawiamy wlasciciela
std::string groupName = text.substr(1);
std::string groupName = text;
/*int i_group = atoi(text.c_str()+1);
if(i_group<0 || i_group > 0xFFFF){
@ -3151,8 +3158,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
}
u16 group = (u16)i_group;*/
bool nullgroup = false;
if(groupName == "#" || groupName == "" || groupName == "nobody") nullgroup = true;
u16 group = 0;
if(groupName != "#"){
if(!nullgroup){
group = m_env.groupsManager.groupId(groupName);
if(!group){
derr_server<<"Wrong group name"<<std::endl;