cattle.u
mud/samples/cattle.u · 1.3 KB
From the archive ubermud1.13.tar.gz
Download the archive « Back to the archive contents
/*
a simplistic cattle prod
*/
#define PRODNUM #380
PRODNUM.dsc = "a general purpose MUD cattle prod 3.0. instructions are written on the side in fine print";
PRODNUM.txt = "instructions: zap|prod <person> on off";
func PRODNUM.prod
{
if(#self.ison == NULL) {
@.emote("fumbles with the cattle-prod");
echo("it's turned off, bozo\n");
return;
}
$who = match($1,#actor._loc._ply,"nam");
if($who == NULL) {
echo("prod who ?\n");
@.emote("turns on ",#self.nam,"and peers around the room");
return;
}
@.emote("ZAPS",$who.nam,"with ",#self.nam,"!!! Sparks fly!!");
foreach $tmp in (#actor._loc._ply) {
if($tmp != $who)
echoto($tmp,$who.nam," thrashes about helplessly on the floor, screaming!!\n");
else
echoto($tmp,"you thrash about helplessly on the floor, screaming!!\n");
}
}
func PRODNUM.on
{
if(#self.ison != NULL) {
@.emote("fumbles with the on-switch of the cattle-prod");
echo("it's already on\n");
} else {
@.emote("turns the cattle-prod on and grins");
#self.ison = .true;
}
}
func PRODNUM.off
{
if(#self.ison == NULL) {
@.emote("fumbles with the on-switch of the cattle-prod");
echo("it's already off\n");
} else {
@.emote("turns the cattle-prod off");
#self.ison = NULL;
}
}
/* make a pointer-binding to the function */
PRODNUM.zap = &PRODNUM.prod;