Sinking Underwater Non-floating Krud.

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 10/15/97


This modifies obj_to_room() to automatically sink non-floating objects put
in a room.  This also fixes the order of things in do_load() so as to not
look odd.  Players will still take 20% damage while drowning every tick.

I like this version better.

diff -upPr -x *.o ../stk/act.wizard.c ./act.wizard.c
--- ../stk/act.wizard.c Sat Apr 13 19:59:44 1996
+++ ./act.wizard.c      Wed Oct 15 18:04:38 1997
@@ -1048,10 +1048,10 @@ ACMD(do_load)
       return;
     }
     obj = read_object(r_num, REAL);
-    obj_to_room(obj, ch->in_room);
     act("$n makes a strange magical gesture.", TRUE, ch, 0, 0, TO_ROOM);
     act("$n has created $p!", FALSE, ch, obj, 0, TO_ROOM);
     act("You create $p.", FALSE, ch, obj, 0, TO_CHAR);
+    obj_to_room(obj, ch->in_room);
   } else
     send_to_char("That'll have to be either 'obj' or 'mob'.\r\n", ch);
 }
diff -upPr -x *.o ../stk/handler.c ./handler.c
--- ../stk/handler.c    Sat Apr 13 19:19:40 1996
+++ ./handler.c Wed Oct 15 17:59:22 1997
@@ -648,7 +648,12 @@ void obj_to_room(struct obj_data * objec
 {
   if (!object || room < 0 || room > top_of_world)
     log("SYSERR: Illegal value(s) passed to obj_to_room");
-  else {
+  else if (GET_OBJ_WEIGHT(object) > 0 && (SECT(room) == SECT_WATER_SWIM ||
+       SECT(room) == SECT_WATER_NOSWIM)) {
+    object->in_room = room;    /* act() target room. */
+    act("$p sinks into the watery depths.", FALSE, 0, object, 0, TO_ROOM);
+    extract_obj(object);
+  } else {
     object->next_content = world[room].contents;
     world[room].contents = object;
     object->in_room = room;
diff -upPr -x *.o ../stk/limits.c ./limits.c
--- ../stk/limits.c     Fri Apr 12 23:39:21 1996
+++ ./limits.c  Wed Oct 15 18:02:37 1997
@@ -22,6 +22,7 @@
        titles[(int)GET_CLASS(ch)][(int)GET_LEVEL(ch)].title_m :  \
        titles[(int)GET_CLASS(ch)][(int)GET_LEVEL(ch)].title_f)

+extern int has_boat(struct char_data *ch);

 extern struct char_data *character_list;
 extern struct obj_data *object_list;
@@ -401,8 +402,17 @@ void point_update(void)
       damage(i, i, 2, TYPE_SUFFERING);
     if (!IS_NPC(i)) {
       update_char_objects(i);
+
       if (GET_LEVEL(i) < LVL_GOD)
        check_idling(i);
+
+      if (GET_LEVEL(i) < LVL_IMMORT)
+       if (SECT(i->in_room) == SECT_WATER_NOSWIM && !has_boat(i)) {
+         act("$n thrashes about in the water straining to stay afloat.", FALSE,
+               i, 0, 0, TO_ROOM);
+         send_to_char("You are drowning!\r\n", i);
+         damage(i, i, GET_MAX_HIT(i) / 5, TYPE_SUFFERING); /* TYPE_DROWNING ? */
+       }
     }
   }

Now I suppose we should have a fly spell...

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST