Fixed handling of inventory in creative mode (normal inventory is not trashed anymore), fixed mese pick speed, added some forgotten stuff
parent
4ccc99b291
commit
8e1eacf3a8
Binary file not shown.
After Width: | Height: | Size: 239 B |
Binary file not shown.
After Width: | Height: | Size: 303 B |
Binary file not shown.
After Width: | Height: | Size: 410 B |
Binary file not shown.
After Width: | Height: | Size: 203 B |
Binary file not shown.
After Width: | Height: | Size: 260 B |
Binary file not shown.
After Width: | Height: | Size: 233 B |
|
@ -474,13 +474,30 @@ void content_mapnode_init()
|
|||
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 5.0);
|
||||
|
||||
i = CONTENT_NC;
|
||||
f = &content_features(i);
|
||||
f->param_type = CPT_FACEDIR_SIMPLE;
|
||||
f->setAllTextures("nc_side.png");
|
||||
f->setTexture(5, "nc_front.png"); // Z-
|
||||
f->setTexture(4, "nc_back.png"); // Z+
|
||||
f->setInventoryTexture("nc_front.png");
|
||||
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 3.0);
|
||||
|
||||
i = CONTENT_NC_RB;
|
||||
f = &content_features(i);
|
||||
f->setAllTextures("nc_rb.png");
|
||||
f->setInventoryTexture("nc_rb.png");
|
||||
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
|
||||
setStoneLikeDiggingProperties(f->digging_properties, 3.0);
|
||||
|
||||
// NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
|
||||
|
||||
|
||||
/*
|
||||
Add MesePick to everything
|
||||
*/
|
||||
for(u16 i=0; i<256; i++)
|
||||
for(u16 i=0; i<=MAX_CONTENT; i++)
|
||||
{
|
||||
content_features(i).digging_properties.set("MesePick",
|
||||
DiggingProperties(true, 0.0, 65535./1337));
|
||||
|
|
|
@ -70,6 +70,8 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
|||
#define CONTENT_BOOKSHELF 0x814 //29
|
||||
#define CONTENT_JUNGLETREE 0x815
|
||||
#define CONTENT_JUNGLEGRASS 0x816
|
||||
#define CONTENT_NC 0x817
|
||||
#define CONTENT_NC_RB 0x818
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -976,6 +976,40 @@ static void make_dungeon1(VoxelManipulator &vmanip, PseudoRandom &random)
|
|||
}
|
||||
}
|
||||
|
||||
static void make_nc(VoxelManipulator &vmanip, PseudoRandom &random)
|
||||
{
|
||||
v3s16 dir;
|
||||
u8 facedir_i = 0;
|
||||
s32 r = random.range(0, 3);
|
||||
if(r == 0){
|
||||
dir = v3s16( 1, 0, 0);
|
||||
facedir_i = 3;
|
||||
}
|
||||
if(r == 1){
|
||||
dir = v3s16(-1, 0, 0);
|
||||
facedir_i = 1;
|
||||
}
|
||||
if(r == 2){
|
||||
dir = v3s16( 0, 0, 1);
|
||||
facedir_i = 2;
|
||||
}
|
||||
if(r == 3){
|
||||
dir = v3s16( 0, 0,-1);
|
||||
facedir_i = 0;
|
||||
}
|
||||
v3s16 p = vmanip.m_area.MinEdge + v3s16(
|
||||
16+random.range(0,15),
|
||||
16+random.range(0,15),
|
||||
16+random.range(0,15));
|
||||
vmanip.m_data[vmanip.m_area.index(p)] = MapNode(CONTENT_NC, facedir_i);
|
||||
u32 length = random.range(3,15);
|
||||
for(u32 j=0; j<length; j++)
|
||||
{
|
||||
p -= dir;
|
||||
vmanip.m_data[vmanip.m_area.index(p)] = MapNode(CONTENT_NC_RB);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Noise functions. Make sure seed is mangled differently in each one.
|
||||
*/
|
||||
|
@ -1871,6 +1905,17 @@ void make_block(BlockMakeData *data)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Add NC
|
||||
*/
|
||||
{
|
||||
PseudoRandom ncrandom(blockseed+9324342);
|
||||
if(ncrandom.range(0, 1000) == 0 && blockpos.Y <= -3)
|
||||
{
|
||||
make_nc(vmanip, ncrandom);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Add top and bottom side of water to transforming_liquid queue
|
||||
|
|
|
@ -391,6 +391,9 @@ inline v3s16 unpackDir(u8 b)
|
|||
facedir: CPT_FACEDIR_SIMPLE param1 value
|
||||
dir: The face for which stuff is wanted
|
||||
return value: The face from which the stuff is actually found
|
||||
|
||||
NOTE: Currently this uses 2 bits for Z-,X-,Z+,X+, should there be Y+
|
||||
and Y- too?
|
||||
*/
|
||||
v3s16 facedir_rotate(u8 facedir, v3s16 dir);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ Player::Player():
|
|||
in_water(false),
|
||||
in_water_stable(false),
|
||||
swimming_up(false),
|
||||
inventory_backup(NULL),
|
||||
craftresult_is_preview(true),
|
||||
hp(20),
|
||||
peer_id(PEER_ID_INEXISTENT),
|
||||
|
@ -43,6 +44,7 @@ Player::Player():
|
|||
|
||||
Player::~Player()
|
||||
{
|
||||
delete inventory_backup;
|
||||
}
|
||||
|
||||
void Player::resetInventory()
|
||||
|
@ -106,8 +108,13 @@ void Player::serialize(std::ostream &os)
|
|||
args.writeLines(os);
|
||||
|
||||
os<<"PlayerArgsEnd\n";
|
||||
|
||||
inventory.serialize(os);
|
||||
|
||||
// If actual inventory is backed up due to creative mode, save it
|
||||
// instead of the dummy creative mode inventory
|
||||
if(inventory_backup)
|
||||
inventory_backup->serialize(os);
|
||||
else
|
||||
inventory.serialize(os);
|
||||
}
|
||||
|
||||
void Player::deSerialize(std::istream &is)
|
||||
|
|
|
@ -121,6 +121,8 @@ public:
|
|||
bool swimming_up;
|
||||
|
||||
Inventory inventory;
|
||||
// Actual inventory is backed up here when creative mode is used
|
||||
Inventory *inventory_backup;
|
||||
|
||||
bool craftresult_is_preview;
|
||||
|
||||
|
|
|
@ -4130,6 +4130,11 @@ Player *Server::emergePlayer(const char *name, const char *password, u16 peer_id
|
|||
// Reset inventory to creative if in creative mode
|
||||
if(g_settings.getBool("creative_mode"))
|
||||
{
|
||||
// Warning: double code below
|
||||
// Backup actual inventory
|
||||
player->inventory_backup = new Inventory();
|
||||
*(player->inventory_backup) = player->inventory;
|
||||
// Set creative inventory
|
||||
craft_set_creative_inventory(player);
|
||||
}
|
||||
|
||||
|
@ -4183,6 +4188,11 @@ Player *Server::emergePlayer(const char *name, const char *password, u16 peer_id
|
|||
|
||||
if(g_settings.getBool("creative_mode"))
|
||||
{
|
||||
// Warning: double code above
|
||||
// Backup actual inventory
|
||||
player->inventory_backup = new Inventory();
|
||||
*(player->inventory_backup) = player->inventory;
|
||||
// Set creative inventory
|
||||
craft_set_creative_inventory(player);
|
||||
}
|
||||
else if(g_settings.getBool("give_initial_stuff"))
|
||||
|
|
Loading…
Reference in New Issue