Coding Class: Map Area 1

From LSWiki

Jump to: navigation, search

// Lysator, April 2009 Initial release

// I use comments like this to tag when changes were made to the content of the files. It makes it easier to figure out if a certain change has had an adverse effect on the file, and I can backtrack to the appropriate backup file, if necessary

#include <Cimbra.h>
#include <room.h>

// inclusions are how you can link to other libs. In this case I want to use stuff found in the Cimbra lib and some of the functions found in rooms, since these are basically virtual rooms.

// All of the basic information is found in the Map_Area_Base, such as the realm, and currently the day/night light levels. inherit Cimbra_Definition("Map_Area_Base");

// This is where you create the meat of the file. void configure() {

   ::configure();

// Make sure this matches the file name, or it will throw up errors.

   set_map_feature_name("rocky mountains");

// This is what it looks like in brief mode, or when you use the 'go' command.

   set_map_feature_summary("some rocky mountains");

// This method of creating the room descriptions is much favourable, since it has immense flexibility, and makes use of a lot of code already in the game.

   add_map_feature_abstract_item(([

// Abstract Item Identity is the subject of the room description. In this case, it will read as 'mountain range', but will also work if you use 'l range'

       Abstract_Item_Identity               : ([
           Identity_Adjectives              : ({ "mountain" }),
           Identity_Nouns                   : ({ "range" }),
       ]),

// This is the description the players will see in Depiction Detailed Rooms, or when they look in the room.

       Abstract_Item_Attach_Description     : ([
           Description_Type                 : Description_Type_Simple,
           Description_Content              : ({
               ({ 'a', 0 }), ({ "rise", 0 }), "up abruptly from the relatively flat areas surrounding it, picturesquely reaching upward to touch the sky."
           }),
           Description_Order                : Description_Order_Early,
       ]),

// This part is cool because it uses the mud's ability to identify materials. If you know what granite is, it will call this a 'granite mountain range'. If you don't know what granite is, it will give you the unknown description for granite, which is something like 'dark grey rock mountain range'. If the material is 'sand', the adjective will be a sandy whatever. This also applies colour if the material is set up for that.

       Abstract_Item_Elements               : ({
           ([
               Element_Type                 : Material_Granite,
               Element_Proportion           : 1.0,
               Element_Part                 : Part_Bulk,
           ]),
       }),

// This is what the players will see when they 'l mountain range' or 'l range'. This way, every subject mentioned in the description can be looked at.

       Abstract_Item_Descriptions           : ({

// Typo in 'decades' that has not been corrected for a long while.

           "The mountains show little signs of wear.  The surface undulates quite a bit, as if only having been exposed to the elements for a few deacades.",
       }),
   ]));
   add_map_feature_abstract_item(([
       Abstract_Item_Identity               : ([
           Identity_Adjectives              : ({ "sparse" }),
           Identity_Nouns                   : ({ "vegetation" }),
       ]),
       Abstract_Item_Attach_Description     : ([
           Description_Type                 : Description_Type_Simple,
           Description_Content              : ({

// 'a' makes it 'a blah', 't' makes it 'the blah', 'n' makes it just 'blah'. More on this in the applicable documentation.

               ({ 'n', 0 }), ({ "dot", 0 }), "the landscape of the rugged mountain terrain, growing wherever it can gain a foothold on the exposed granite."
           }),
           Description_Order                : Description_Order_Early,
       ]),
       Abstract_Item_Descriptions           : ({
           "The vegetation consists of small scrubs growing out of cracks in the surface of the mountain.",
       }),
   ]));

// This is what the room will look like in the description of the next room. '%t' translates to 'to the <dir>', while '%w' translates to '<dir>ward'. Auto applies the appropriate direction, depending upon the adjacency of the viewer.

   set_map_feature_adjacency(
       "%w are {{mottled grey}some mountains of exposed granite}."
   );

// If the player cannot smell, they do not get this description. Same set up can be used for any of the condition types

   add_map_feature_description(([
       Description_Type                     : Description_Type_Viewer_Condition,
       Description_Index                    : Condition_Type_Smell,
       Description_Content                  : ({
           "The air smells clean and crisp.",
       }),
   ]));

// This is how you describe the terrain from a distance.

   add_map_feature_mapped(([
       Mapped_Item                          : ([
           Abstract_Item_Identity           : ([
               Identity_Adjectives          : ({ "very tall" }),
               Identity_Nouns               : ({ "mountain range" }),
           ]),
           Abstract_Item_Descriptions       : ({({
               "The mountains look quite impressive.",
           })}),
           Abstract_Item_Elements           : ({ Material_Granite }),
           Abstract_Item_Attach_Description : ({
               "%t", ", stand some", ({ 'n', 0 }), ".",
           }),
       ]),

// Min distance should not be less than 2, since 1 would be the same as the set_map_feature_adjacency() description. Max distance is the farthest away you get this description. Numbers here represent how many squares away you can see this description. This one is for 2 and 3 squares away.

       Mapped_Min_Distance                  : 2.0,
       Mapped_Max_Distance                  : 3.0,

// Obscure makes it so that the atmosphere can interfere with seeing this at a distance. Changing this number alters how much vision is obscured.

       Mapped_Max_Obscure                   : 0.60,
   ]));

// This one gives a different description for viewing between 3 and 6 squares away.

   add_map_feature_mapped(([
       Mapped_Item                          : ([
           Abstract_Item_Identity           : ([
               Identity_Adjectives          : ({ "tall" }),
               Identity_Nouns               : ({ "mountain range" }),
           ]),
           Abstract_Item_Descriptions       : ({({
               "They rise stolidly above the surrounding terrain.",
           })}),
           Abstract_Item_Elements           : ({ Material_Granite }),
           Abstract_Item_Attach_Description : ({
               "Far", "%t", ", stands", ({ 'a', 0 }),
           }),
       ]),
       Mapped_Min_Distance                  : 3.1,
       Mapped_Max_Distance                  : 7.0,
       Mapped_Max_Obscure                   : 0.50,
   ]));

// This is how you get certain terrains, which affect fieldcraft skills, etc, and stuff like that.

   add_map_feature_terrain(Terrain_Mountains);

// This is the name of the terrain you use when you populate the map in the control daemon.

   add_map_feature_realm("Cimbra_Rocky_Mountains");

// Sets the exposure for all roms of this type. Exposure if how you get weather descriptions, and how several other things work, like 'fly home' for shifters. Not using this breaks some stuff.

   set_map_feature_exposure(Exposure_Cover);

// This is how you make it harder to climb across certain areas. Setting the access to climb means you have to climb through the area, or fly. The higher the difficulty, the harder it is to not fall. At 60, these mountains are rather steep, and an untrained climber stands a good chance at falling. Also, the higher this number, the more endurance it takes to cross this terrain. Roads, incidentally, have an automatic adjustment to their difficulty by .60, which makes it a lot easier to travel by road than cross country. A road over this terrain would only have a -36 modifier to walking/climbing.

   set_map_feature_access_difficulty(Map_Access_Climb, 60);

// What it looks like in a panoramicon or map visualization tool. Colour is not required, and it doesn't have to match the map_feature_specify().

   set_map_feature_visualize("{{white}R}");

// This is the icon used in map.conf

   set_map_feature_specify("R");

}

Personal tools