mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 16:08:51 -05:00
Make liquid_alternative_* to be strings
This commit is contained in:
parent
18bb0ea1ea
commit
e5650bb549
@ -237,8 +237,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||||||
|
|
||||||
bool top_is_same_liquid = false;
|
bool top_is_same_liquid = false;
|
||||||
MapNode ntop = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y+1,z));
|
MapNode ntop = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y+1,z));
|
||||||
content_t c_flowing = nodedef->get(n).liquid_alternative_flowing;
|
content_t c_flowing = nodedef->getId(nodedef->get(n).liquid_alternative_flowing);
|
||||||
content_t c_source = nodedef->get(n).liquid_alternative_source;
|
content_t c_source = nodedef->getId(nodedef->get(n).liquid_alternative_source);
|
||||||
if(ntop.getContent() == c_flowing || ntop.getContent() == c_source)
|
if(ntop.getContent() == c_flowing || ntop.getContent() == c_source)
|
||||||
top_is_same_liquid = true;
|
top_is_same_liquid = true;
|
||||||
|
|
||||||
|
@ -682,8 +682,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f.diggable = false;
|
f.diggable = false;
|
||||||
f.buildable_to = true;
|
f.buildable_to = true;
|
||||||
f.liquid_type = LIQUID_FLOWING;
|
f.liquid_type = LIQUID_FLOWING;
|
||||||
f.liquid_alternative_flowing = CONTENT_WATER;
|
f.liquid_alternative_flowing = "water_flowing";
|
||||||
f.liquid_alternative_source = CONTENT_WATERSOURCE;
|
f.liquid_alternative_source = "water_source";
|
||||||
f.liquid_viscosity = WATER_VISC;
|
f.liquid_viscosity = WATER_VISC;
|
||||||
f.post_effect_color = video::SColor(64, 100, 100, 200);
|
f.post_effect_color = video::SColor(64, 100, 100, 200);
|
||||||
f.setSpecialMaterial(0, MaterialSpec("water.png", false));
|
f.setSpecialMaterial(0, MaterialSpec("water.png", false));
|
||||||
@ -705,8 +705,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f.buildable_to = true;
|
f.buildable_to = true;
|
||||||
f.liquid_type = LIQUID_SOURCE;
|
f.liquid_type = LIQUID_SOURCE;
|
||||||
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
f.liquid_alternative_flowing = CONTENT_WATER;
|
f.liquid_alternative_flowing = "water_flowing";
|
||||||
f.liquid_alternative_source = CONTENT_WATERSOURCE;
|
f.liquid_alternative_source = "water_source";
|
||||||
f.liquid_viscosity = WATER_VISC;
|
f.liquid_viscosity = WATER_VISC;
|
||||||
f.post_effect_color = video::SColor(64, 100, 100, 200);
|
f.post_effect_color = video::SColor(64, 100, 100, 200);
|
||||||
// New-style water source material (mostly unused)
|
// New-style water source material (mostly unused)
|
||||||
@ -727,8 +727,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f.diggable = false;
|
f.diggable = false;
|
||||||
f.buildable_to = true;
|
f.buildable_to = true;
|
||||||
f.liquid_type = LIQUID_FLOWING;
|
f.liquid_type = LIQUID_FLOWING;
|
||||||
f.liquid_alternative_flowing = CONTENT_LAVA;
|
f.liquid_alternative_flowing = "lava_flowing";
|
||||||
f.liquid_alternative_source = CONTENT_LAVASOURCE;
|
f.liquid_alternative_source = "lava_source";
|
||||||
f.liquid_viscosity = LAVA_VISC;
|
f.liquid_viscosity = LAVA_VISC;
|
||||||
f.damage_per_second = 4*2;
|
f.damage_per_second = 4*2;
|
||||||
f.post_effect_color = video::SColor(192, 255, 64, 0);
|
f.post_effect_color = video::SColor(192, 255, 64, 0);
|
||||||
@ -751,8 +751,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f.buildable_to = true;
|
f.buildable_to = true;
|
||||||
f.liquid_type = LIQUID_SOURCE;
|
f.liquid_type = LIQUID_SOURCE;
|
||||||
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
f.liquid_alternative_flowing = CONTENT_LAVA;
|
f.liquid_alternative_flowing = "lava_flowing";
|
||||||
f.liquid_alternative_source = CONTENT_LAVASOURCE;
|
f.liquid_alternative_source = "lava_source";
|
||||||
f.liquid_viscosity = LAVA_VISC;
|
f.liquid_viscosity = LAVA_VISC;
|
||||||
f.damage_per_second = 4*2;
|
f.damage_per_second = 4*2;
|
||||||
f.post_effect_color = video::SColor(192, 255, 64, 0);
|
f.post_effect_color = video::SColor(192, 255, 64, 0);
|
||||||
|
12
src/map.cpp
12
src/map.cpp
@ -1602,7 +1602,7 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
switch (liquid_type) {
|
switch (liquid_type) {
|
||||||
case LIQUID_SOURCE:
|
case LIQUID_SOURCE:
|
||||||
liquid_level = LIQUID_LEVEL_SOURCE;
|
liquid_level = LIQUID_LEVEL_SOURCE;
|
||||||
liquid_kind = nodemgr->get(n0).liquid_alternative_flowing;
|
liquid_kind = nodemgr->getId(nodemgr->get(n0).liquid_alternative_flowing);
|
||||||
break;
|
break;
|
||||||
case LIQUID_FLOWING:
|
case LIQUID_FLOWING:
|
||||||
liquid_level = (n0.param2 & LIQUID_LEVEL_MASK);
|
liquid_level = (n0.param2 & LIQUID_LEVEL_MASK);
|
||||||
@ -1662,8 +1662,8 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
case LIQUID_SOURCE:
|
case LIQUID_SOURCE:
|
||||||
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
|
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
|
||||||
if (liquid_kind == CONTENT_AIR)
|
if (liquid_kind == CONTENT_AIR)
|
||||||
liquid_kind = nodemgr->get(nb.n.getContent()).liquid_alternative_flowing;
|
liquid_kind = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing);
|
||||||
if (nodemgr->get(nb.n.getContent()).liquid_alternative_flowing !=liquid_kind) {
|
if (nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing) != liquid_kind) {
|
||||||
neutrals[num_neutrals++] = nb;
|
neutrals[num_neutrals++] = nb;
|
||||||
} else {
|
} else {
|
||||||
sources[num_sources++] = nb;
|
sources[num_sources++] = nb;
|
||||||
@ -1672,8 +1672,8 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
case LIQUID_FLOWING:
|
case LIQUID_FLOWING:
|
||||||
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
|
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
|
||||||
if (liquid_kind == CONTENT_AIR)
|
if (liquid_kind == CONTENT_AIR)
|
||||||
liquid_kind = nodemgr->get(nb.n.getContent()).liquid_alternative_flowing;
|
liquid_kind = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing);
|
||||||
if (nodemgr->get(nb.n.getContent()).liquid_alternative_flowing != liquid_kind) {
|
if (nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing) != liquid_kind) {
|
||||||
neutrals[num_neutrals++] = nb;
|
neutrals[num_neutrals++] = nb;
|
||||||
} else {
|
} else {
|
||||||
flows[num_flows++] = nb;
|
flows[num_flows++] = nb;
|
||||||
@ -1694,7 +1694,7 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
// liquid_kind will be set to either the flowing alternative of the node (if it's a liquid)
|
// liquid_kind will be set to either the flowing alternative of the node (if it's a liquid)
|
||||||
// or the flowing alternative of the first of the surrounding sources (if it's air), so
|
// or the flowing alternative of the first of the surrounding sources (if it's air), so
|
||||||
// it's perfectly safe to use liquid_kind here to determine the new node content.
|
// it's perfectly safe to use liquid_kind here to determine the new node content.
|
||||||
new_node_content = nodemgr->get(liquid_kind).liquid_alternative_source;
|
new_node_content = nodemgr->getId(nodemgr->get(liquid_kind).liquid_alternative_source);
|
||||||
} else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) {
|
} else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) {
|
||||||
// liquid_kind is set properly, see above
|
// liquid_kind is set properly, see above
|
||||||
new_node_content = liquid_kind;
|
new_node_content = liquid_kind;
|
||||||
|
@ -144,8 +144,8 @@ void ContentFeatures::reset()
|
|||||||
extra_dug_item_rarity = 2;
|
extra_dug_item_rarity = 2;
|
||||||
metadata_name = "";
|
metadata_name = "";
|
||||||
liquid_type = LIQUID_NONE;
|
liquid_type = LIQUID_NONE;
|
||||||
liquid_alternative_flowing = CONTENT_IGNORE;
|
liquid_alternative_flowing = "";
|
||||||
liquid_alternative_source = CONTENT_IGNORE;
|
liquid_alternative_source = "";
|
||||||
liquid_viscosity = 0;
|
liquid_viscosity = 0;
|
||||||
light_source = 0;
|
light_source = 0;
|
||||||
damage_per_second = 0;
|
damage_per_second = 0;
|
||||||
@ -192,8 +192,8 @@ void ContentFeatures::serialize(std::ostream &os)
|
|||||||
writeS32(os, extra_dug_item_rarity);
|
writeS32(os, extra_dug_item_rarity);
|
||||||
os<<serializeString(metadata_name);
|
os<<serializeString(metadata_name);
|
||||||
writeU8(os, liquid_type);
|
writeU8(os, liquid_type);
|
||||||
writeU16(os, liquid_alternative_flowing);
|
os<<serializeString(liquid_alternative_flowing);
|
||||||
writeU16(os, liquid_alternative_source);
|
os<<serializeString(liquid_alternative_source);
|
||||||
writeU8(os, liquid_viscosity);
|
writeU8(os, liquid_viscosity);
|
||||||
writeU8(os, light_source);
|
writeU8(os, light_source);
|
||||||
writeU32(os, damage_per_second);
|
writeU32(os, damage_per_second);
|
||||||
@ -244,8 +244,8 @@ void ContentFeatures::deSerialize(std::istream &is, IGameDef *gamedef)
|
|||||||
extra_dug_item_rarity = readS32(is);
|
extra_dug_item_rarity = readS32(is);
|
||||||
metadata_name = deSerializeString(is);
|
metadata_name = deSerializeString(is);
|
||||||
liquid_type = (enum LiquidType)readU8(is);
|
liquid_type = (enum LiquidType)readU8(is);
|
||||||
liquid_alternative_flowing = readU16(is);
|
liquid_alternative_flowing = deSerializeString(is);
|
||||||
liquid_alternative_source = readU16(is);
|
liquid_alternative_source = deSerializeString(is);
|
||||||
liquid_viscosity = readU8(is);
|
liquid_viscosity = readU8(is);
|
||||||
light_source = readU8(is);
|
light_source = readU8(is);
|
||||||
damage_per_second = readU32(is);
|
damage_per_second = readU32(is);
|
||||||
@ -337,13 +337,14 @@ public:
|
|||||||
ContentFeatures f;
|
ContentFeatures f;
|
||||||
f.name = "ignore";
|
f.name = "ignore";
|
||||||
f.drawtype = NDT_AIRLIKE;
|
f.drawtype = NDT_AIRLIKE;
|
||||||
/*f.param_type = CPT_LIGHT;
|
f.param_type = CPT_NONE;
|
||||||
f.light_propagates = true;
|
f.light_propagates = false;
|
||||||
f.sunlight_propagates = true;*/
|
f.sunlight_propagates = false;
|
||||||
f.walkable = false;
|
f.walkable = false;
|
||||||
f.pointable = false;
|
f.pointable = false;
|
||||||
f.diggable = false;
|
f.diggable = false;
|
||||||
f.buildable_to = false;
|
// A way to remove accidental CONTENT_IGNOREs
|
||||||
|
f.buildable_to = true;
|
||||||
f.air_equivalent = true;
|
f.air_equivalent = true;
|
||||||
set(CONTENT_IGNORE, f);
|
set(CONTENT_IGNORE, f);
|
||||||
}
|
}
|
||||||
|
@ -193,9 +193,9 @@ struct ContentFeatures
|
|||||||
// Whether the node is non-liquid, source liquid or flowing liquid
|
// Whether the node is non-liquid, source liquid or flowing liquid
|
||||||
enum LiquidType liquid_type;
|
enum LiquidType liquid_type;
|
||||||
// If the content is liquid, this is the flowing version of the liquid.
|
// If the content is liquid, this is the flowing version of the liquid.
|
||||||
content_t liquid_alternative_flowing;
|
std::string liquid_alternative_flowing;
|
||||||
// If the content is liquid, this is the source version of the liquid.
|
// If the content is liquid, this is the source version of the liquid.
|
||||||
content_t liquid_alternative_source;
|
std::string liquid_alternative_source;
|
||||||
// Viscosity for fluid flow, ranging from 1 to 7, with
|
// Viscosity for fluid flow, ranging from 1 to 7, with
|
||||||
// 1 giving almost instantaneous propagation and 7 being
|
// 1 giving almost instantaneous propagation and 7 being
|
||||||
// the slowest possible
|
// the slowest possible
|
||||||
|
@ -609,11 +609,11 @@ static int l_register_node(lua_State *L)
|
|||||||
f.liquid_type = (LiquidType)getenumfield(L, table0, "liquidtype",
|
f.liquid_type = (LiquidType)getenumfield(L, table0, "liquidtype",
|
||||||
es_LiquidType, LIQUID_NONE);
|
es_LiquidType, LIQUID_NONE);
|
||||||
// If the content is liquid, this is the flowing version of the liquid.
|
// If the content is liquid, this is the flowing version of the liquid.
|
||||||
// TODO: as name
|
getstringfield(L, table0, "liquid_alternative_flowing",
|
||||||
// content_t liquid_alternative_flowing;
|
f.liquid_alternative_flowing);
|
||||||
// If the content is liquid, this is the source version of the liquid.
|
// If the content is liquid, this is the source version of the liquid.
|
||||||
// TODO: as name
|
getstringfield(L, table0, "liquid_alternative_source",
|
||||||
// content_t liquid_alternative_source;
|
f.liquid_alternative_source);
|
||||||
// Viscosity for fluid flow, ranging from 1 to 7, with
|
// Viscosity for fluid flow, ranging from 1 to 7, with
|
||||||
// 1 giving almost instantaneous propagation and 7 being
|
// 1 giving almost instantaneous propagation and 7 being
|
||||||
// the slowest possible
|
// the slowest possible
|
||||||
|
Loading…
Reference in New Issue
Block a user