3 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "main.h" // For g_settings
29 #include "nameidmapping.h"
30 #include "util/serialize.h"
38 type = NODEBOX_REGULAR;
41 // default is sign/ladder-like
42 wall_top = aabb3f(-BS/2, BS/2-BS/16., -BS/2, BS/2, BS/2, BS/2);
43 wall_bottom = aabb3f(-BS/2, -BS/2, -BS/2, BS/2, -BS/2+BS/16., BS/2);
44 wall_side = aabb3f(-BS/2, -BS/2, -BS/2, -BS/2+BS/16., BS/2, BS/2);
47 void NodeBox::serialize(std::ostream &os) const
49 writeU8(os, 1); // version
52 if(type == NODEBOX_FIXED)
54 writeU16(os, fixed.size());
55 for(std::vector<aabb3f>::const_iterator
57 i != fixed.end(); i++)
59 writeV3F1000(os, i->MinEdge);
60 writeV3F1000(os, i->MaxEdge);
63 else if(type == NODEBOX_WALLMOUNTED)
65 writeV3F1000(os, wall_top.MinEdge);
66 writeV3F1000(os, wall_top.MaxEdge);
67 writeV3F1000(os, wall_bottom.MinEdge);
68 writeV3F1000(os, wall_bottom.MaxEdge);
69 writeV3F1000(os, wall_side.MinEdge);
70 writeV3F1000(os, wall_side.MaxEdge);
74 void NodeBox::deSerialize(std::istream &is)
76 int version = readU8(is);
78 throw SerializationError("unsupported NodeBox version");
82 type = (enum NodeBoxType)readU8(is);
84 if(type == NODEBOX_FIXED)
86 u16 fixed_count = readU16(is);
90 box.MinEdge = readV3F1000(is);
91 box.MaxEdge = readV3F1000(is);
95 else if(type == NODEBOX_WALLMOUNTED)
97 wall_top.MinEdge = readV3F1000(is);
98 wall_top.MaxEdge = readV3F1000(is);
99 wall_bottom.MinEdge = readV3F1000(is);
100 wall_bottom.MaxEdge = readV3F1000(is);
101 wall_side.MinEdge = readV3F1000(is);
102 wall_side.MaxEdge = readV3F1000(is);
110 void TileDef::serialize(std::ostream &os) const
112 writeU8(os, 0); // version
113 os<<serializeString(name);
114 writeU8(os, animation.type);
115 writeU16(os, animation.aspect_w);
116 writeU16(os, animation.aspect_h);
117 writeF1000(os, animation.length);
120 void TileDef::deSerialize(std::istream &is)
122 int version = readU8(is);
124 throw SerializationError("unsupported TileDef version");
125 name = deSerializeString(is);
126 animation.type = (TileAnimationType)readU8(is);
127 animation.aspect_w = readU16(is);
128 animation.aspect_h = readU16(is);
129 animation.length = readF1000(is);
133 SimpleSoundSpec serialization
136 static void serializeSimpleSoundSpec(const SimpleSoundSpec &ss,
139 os<<serializeString(ss.name);
140 writeF1000(os, ss.gain);
142 static void deSerializeSimpleSoundSpec(SimpleSoundSpec &ss, std::istream &is)
144 ss.name = deSerializeString(is);
145 ss.gain = readF1000(is);
152 ContentFeatures::ContentFeatures()
157 ContentFeatures::~ContentFeatures()
161 void ContentFeatures::reset()
168 visual_solidness = 0;
169 backface_culling = true;
171 has_on_construct = false;
172 has_on_destruct = false;
173 has_after_destruct = false;
177 NOTE: Most of this is always overridden by the default values given
182 // Unknown nodes can be dug
183 groups["dig_immediate"] = 2;
184 drawtype = NDT_NORMAL;
186 for(u32 i=0; i<6; i++)
187 tiledef[i] = TileDef();
188 for(u16 j=0; j<CF_SPECIAL_COUNT; j++)
189 tiledef_special[j] = TileDef();
191 post_effect_color = video::SColor(0, 0, 0, 0);
192 param_type = CPT_NONE;
193 param_type_2 = CPT2_NONE;
194 is_ground_content = false;
195 light_propagates = false;
196 sunlight_propagates = false;
201 buildable_to = false;
202 liquid_type = LIQUID_NONE;
203 liquid_alternative_flowing = "";
204 liquid_alternative_source = "";
205 liquid_viscosity = 0;
206 liquid_renewable = true;
208 damage_per_second = 0;
209 node_box = NodeBox();
210 selection_box = NodeBox();
211 legacy_facedir_simple = false;
212 legacy_wallmounted = false;
213 sound_footstep = SimpleSoundSpec();
214 sound_dig = SimpleSoundSpec("__group");
215 sound_dug = SimpleSoundSpec();
218 void ContentFeatures::serialize(std::ostream &os, u16 protocol_version)
220 if(protocol_version < 14){
221 serializeOld(os, protocol_version);
225 writeU8(os, 6); // version
226 os<<serializeString(name);
227 writeU16(os, groups.size());
228 for(ItemGroupList::const_iterator
229 i = groups.begin(); i != groups.end(); i++){
230 os<<serializeString(i->first);
231 writeS16(os, i->second);
233 writeU8(os, drawtype);
234 writeF1000(os, visual_scale);
236 for(u32 i=0; i<6; i++)
237 tiledef[i].serialize(os);
238 writeU8(os, CF_SPECIAL_COUNT);
239 for(u32 i=0; i<CF_SPECIAL_COUNT; i++){
240 tiledef_special[i].serialize(os);
243 writeU8(os, post_effect_color.getAlpha());
244 writeU8(os, post_effect_color.getRed());
245 writeU8(os, post_effect_color.getGreen());
246 writeU8(os, post_effect_color.getBlue());
247 writeU8(os, param_type);
248 writeU8(os, param_type_2);
249 writeU8(os, is_ground_content);
250 writeU8(os, light_propagates);
251 writeU8(os, sunlight_propagates);
252 writeU8(os, walkable);
253 writeU8(os, pointable);
254 writeU8(os, diggable);
255 writeU8(os, climbable);
256 writeU8(os, buildable_to);
257 os<<serializeString(""); // legacy: used to be metadata_name
258 writeU8(os, liquid_type);
259 os<<serializeString(liquid_alternative_flowing);
260 os<<serializeString(liquid_alternative_source);
261 writeU8(os, liquid_viscosity);
262 writeU8(os, liquid_renewable);
263 writeU8(os, light_source);
264 writeU32(os, damage_per_second);
265 node_box.serialize(os);
266 selection_box.serialize(os);
267 writeU8(os, legacy_facedir_simple);
268 writeU8(os, legacy_wallmounted);
269 serializeSimpleSoundSpec(sound_footstep, os);
270 serializeSimpleSoundSpec(sound_dig, os);
271 serializeSimpleSoundSpec(sound_dug, os);
272 // Stuff below should be moved to correct place in a version that otherwise changes
273 // the protocol version
276 void ContentFeatures::deSerialize(std::istream &is)
278 int version = readU8(is);
280 deSerializeOld(is, version);
284 name = deSerializeString(is);
286 u32 groups_size = readU16(is);
287 for(u32 i=0; i<groups_size; i++){
288 std::string name = deSerializeString(is);
289 int value = readS16(is);
290 groups[name] = value;
292 drawtype = (enum NodeDrawType)readU8(is);
293 visual_scale = readF1000(is);
295 throw SerializationError("unsupported tile count");
296 for(u32 i=0; i<6; i++)
297 tiledef[i].deSerialize(is);
298 if(readU8(is) != CF_SPECIAL_COUNT)
299 throw SerializationError("unsupported CF_SPECIAL_COUNT");
300 for(u32 i=0; i<CF_SPECIAL_COUNT; i++)
301 tiledef_special[i].deSerialize(is);
303 post_effect_color.setAlpha(readU8(is));
304 post_effect_color.setRed(readU8(is));
305 post_effect_color.setGreen(readU8(is));
306 post_effect_color.setBlue(readU8(is));
307 param_type = (enum ContentParamType)readU8(is);
308 param_type_2 = (enum ContentParamType2)readU8(is);
309 is_ground_content = readU8(is);
310 light_propagates = readU8(is);
311 sunlight_propagates = readU8(is);
312 walkable = readU8(is);
313 pointable = readU8(is);
314 diggable = readU8(is);
315 climbable = readU8(is);
316 buildable_to = readU8(is);
317 deSerializeString(is); // legacy: used to be metadata_name
318 liquid_type = (enum LiquidType)readU8(is);
319 liquid_alternative_flowing = deSerializeString(is);
320 liquid_alternative_source = deSerializeString(is);
321 liquid_viscosity = readU8(is);
322 liquid_renewable = readU8(is);
323 light_source = readU8(is);
324 damage_per_second = readU32(is);
325 node_box.deSerialize(is);
326 selection_box.deSerialize(is);
327 legacy_facedir_simple = readU8(is);
328 legacy_wallmounted = readU8(is);
329 deSerializeSimpleSoundSpec(sound_footstep, is);
330 deSerializeSimpleSoundSpec(sound_dig, is);
331 deSerializeSimpleSoundSpec(sound_dug, is);
332 // If you add anything here, insert it primarily inside the try-catch
333 // block to not need to increase the version.
335 // Stuff below should be moved to correct place in a version that
336 // otherwise changes the protocol version
337 }catch(SerializationError &e) {};
344 class CNodeDefManager: public IWritableNodeDefManager
349 m_name_id_mapping.clear();
350 m_name_id_mapping_with_aliases.clear();
352 for(u16 i=0; i<=MAX_CONTENT; i++)
354 ContentFeatures &f = m_content_features[i];
355 f.reset(); // Reset to defaults
362 f.drawtype = NDT_AIRLIKE;
363 f.param_type = CPT_LIGHT;
364 f.light_propagates = true;
365 f.sunlight_propagates = true;
369 f.buildable_to = true;
370 // Insert directly into containers
371 content_t c = CONTENT_AIR;
372 m_content_features[c] = f;
373 addNameIdMapping(c, f.name);
375 // Set CONTENT_IGNORE
379 f.drawtype = NDT_AIRLIKE;
380 f.param_type = CPT_NONE;
381 f.light_propagates = false;
382 f.sunlight_propagates = false;
386 // A way to remove accidental CONTENT_IGNOREs
387 f.buildable_to = true;
388 // Insert directly into containers
389 content_t c = CONTENT_IGNORE;
390 m_content_features[c] = f;
391 addNameIdMapping(c, f.name);
394 // CONTENT_IGNORE = not found
395 content_t getFreeId()
397 for(u32 i=0; i<=0xffff; i++){
398 const ContentFeatures &f = m_content_features[i];
402 return CONTENT_IGNORE;
408 virtual ~CNodeDefManager()
411 virtual IWritableNodeDefManager* clone()
413 CNodeDefManager *mgr = new CNodeDefManager();
414 for(u16 i=0; i<=MAX_CONTENT; i++)
420 virtual const ContentFeatures& get(content_t c) const
422 assert(c <= MAX_CONTENT);
423 return m_content_features[c];
425 virtual const ContentFeatures& get(const MapNode &n) const
427 return get(n.getContent());
429 virtual bool getId(const std::string &name, content_t &result) const
431 std::map<std::string, content_t>::const_iterator
432 i = m_name_id_mapping_with_aliases.find(name);
433 if(i == m_name_id_mapping_with_aliases.end())
438 virtual content_t getId(const std::string &name) const
440 content_t id = CONTENT_IGNORE;
444 virtual void getIds(const std::string &name, std::set<content_t> &result)
447 if(name.substr(0,6) != "group:"){
448 content_t id = CONTENT_IGNORE;
453 std::string group = name.substr(6);
454 for(u16 id=0; id<=MAX_CONTENT; id++)
456 const ContentFeatures &f = m_content_features[id];
457 if(f.name == "") // Quickly discard undefined nodes
459 if(itemgroup_get(f.groups, group) != 0)
463 virtual const ContentFeatures& get(const std::string &name) const
465 content_t id = CONTENT_IGNORE;
469 // IWritableNodeDefManager
470 virtual void set(content_t c, const ContentFeatures &def)
472 verbosestream<<"registerNode: registering content id \""<<c
473 <<"\": name=\""<<def.name<<"\""<<std::endl;
474 assert(c <= MAX_CONTENT);
475 // Don't allow redefining CONTENT_IGNORE (but allow air)
476 if(def.name == "ignore" || c == CONTENT_IGNORE){
477 infostream<<"registerNode: WARNING: Ignoring "
478 <<"CONTENT_IGNORE redefinition"<<std::endl;
481 // Check that the special contents are not redefined as different id
482 // because it would mess up everything
483 if((def.name == "ignore" && c != CONTENT_IGNORE) ||
484 (def.name == "air" && c != CONTENT_AIR)){
485 errorstream<<"registerNode: IGNORING ERROR: "
486 <<"trying to register built-in type \""
487 <<def.name<<"\" as different id"<<std::endl;
490 m_content_features[c] = def;
492 addNameIdMapping(c, def.name);
494 virtual content_t set(const std::string &name,
495 const ContentFeatures &def)
497 assert(name == def.name);
498 u16 id = CONTENT_IGNORE;
499 bool found = m_name_id_mapping.getId(name, id); // ignore aliases
503 if(id == CONTENT_IGNORE)
504 return CONTENT_IGNORE;
506 addNameIdMapping(id, name);
511 virtual content_t allocateDummy(const std::string &name)
518 virtual void updateAliases(IItemDefManager *idef)
520 std::set<std::string> all = idef->getAll();
521 m_name_id_mapping_with_aliases.clear();
522 for(std::set<std::string>::iterator
523 i = all.begin(); i != all.end(); i++)
525 std::string name = *i;
526 std::string convert_to = idef->getAlias(name);
528 if(m_name_id_mapping.getId(convert_to, id))
530 m_name_id_mapping_with_aliases.insert(
531 std::make_pair(name, id));
535 virtual void updateTextures(ITextureSource *tsrc)
538 infostream<<"CNodeDefManager::updateTextures(): Updating "
539 <<"textures in node definitions"<<std::endl;
541 bool new_style_water = g_settings->getBool("new_style_water");
542 bool new_style_leaves = g_settings->getBool("new_style_leaves");
543 bool opaque_water = g_settings->getBool("opaque_water");
545 for(u16 i=0; i<=MAX_CONTENT; i++)
547 ContentFeatures *f = &m_content_features[i];
549 // Figure out the actual tiles to use
551 for(u32 j=0; j<6; j++)
553 tiledef[j] = f->tiledef[j];
554 if(tiledef[j].name == "")
555 tiledef[j].name = "unknown_block.png";
558 bool is_liquid = false;
568 assert(f->liquid_type == LIQUID_SOURCE);
575 f->backface_culling = false;
579 case NDT_FLOWINGLIQUID:
580 assert(f->liquid_type == LIQUID_FLOWING);
588 f->visual_solidness = 1;
592 f->visual_solidness = 1;
594 case NDT_ALLFACES_OPTIONAL:
595 if(new_style_leaves){
596 f->drawtype = NDT_ALLFACES;
598 f->visual_solidness = 1;
600 f->drawtype = NDT_NORMAL;
602 for(u32 i=0; i<6; i++){
603 tiledef[i].name += std::string("^[noalpha");
609 f->backface_culling = false;
620 u8 material_type = 0;
623 material_type = TILE_MATERIAL_LIQUID_OPAQUE;
625 material_type = TILE_MATERIAL_LIQUID_TRANSPARENT;
627 material_type = TILE_MATERIAL_BASIC;
630 // Tiles (fill in f->tiles[])
631 for(u16 j=0; j<6; j++){
633 f->tiles[j].texture = tsrc->getTexture(tiledef[j].name);
635 f->tiles[j].alpha = f->alpha;
637 f->tiles[j].material_type = material_type;
639 f->tiles[j].material_flags = 0;
640 if(f->backface_culling)
641 f->tiles[j].material_flags |= MATERIAL_FLAG_BACKFACE_CULLING;
642 if(tiledef[j].animation.type == TAT_VERTICAL_FRAMES)
643 f->tiles[j].material_flags |= MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES;
644 // Animation parameters
645 if(f->tiles[j].material_flags &
646 MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES)
648 // Get raw texture size to determine frame count by
650 video::ITexture *t = tsrc->getTextureRaw(tiledef[j].name);
651 v2u32 size = t->getOriginalSize();
652 int frame_height = (float)size.X /
653 (float)tiledef[j].animation.aspect_w *
654 (float)tiledef[j].animation.aspect_h;
655 int frame_count = size.Y / frame_height;
656 int frame_length_ms = 1000.0 *
657 tiledef[j].animation.length / frame_count;
658 f->tiles[j].animation_frame_count = frame_count;
659 f->tiles[j].animation_frame_length_ms = frame_length_ms;
661 // If there are no frames for an animation, switch
662 // animation off (so that having specified an animation
663 // for something but not using it in the texture pack
664 // gives no overhead)
665 if(frame_count == 1){
666 f->tiles[j].material_flags &=
667 ~MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES;
671 // Special tiles (fill in f->special_tiles[])
672 for(u16 j=0; j<CF_SPECIAL_COUNT; j++){
674 f->special_tiles[j].texture =
675 tsrc->getTexture(f->tiledef_special[j].name);
677 f->special_tiles[j].alpha = f->alpha;
679 f->special_tiles[j].material_type = material_type;
681 f->special_tiles[j].material_flags = 0;
682 if(f->tiledef_special[j].backface_culling)
683 f->special_tiles[j].material_flags |= MATERIAL_FLAG_BACKFACE_CULLING;
684 if(f->tiledef_special[j].animation.type == TAT_VERTICAL_FRAMES)
685 f->special_tiles[j].material_flags |= MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES;
686 // Animation parameters
687 if(f->special_tiles[j].material_flags &
688 MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES)
690 // Get raw texture size to determine frame count by
692 video::ITexture *t = tsrc->getTextureRaw(f->tiledef_special[j].name);
693 v2u32 size = t->getOriginalSize();
694 int frame_height = (float)size.X /
695 (float)f->tiledef_special[j].animation.aspect_w *
696 (float)f->tiledef_special[j].animation.aspect_h;
697 int frame_count = size.Y / frame_height;
698 int frame_length_ms = 1000.0 *
699 f->tiledef_special[j].animation.length / frame_count;
700 f->special_tiles[j].animation_frame_count = frame_count;
701 f->special_tiles[j].animation_frame_length_ms = frame_length_ms;
703 // If there are no frames for an animation, switch
704 // animation off (so that having specified an animation
705 // for something but not using it in the texture pack
706 // gives no overhead)
707 if(frame_count == 1){
708 f->special_tiles[j].material_flags &=
709 ~MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES;
716 void serialize(std::ostream &os, u16 protocol_version)
718 writeU8(os, 1); // version
720 std::ostringstream os2(std::ios::binary);
721 for(u16 i=0; i<=MAX_CONTENT; i++)
723 if(i == CONTENT_IGNORE || i == CONTENT_AIR)
725 ContentFeatures *f = &m_content_features[i];
729 // Wrap it in a string to allow different lengths without
730 // strict version incompatibilities
731 std::ostringstream wrapper_os(std::ios::binary);
732 f->serialize(wrapper_os, protocol_version);
733 os2<<serializeString(wrapper_os.str());
737 os<<serializeLongString(os2.str());
739 void deSerialize(std::istream &is)
742 int version = readU8(is);
744 throw SerializationError("unsupported NodeDefinitionManager version");
745 u16 count = readU16(is);
746 std::istringstream is2(deSerializeLongString(is), std::ios::binary);
747 for(u16 n=0; n<count; n++){
748 u16 i = readU16(is2);
750 errorstream<<"ContentFeatures::deSerialize(): "
751 <<"Too large content id: "<<i<<std::endl;
754 /*// Do not deserialize special types
755 if(i == CONTENT_IGNORE || i == CONTENT_AIR)
757 ContentFeatures *f = &m_content_features[i];
758 // Read it from the string wrapper
759 std::string wrapper = deSerializeString(is2);
760 std::istringstream wrapper_is(wrapper, std::ios::binary);
761 f->deSerialize(wrapper_is);
762 verbosestream<<"deserialized "<<f->name<<std::endl;
764 addNameIdMapping(i, f->name);
768 void addNameIdMapping(content_t i, std::string name)
770 m_name_id_mapping.set(i, name);
771 m_name_id_mapping_with_aliases.insert(std::make_pair(name, i));
774 // Features indexed by id
775 ContentFeatures m_content_features[MAX_CONTENT+1];
776 // A mapping for fast converting back and forth between names and ids
777 NameIdMapping m_name_id_mapping;
778 // Like m_name_id_mapping, but only from names to ids, and includes
779 // item aliases too. Updated by updateAliases()
780 // Note: Not serialized.
781 std::map<std::string, content_t> m_name_id_mapping_with_aliases;
784 IWritableNodeDefManager* createNodeDefManager()
786 return new CNodeDefManager();
790 Serialization of old ContentFeatures formats
793 void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version)
795 if(protocol_version == 13)
797 writeU8(os, 5); // version
798 os<<serializeString(name);
799 writeU16(os, groups.size());
800 for(ItemGroupList::const_iterator
801 i = groups.begin(); i != groups.end(); i++){
802 os<<serializeString(i->first);
803 writeS16(os, i->second);
805 writeU8(os, drawtype);
806 writeF1000(os, visual_scale);
808 for(u32 i=0; i<6; i++)
809 tiledef[i].serialize(os);
810 writeU8(os, CF_SPECIAL_COUNT);
811 for(u32 i=0; i<CF_SPECIAL_COUNT; i++){
812 tiledef_special[i].serialize(os);
815 writeU8(os, post_effect_color.getAlpha());
816 writeU8(os, post_effect_color.getRed());
817 writeU8(os, post_effect_color.getGreen());
818 writeU8(os, post_effect_color.getBlue());
819 writeU8(os, param_type);
820 writeU8(os, param_type_2);
821 writeU8(os, is_ground_content);
822 writeU8(os, light_propagates);
823 writeU8(os, sunlight_propagates);
824 writeU8(os, walkable);
825 writeU8(os, pointable);
826 writeU8(os, diggable);
827 writeU8(os, climbable);
828 writeU8(os, buildable_to);
829 os<<serializeString(""); // legacy: used to be metadata_name
830 writeU8(os, liquid_type);
831 os<<serializeString(liquid_alternative_flowing);
832 os<<serializeString(liquid_alternative_source);
833 writeU8(os, liquid_viscosity);
834 writeU8(os, light_source);
835 writeU32(os, damage_per_second);
836 node_box.serialize(os);
837 selection_box.serialize(os);
838 writeU8(os, legacy_facedir_simple);
839 writeU8(os, legacy_wallmounted);
840 serializeSimpleSoundSpec(sound_footstep, os);
841 serializeSimpleSoundSpec(sound_dig, os);
842 serializeSimpleSoundSpec(sound_dug, os);
846 throw SerializationError("ContentFeatures::serialize(): Unsupported version requested");
850 void ContentFeatures::deSerializeOld(std::istream &is, int version)
852 if(version == 5) // In PROTOCOL_VERSION 13
854 name = deSerializeString(is);
856 u32 groups_size = readU16(is);
857 for(u32 i=0; i<groups_size; i++){
858 std::string name = deSerializeString(is);
859 int value = readS16(is);
860 groups[name] = value;
862 drawtype = (enum NodeDrawType)readU8(is);
863 visual_scale = readF1000(is);
865 throw SerializationError("unsupported tile count");
866 for(u32 i=0; i<6; i++)
867 tiledef[i].deSerialize(is);
868 if(readU8(is) != CF_SPECIAL_COUNT)
869 throw SerializationError("unsupported CF_SPECIAL_COUNT");
870 for(u32 i=0; i<CF_SPECIAL_COUNT; i++)
871 tiledef_special[i].deSerialize(is);
873 post_effect_color.setAlpha(readU8(is));
874 post_effect_color.setRed(readU8(is));
875 post_effect_color.setGreen(readU8(is));
876 post_effect_color.setBlue(readU8(is));
877 param_type = (enum ContentParamType)readU8(is);
878 param_type_2 = (enum ContentParamType2)readU8(is);
879 is_ground_content = readU8(is);
880 light_propagates = readU8(is);
881 sunlight_propagates = readU8(is);
882 walkable = readU8(is);
883 pointable = readU8(is);
884 diggable = readU8(is);
885 climbable = readU8(is);
886 buildable_to = readU8(is);
887 deSerializeString(is); // legacy: used to be metadata_name
888 liquid_type = (enum LiquidType)readU8(is);
889 liquid_alternative_flowing = deSerializeString(is);
890 liquid_alternative_source = deSerializeString(is);
891 liquid_viscosity = readU8(is);
892 light_source = readU8(is);
893 damage_per_second = readU32(is);
894 node_box.deSerialize(is);
895 selection_box.deSerialize(is);
896 legacy_facedir_simple = readU8(is);
897 legacy_wallmounted = readU8(is);
898 deSerializeSimpleSoundSpec(sound_footstep, is);
899 deSerializeSimpleSoundSpec(sound_dig, is);
900 deSerializeSimpleSoundSpec(sound_dug, is);
904 throw SerializationError("unsupported ContentFeatures version");