Skip to content

Commit

Permalink
Fix up death a little bit. It still needs work but this is a good start.
Browse files Browse the repository at this point in the history
moved the die function from std/combat to heart_beat.c
and fixed up the logic a bit, still need to do more than move player to
the void...

Kent
  • Loading branch information
Kent Mein committed Apr 26, 2012
1 parent 57e000d commit 82772ee
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 47 deletions.
25 changes: 23 additions & 2 deletions lib/domains/required/objects/corpse.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
inherit "/std/corpse";
inherit OBJECT;

void setup() {
static string orig_name;

void create(void) {
::create();
if (clone_num() != 0)
call_out("decompose", 30);
set_id("corpse");
set_in_room_desc("A foul smelling corpse.");
set_long("It looks just as awful as it smells.");
}

void set_name(string name) {
orig_name = name;
set_in_room_desc("The corpse of " + name);
}

void decompose(void) {
call_out("destruct", 30);
if (!orig_name)
orig_name = "noone";

set_in_room_desc("The somewhat decayed corpse of " + orig_name);
}
19 changes: 19 additions & 0 deletions lib/std/body/heart_beat.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,22 @@ string query_age() {

return ret;
}

void die(void) {
object obj;

obj = clone_object("/domains/required/objects/corpse");
if (this_object()->is_player()) {
obj->set_name(this_object()->query_Name());
obj->move(this_object()->query_environment());

this_object()->move(VOID);
// XXX Need to figure out consiquences and how to get back to life...
// EVENT_D->unsubscribe_event("heart_beat");

} else {
obj->set_name("a " + this_object()->query_id());
obj->move(this_object()->query_environment());
this_object()->destruct();
}
}
21 changes: 1 addition & 20 deletions lib/std/combat.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@ void halt_fight(void) {
targets = ( { } );
}

// XXX Need to work on this.... should move player to void...
// and drop money? I think this should be in body and or living not combat...
void die(void) {
object obj;

obj = clone_object("/domains/required/objects/corpse");
if (this_object()->is_player()) {
obj->set_name(this_object()->query_Name());
obj->move(this_object()->query_environment());

this_object()->move(VOID);
EVENT_D->unsubscribe_event("heart_beat");
this_object()->destruct();
} else {
obj->set_name("a " + this_object()->query_id());
obj->move(this_object()->query_environment());
}
}

void receive_damage(object who, int dam, int type) {
this_object()->message("%^RED%^You took " + dam + " damage from " +
who->query_id() + ".%^RESET%^");
Expand All @@ -60,7 +41,7 @@ void receive_damage(object who, int dam, int type) {
this_object()->simple_action("$N $vfall to the ground...dead.");
this_object()->message("You have died.");
halt_fight();
die();
this_object()->die();
}
}

Expand Down
25 changes: 0 additions & 25 deletions lib/std/corpse.c

This file was deleted.

0 comments on commit 82772ee

Please sign in to comment.