camp beds pt1

This commit is contained in:
darkrose 2015-10-04 17:55:32 +10:00
parent 3d141f46f7
commit c8a2a51ee1
6 changed files with 71 additions and 73 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

View File

@ -577,11 +577,13 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_BED_YELLOW_FOOT 0xC1D
#define CONTENT_BED_BLACK_HEAD 0xC1E
#define CONTENT_BED_BLACK_FOOT 0xC1F
#define CONTENT_BED_CAMP_HEAD 0xC20
#define CONTENT_BED_CAMP_FOOT 0xC21
#define CONTENT_BED_MIN 0xC10
#define CONTENT_BED_MAX 0xC1F
#define CONTENT_BED_MAX 0xC21
#define CONTENT_BED_FOOT_MASK 0x001
// FREE C25-CFF
// FREE C22-CFF
// D00-DFF - play space for other devs and experiments
#define CONTENT_STONE_KNOB 0xD00

View File

@ -1689,6 +1689,64 @@ void content_mapnode_furniture(bool repeat)
f->pressure_type = CST_SOLID;
f->suffocation_per_second = 0;
i = CONTENT_BED_CAMP_HEAD;
f = &content_features(i);
f->description = wgettext("Camp Bed");
f->setAllTextures("hay_bale.png");
f->setTexture(0,"bed_camp_top.png");
f->setInventoryTexture("bed_camp_inv.png");
f->wield_nodebox = false;
f->param_type = CPT_LIGHT;
f->param2_type = CPT_FACEDIR_SIMPLE;
f->draw_type = CDT_NODEBOX;
f->light_propagates = true;
f->solidness = 0; // drawn separately, makes no faces
f->rotate_tile_with_nodebox = true;
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onact_also_affects = v3s16(0,0,1);
content_nodebox_slab(f);
f->type = CMT_PLANT;
f->hardness = 0.25;
f->pressure_type = CST_CRUSHABLE;
{
content_t r[9] = {
CONTENT_CRAFTITEM_FUR, CONTENT_CRAFTITEM_FUR, CONTENT_IGNORE,
CONTENT_HAY, CONTENT_HAY, CONTENT_IGNORE,
CONTENT_IGNORE, CONTENT_IGNORE, CONTENT_IGNORE
};
crafting::setRecipe(r,CONTENT_BED_CAMP_HEAD,1);
}
lists::add("craftguide",i);
lists::add("creative",i);
f->suffocation_per_second = 0;
if (f->initial_metadata == NULL)
f->initial_metadata = new BedNodeMetadata();
i = CONTENT_BED_CAMP_FOOT;
f = &content_features(i);
f->description = wgettext("Camp Bed");
f->setAllTextures("hay_bale.png");
f->setTexture(0,"bed_camp_top.png");
f->setInventoryTexture("bed_camp_inv.png");
f->wield_nodebox = false;
f->param_type = CPT_LIGHT;
f->param2_type = CPT_FACEDIR_SIMPLE;
f->draw_type = CDT_NODEBOX;
f->light_propagates = true;
f->solidness = 0; // drawn separately, makes no faces
f->rotate_tile_with_nodebox = true;
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_CAMP_HEAD)+" 1";
f->onact_also_affects = v3s16(0,0,-1);
content_nodebox_slab(f);
f->type = CMT_PLANT;
f->hardness = 0.25;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
// Paintings
i = CONTENT_PAINTING_WHITE;
f = &content_features(i);

View File

