Permalink
Browse files

Fix up death a little bit. It still needs work but this is a good start.

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...
1 parent 57e000d commit 82772eef1abdeb40195cc712b17891c0aff75acf Kent Mein committed Apr 26, 2012
Showing with 43 additions and 47 deletions.
  1. +23 −2 lib/domains/required/objects/corpse.c
  2. +19 −0 lib/std/body/heart_beat.c
  3. +1 −20 lib/std/combat.c
  4. +0 −25 lib/std/corpse.c
@@ -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);
}
View
@@ -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();
+ }
+}
View
@@ -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%^");
@@ -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();
}
}
View
@@ -1,25 +0,0 @@
-inherit OBJECT;
-
-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);
-}

0 comments on commit 82772ee

Please sign in to comment.