body.cc
musicmud-2.1.6/src/body.cc · 3.7 KB
From the archive musicmud2.1.6.tar.gz
Download the archive « Back to the archive contents
#include "body.h"
#include "musicmud.h"
#include "misc.h"
pairs_t pairs[] = {
#define P(a, b, depends) {a, "left" b, "right" b, b, "left " b, "right " b, depends }
#define S(a, depends)
P("arms", "arm", -1), /* 0 */
P("wrists", "wrist", 0), /* 1 */
P("hands", "hand", 1), /* 2 */
P("thumbs", "thumb", 2), /* 3 */
P("legs", "leg", -1), /* 4 */
P("feet", "foot", 4), /* 5 */
P("eyes", "eye", 8), /* 6 */
P("ears", "ear", 8), /* 7 */
};
int pairs_n = 8;
const char *fingers[8] = {
"left index finger", "right index finger",
"left middle finger", "right middle finger",
"left ring finger", "right ring finger",
"left little finger", "right little finger",
};
const char *get_mog_noun(const char *adj, anoff_t la)
{
int i = 0;
while (animals[i].noun) {
if (streq(animals[i].adj, adj))
return animals[i].*la;
i++;
}
return 0;
}
animal_t animals[] = {
{"badger", "mustiline", "Snuffle.", " tetrapod"},
{"bat", "vespertine", "!", "avian"},
{"bee", "apine", "Bzzzz!", "insect" },
{"cat", "feline", "Miao.", "tetrapod",},
{"chicken", "galline", "Cluck cluck!", "avian"},
{"cow", "bovine", "Moo!", "tetrapod",},
{"dalek", "davrine", "Exterminate!", "droid",},
{"dog", "canine", random_number(2)?"Woof!":"Bark!", "tetrapod"},
{"donkey", "asinine", "Heehaw!", "tetrapod"},
{"duck", "anatine", "Quack!", "avian"},
{"frog", "ranine", "Ribbit!", "tetrapod"},
{"goat", "caprine", "Meh!", "tetrapod"},
{"horse", "equine", "Neigh!", "tetrapod"},
{"monkey", "simian", "Oook!", "tetrapod"},
{"monster", "monstrous", "Get off my land!", "tetrapod"},
{"mouse", "murine", "Squeak!", "tetrapod"},
{"newt", "tarichine", "(I'll get better.)", "tetrapod"},
{"owl", "strigine", "Tweet-twoo!", "avian"},
{"parrot", "psittacine", "Pretty Polly!", "avian"},
{"penguin", "spheniscine","Linux Rocks!", "tetrapod"},
{"bowl of petunias", "petunian", "Oh no, not again!", "plant"},
{"pig", "porcine", "Oink!", "tetrapod"},
{"pigeon", "columbine", "Coup! Coup!", "avian"},
{"sheep", "ovine", "Baa!", "tetrapod"},
{"snake", "serpentine", "Hssss!", "snake"},
{"toad", "bufine", "Croak!", "tetrapod"},
{"tree", "aboreal", NULL, "tree"},
{"wolf", "lupine", "Ooooowww!", "tetrapod"},
{NULL,NULL,NULL},
/* {"slug", "limacine", "", "insect"}, */
};
const char *species(const MudObject *who)
{
if (const char *p=who->get("$piggy")) {
for (size_t i=0;animals[i].noun;i++) {
if (streq(animals[i].adj, p) && animals[i].noun)
return animals[i].noun;
}
}
const char *b = who->get("body");
if (b && (streq(b, "human") || streq(b, "lamidav")))
return b;
if (b)
return 0;
if (is_mobile(who)||is_player(who))
return "human";
return 0;
}
const char *body(const MudObject *who) {
const char *b = who->get("body");
if (const char *p=who->get("$piggy")) {
for (size_t i=0;animals[i].noun;i++) {
if (streq(animals[i].adj, p) && animals[i].body)
return animals[i].body;
}
}
if (b) return b;
if (is_mobile(who)||is_player(who)) return "human";
return 0;
}