@ -765,6 +765,7 @@ void ServerEnvironment::step(float dtime)
std::list<v3s16> players_blockpos;
bool sleepskip = true;
bool did_wake = false;
/*
Handle players
@ -845,6 +846,7 @@ void ServerEnvironment::step(float dtime)
setTimeOfDay(18000);
}
// wake up
did_wake = true;
addEnvEvent(ENV_EVENT_WAKE,v3f(0,0,0),"");
for (core::list<Player*>::Iterator i = m_players.begin(); i != m_players.end(); i++) {
Player *player = *i;
@ -1897,42 +1899,10 @@ void ServerEnvironment::step(float dtime)
continue;
if (content_features(n_test).flammable > 0) {
content_t c = n_test.getContent();
if (
c >= CONTENT_DOOR_MIN
&& c <= CONTENT_DOOR_MAX
&& (c&CONTENT_HATCH_MASK) != CONTENT_HATCH_MASK
) {
MapNode n_sect;
n_sect.setContent(CONTENT_FIRE_SHORTTERM);
if ((c&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK) {
m_map->addNodeWithEvent(p+v3s16(x,y-1,z), n_sect);
}else{
m_map->addNodeWithEvent(p+v3s16(x,y+1,z), n_sect);
}
}else if (
n_test.getContent() >= CONTENT_BED_MIN
&& n_test.getContent() <= CONTENT_BED_MAX
) {
v3s16 p_foot = v3s16(0,0,0);
u8 d = n_test.param2&0x0F;
switch (d) {
case 1:
p_foot.X = 1;
break;
case 2:
p_foot.Z = -1;
break;
case 3:
p_foot.X = -1;
break;
default:
p_foot.Z = 1;
break;
}
if ((n_test.getContent()&CONTENT_BED_FOOT_MASK) == 0)
p_foot *= -1;
if (content_features(c).onact_also_affects != v3s16(0,0,0)) {
v3s16 p_other = p+v3s16(x,y,z)+n_test.getEffectedRotation();
n_test.setContent(CONTENT_FIRE_SHORTTERM);
m_map->addNodeWithEvent(p+v3s16(x,y,z)+p_foot, n_test);
m_map->addNodeWithEvent(p_other, n_test);
}
n_test.setContent(CONTENT_FIRE_SHORTTERM);
m_map->addNodeWithEvent(p+v3s16(x,y,z), n_test);
@ -1977,42 +1947,10 @@ void ServerEnvironment::step(float dtime)
continue;
if (content_features(n_test).flammable > 0) {
content_t c = n_test.getContent();
if (
c >= CONTENT_DOOR_MIN
&& c <= CONTENT_DOOR_MAX
&& (c&CONTENT_HATCH_MASK) != CONTENT_HATCH_MASK
) {
MapNode n_sect;
n_sect.setContent(CONTENT_FIRE_SHORTTERM);
if ((c&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK) {
m_map->addNodeWithEvent(p+v3s16(x,y-1,z), n_sect);
}else{
m_map->addNodeWithEvent(p+v3s16(x,y+1,z), n_sect);
}
}else if (
n_test.getContent() >= CONTENT_BED_MIN
&& n_test.getContent() <= CONTENT_BED_MAX
) {
v3s16 p_foot = v3s16(0,0,0);
u8 d = n_test.param2&0x0F;
switch (d) {
case 1:
p_foot.X = 1;
break;
case 2:
p_foot.Z = -1;
break;
case 3:
p_foot.X = -1;
break;
default:
p_foot.Z = 1;
break;
}
if ((n_test.getContent()&CONTENT_BED_FOOT_MASK) == 0)
p_foot *= -1;
if (content_features(c).onact_also_affects != v3s16(0,0,0)) {
v3s16 p_other = p+v3s16(x,y,z)+n_test.getEffectedRotation();
n_test.setContent(CONTENT_FIRE_SHORTTERM);
m_map->addNodeWithEvent(p+v3s16(x,y,z)+p_foot, n_test);
m_map->addNodeWithEvent(p_other, n_test);
}
n_test.setContent(CONTENT_FIRE_SHORTTERM);
m_map->addNodeWithEvent(p+v3s16(x,y,z), n_test);

View File

@ -3072,7 +3072,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
cannot_remove_node = true;
}else if (selected_node_features.onact_also_affects != v3s16(0,0,0)) {
NodeMetadata *ameta = m_env.getMap().getNodeMetadata(p_under+selected_node.getEffectedRotation());
if (ameta && !ameta->nodeRemovalDisabled() == true) {
if (ameta && ameta->nodeRemovalDisabled() == true) {
infostream<<"Server: Not finishing digging: "
<<"Sibling Node metadata disables removal"
<<std::endl;