Author Topic: toninno DS patches  (Read 2809 times)

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
toninno DS patches
« on: March 08, 2015, 04:35:16 PM »
Hi, as it turned out today, as I was diffing my DS install, I made quite a few modifications agains DS3.8.6. I don't want to make a new topic for every 1-line-diff, so I'll just post my stuff here. Unless otherwise noted all patches provided by me in this topic are provided under gpl/public domain/wtfpl whichever you like :)

first patch: LIB_VIRT_MAP which basically means you can have a virtual area with a map provided, you can have concave virtual areas, and exits to external ((not neccessarily) non-virtual) rooms. Apply the patches and goto /domains/lpctest/virtual/forest/1,1,0 (yes, using my LIB_VIRT_MAP requires 3 coordinates, even when there's no 3rd dimension. However the forest in the town still works with 2 coordinates becasue it doesn't use my LIB_VIRT_MAP, it just uses LIB_VIRT_LAND)

Code: [Select]
diff -Naur a/lib/domains/lpctest/virtual/forest.c b/lib/domains/lpctest/virtual/forest.c
--- a/lib/domains/lpctest/virtual/forest.c      1970-01-01 01:00:00.000000000 +0100
+++ b/lib/domains/lpctest/virtual/forest.c      2015-03-08 20:45:17.000000000 +0100
@@ -0,0 +1,51 @@
+#include <lib.h>
+#include <dirs.h>
+#include <virtual.h>
+
+inherit LIB_VIRT_LAND;
+
+static private int XPosition, YPosition;
+
+varargs void SetLongAndItems(int x, int y, int z);
+
+varargs static void create(int x, int y) {
+    SetVirtFile("/domains/lpctest/virtual/forest");
+    SetMasterMap("/domains/lpctest/virtual/forest_map");
+    SetNoReplace(1);
+    virt_land::create();
+    /* Without the virtual exemption, virts with npc's
+     * wind up being perpetual motion NPC factories.
+     */
+    SetExemptVirtual(1);
+    XPosition = x;
+    YPosition = y;
+    SetClimate("temperate");
+    SetAmbientLight(30);
+    SetLongAndItems(x, y);
+    SetShort("a thick forest");
+
+    SetGoMessage("You can't travel in that direction.");
+}
+
+varargs void SetLongAndItems(int x, int y, int z) {
+    mapping inv, items;
+    string str;
+    ::SetLongAndItems(x, y, z);
+
+    inv = ([]);
+    str = "You are in a vast forest. The trees and "
+        "thick vegetation press in from all sides, appearing almost "
+        "threatening. "
+        "No path marks your way. ";
+    if(query_night()) str += "The stars of the night sky "
+        "are barely visible through the heavy forest canopy overhead.";
+    else str+= "Sunlight penetrates the tree cover with great "
+        "difficulty, rendering the forest cool and dark.";
+
+    str+=" According to the map, this room is area type "+GetAreaType();
+
+    SetLong(str);
+    SetDayLight(25);
+    SetNightLight(0);
+    SetInventory(inv);
+}
diff -Naur a/lib/domains/lpctest/virtual/forest_map.c b/lib/domains/lpctest/virtual/forest_map.c
--- a/lib/domains/lpctest/virtual/forest_map.c  1970-01-01 01:00:00.000000000 +0100
+++ b/lib/domains/lpctest/virtual/forest_map.c  2015-03-08 21:33:09.000000000 +0100
@@ -0,0 +1,49 @@
+#include <lib.h>
+#include <dirs.h>
+#include <virtual.h>
+
+inherit LIB_VIRT_MAP;
+
+varargs string array BaseMap(){ //override with actual map
+    return
+    ({
+      ({"0000000000000000000000000",
+        "0111111111111111111111110",
+        "0111111111111111111111110",
+        "0111111111111111111111110",
+        "0111111111111111111111110",
+        "0111122111111111112211110",
+        "0111222211111111122221110",
+        "0111222211111111122221110",
+        "0111122111111111112211110",
+        "0111111111111111111111110",
+        "0111111111100011111111110",
+        "0111111111100011111111110",
+        "0111111111100011111111110",
+        "0112111111111111111112110",
+        "0112111111111111111112110",
+        "0111211111111111111121110",
+        "0111121111111111111211110",
+        "0111112221111111222111110",
+        "0111111112222222111111110",
+        "0111111111111111111111110",
+        "0111111111111111111111110",
+        "0111111111111111111111110",
+        "0111111111111111111111110",
+        "0111111111111111111111110",
+        "0000000000000000000000000",
+      })
+    });
+
+}
+
+
+varargs static void create() {
+    ::create();
+    SetExternalRoom(1,1,0,"down","/domains/default/room/start.c");
+    //SetNoClean(1);
+    //SetVirtFile(base_name(this_object()));
+    //AddLocation("foo", ({2,2,0}) );
+}
+
+
diff -Naur a/lib/domains/lpctest/virtual/server.c b/lib/domains/lpctest/virtual/server.c
--- a/lib/domains/lpctest/virtual/server.c      1970-01-01 01:00:00.000000000 +0100
+++ b/lib/domains/lpctest/virtual/server.c      2015-03-08 21:05:57.000000000 +0100
@@ -0,0 +1,19 @@
+mixed compile_object(string file) {
+    string *path;
+    object ob;
+    int x, y, z, elements;
+    if(grepp(file, "/user_") || grepp(file, "/object_")){
+        ob = new("/domains/default/virtual/void");
+        if(!ob){
+            return "No void room available.";
+        }
+        return ob;
+    }
+    path = explode(file, "/");
+    if( file_size(__DIR__ + path[3] + ".c") < 1 ) return "bad file";
+    if( (elements = sscanf(path[4], "%d,%d,%d", x, y, z)) != 3 ) {
+        return "missing comma";
+    }
+    if( !(ob = new(__DIR__ + path[3], x, y, z)) ) return "failed to compile";
+    return ob;
+}
diff -Naur a/lib/lib/virtual/virt_map.c b/lib/lib/virtual/virt_map.c
--- a/lib/lib/virtual/virt_map.c        2009-12-30 10:55:00.000000000 +0100
+++ b/lib/lib/virtual/virt_map.c        2015-03-08 21:34:21.000000000 +0100
@@ -13,6 +13,7 @@
 private mapping Location=([]);
 private mixed AreaMap;
 private string Virt_Room= "";
+private mapping xroom=([]);
 
 /******************* virt_map.c required overrides ************/
 
@@ -36,9 +37,9 @@
     if(           x<0
             || y<0
             || z<0
-            || z>sizeof(AreaMap)
-            || y>sizeof(AreaMap[0])
-            || x>sizeof(AreaMap[0][0]))
+            || z>=sizeof(AreaMap)
+            || y>=sizeof(AreaMap[0])
+            || x>=sizeof(AreaMap[0][0]))
         return "0";
     return copy(AreaMap[z][y][x..x]);
 
@@ -46,15 +47,7 @@
 
 varargs mixed SetAreaMap(int y,int x ,int z, string str){
     if(nullp(x)||nullp(y)||nullp(z)){
-        string x_line="";
-        string * y_line=({});
-        AreaMap=BaseMap();
-        z=sizeof(AreaMap);
-        y=sizeof(AreaMap[0]);
-        x=sizeof(AreaMap[0][0]);
-        while (x --) x_line += "0";
-        while (y --) y_line += ({x_line});
-        return AreaMap = ({y_line}) +AreaMap + ({y_line});
+        return AreaMap=BaseMap();
     }
     else return AreaMap[z][y][x..x]=str;
 }
@@ -167,5 +160,19 @@
     return 1;
 }
 
+void SetExternalRoom(int x,int y,int z,string dir,string room)
+{
+  if(!mapp(xroom[x])) xroom[x]=([]);
+  if(!mapp(xroom[x][y])) xroom[x][y]=([]);
+  if(!mapp(xroom[x][y][z])) xroom[x][y][z]=([]);
+  xroom[x][y][z][dir]=room;
+}
 
-
+string GetExternalRoom(int x,int y,int z,string dir)
+{
+  if(!mapp(xroom[x])) return;
+  if(!mapp(xroom[x][y])) return;
+  if(!mapp(xroom[x][y][z])) return;
+  if(!stringp(xroom[x][y][z][dir])) return;
+  return xroom[x][y][z][dir];
+}

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #1 on: March 08, 2015, 05:43:49 PM »
I accidentally left this file out from the LIB_VIRT_MAP patch (it's LIB_VIRT_LAND, but as written previously, the forest still works)
Code: [Select]
diff -Naur a/lib/lib/virtual/virt_land.c b/lib/lib/virtual/virt_land.c
--- a/lib/lib/virtual/virt_land.c       2014-11-02 01:34:00.000000000 +0100
+++ b/lib/lib/virtual/virt_land.c       2015-03-08 21:39:18.000000000 +0100
@@ -27,7 +27,7 @@
 
 varargs void SetLongAndItems(int x, int y, int z){
     SetVirtualExits(x, y, z);
-}
+}
 
 /******************* virt_land.c required settings ************/
 
@@ -63,7 +63,6 @@
         return 0;
     }
     Virt_Room=file;
-    SetMasterMap( file );
     return 1;
 }
 
@@ -80,11 +79,11 @@
 }
 
 mapping GetDirectionMap(){
-    return (["north":({-1,0,0}),"south":({1,0,0}),
-            "east":({0,1,0}),"west":({0,-1,0}),
-            "northeast":({-1,1,0}),"northwest":({-1,-1,0}),
-            "southeast":({1,1,0}),"southwest":({1,-1,0}),
-            "up":({0,0,-1}),"down":({0,0,1}) ]);
+    return (["north":({0,-1,0}),"south":({0,1,0}),
+             "east":({1,0,0}),"west":({-1,0,0}),
+            "northeast":({1,-1,0}),"northwest":({-1,-1,0}),
+            "southeast":({1,1,0}),"southwest":({-1,1,0}),
+            "up":({0,0,1}),"down":({0,0,-1}) ]);
 }
 
 string GetReverseDirection(string dir){
@@ -96,7 +95,8 @@
 }
 
 varargs mixed GetMapType(int x, int y, int z){
-    if(!objectp(Map_Master) || nullp(x) ||nullp(y) || nullp(z) )
+    if(nullp(z)) z=0;
+    if(!objectp(Map_Master) || nullp(x) ||nullp(y) )
         return 0;
     return Map_Master->GetAreaMap(x,y,z);
 }
@@ -104,51 +104,43 @@
 mapping SetSurroundAreas(int x, int y, int z){
     mapping surrounds = ([]);
     foreach(string dir, int * offset in GetDirectionMap())
-        surrounds[dir] = GetMapType((x + offset[1]),
-                (y + offset[0]),(z + offset[2]));
+        surrounds[dir] = GetMapType((x + offset[0]),
+                (y + offset[1]),(z + offset[2]));
     return Surrounding_Areas=surrounds;
 }
 
 void ResetSurroundExits(){
     foreach(string dir, string atype in Surrounding_Areas){
-        if(atype != "0" && atype != "@"){
+        if(atype != "0" /*&& atype != "@"*/){
             (Virt_Room + "/"
-             + ( CoordX + GetDirectionMap()[dir][1]) + ","
-             + ( CoordY + GetDirectionMap()[dir][0]) + ","   
+             + ( CoordX + GetDirectionMap()[dir][0]) + ","
+             + ( CoordY + GetDirectionMap()[dir][1]) + ","
              + ( CoordZ + GetDirectionMap()[dir][2]))->ResetLocation();
         }
     }
 }
 
-
 void SetVirtualExits(int x, int y, int z){
-    if(sizeof(Virt_Room)){
+    if(strlen(Virt_Room)){
         string * obexits=({});
 
         SetSurroundAreas(x,y,z);
 
         foreach(string dir, string atype in Surrounding_Areas){
-            if(atype != "0" && atype != "@"){
-                AddExit(dir,Virt_Room+"/"
-                        + ( x + GetDirectionMap()[dir][1])+","
-                        + ( y + GetDirectionMap()[dir][0])+ ","   
-                        + ( z + GetDirectionMap()[dir][2]));
+            string xs;
+            if(atype != "0" /*&& atype != "@"*/)
+                xs=Virt_Room+"/"
+                        + ( x + GetDirectionMap()[dir][0])+","
+                        + ( y + GetDirectionMap()[dir][1])+ ","
+                        + ( z + GetDirectionMap()[dir][2]);
+            else
+                xs=Map_Master->GetExternalRoom(x,y,z,dir);
+
+            if(stringp(xs)&&strlen(xs))
+            {
+                AddExit(dir, xs);
                 obexits += ({dir[0..0]+dir[5..5]});
             }
-            else if( atype == "@"){
-                mixed exit =
-                    Map_Master->GetExternalRoom(
-                            sprintf("%d,%d,%d",
-                                ( x + GetDirectionMap()[dir][1]),
-                                ( y + GetDirectionMap()[dir][0]),   
-                                ( z + GetDirectionMap()[dir][2])),
-                            sprintf("%d,%d,%d",x,y,z)
-                            );
-                if(exit){
-                    AddExit(dir, exit);
-                    obexits += ({dir[0..0]+dir[5..5]});
-                }
-            }
         }
 
         SetObviousExits(implode(obexits,", "));

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #2 on: March 08, 2015, 05:52:42 PM »
This one makes SYSTEM <death> announcements contain the room where the massacre took place.
Code: [Select]
diff -Naur a/lib/lib/body.c b/lib/lib/body.c
--- a/lib/lib/body.c    2014-11-03 18:10:42.000000000 +0100
+++ b/lib/lib/body.c    2015-03-08 23:16:56.868056725 +0100
@@ -826,17 +826,23 @@
         else killer = agent->GetName();
     }
 
+    death_annc=killer;
+
     if(RACES_D->GetNonMeatRace(GetRace()))
-        death_annc = killer + " has destroyed "+ this_object()->GetName()+".";
+        death_annc += " has destroyed ";
     else if(!this_object()->GetUndead())
-        death_annc = killer + " has slain "+ this_object()->GetName()+".";
-    else death_annc = killer + " has destroyed "+ this_object()->GetName()+".";
+        death_annc += " has slain ";
+    else death_annc += " has destroyed ";
+
+    death_annc+=this_object()->GetName();
 
     if(killer == "asphyxia"){
         tell_room(ROOM_ARCH, this_object()->GetName() + " asphyxiated "+
                 "in "+base_name(environment(this_object())));
     }
 
+    death_annc+=" at "+base_name(room_environment(this_object()));
+
     CHAT_D->eventSendChannel("SYSTEM","death",death_annc,0);
 
     if( Sleeping > 0 ) Sleeping = 0;

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #3 on: March 08, 2015, 05:55:05 PM »
as the game refers to this object as "a suit of leather armor" to make sure the game understands me if I refer to this object as "a suit of leather armor"

Code: [Select]
diff -Naur a/lib/domains/cave/armor/leather_armor.c b/lib/domains/cave/armor/leather_armor.c
--- a/lib/domains/cave/armor/leather_armor.c    2009-12-30 10:54:34.000000000 +0100
+++ b/lib/domains/cave/armor/leather_armor.c    2015-03-08 23:37:08.741323526 +0100
@@ -14,7 +14,7 @@
     armor::create();
     SetKeyName("leather armor");
     SetId( ({ "armor", "leather armor" }) );
-    SetAdjectives( ({ "leather" }) );
+    SetAdjectives( ({ "leather","suit of" }) );
     SetShort("a suit of leather armor");
     SetLong("An ordinary suit of leather armor. It is worn on one's arms, torso and legs.");
     SetVendorType(VT_ARMOR);

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #4 on: March 08, 2015, 05:59:36 PM »
I've seen an error once, which could have been avoided by this patch
Code: [Select]
diff -Naur a/lib/domains/default/npc/drone3.c b/lib/domains/default/npc/drone3.c
--- a/lib/domains/default/npc/drone3.c  2012-03-07 23:49:52.000000000 +0100
+++ b/lib/domains/default/npc/drone3.c  2015-03-08 23:03:00.650070886 +0100
@@ -99,7 +99,7 @@
         if(drones) drones->ReceiveNoGo(nogo + no_go + ({ base_name(env) }));
 #endif
         ROOMS_D->DroneCache( ({ exit }) );
-        if(strsrch(exit, "/virtual/") < 0){
+        if((!stringp(exit))||(strsrch(exit, "/virtual/")<0)){
             catch( newdrone->eventMove(exit) );
         }
     }

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #5 on: March 08, 2015, 06:00:52 PM »
fixes a landstrider mech (any mount?) related map visibility issue
Code: [Select]
diff -Naur a/lib/lib/events/describe.c b/lib/lib/events/describe.c
--- a/lib/lib/events/describe.c 2011-08-25 03:16:32.000000000 +0200
+++ b/lib/lib/events/describe.c 2015-03-08 23:48:02.808506281 +0100
@@ -70,7 +70,7 @@
 #if (WIZMAP && GRID)
             if(MASTER_D->GetPerfOK() &&
                     this_object()->GetProperty("wizmapping")){
-                desc += MAP_D->GetMap(environment(this_object()),6)+"\n";
+                desc += MAP_D->GetMap(room_environment(this_object()),6)+"\n";
             }
 #endif
             desc += env->GetLong();

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #6 on: March 08, 2015, 06:04:19 PM »
makes it even... weirder. now with flooding functionality
Code: [Select]
diff -Naur a/lib/secure/obj/weirder.c b/lib/secure/obj/weirder.c
--- a/lib/secure/obj/weirder.c  2011-04-10 18:50:48.000000000 +0200
+++ b/lib/secure/obj/weirder.c  2015-02-28 22:34:15.000000000 +0100
@@ -102,7 +102,7 @@
 void create(){
     ::create();
     exceptions = ({ "monty.c","charles.c","charly.c","tree.c","lars.c",
-            "wraith.c", "archwraith.c","drone2.c","beggar.c","drone.c"});
+            "wraith.c", "archwraith.c","drone2.c","beggar.c","drone.c","drone3.c"});
     SetKeyName("weirding module");
     SetId( ({"module", "box", "weirder"}) );
     SetAdjectives( ({"small","featureless","black"}) );
@@ -116,6 +116,8 @@
 }
 void init(){
     ::init();
+    add_action("stressflood","stressflood");
+    add_action("killflood","killflood");
     add_action("stressload","stressload");
     add_action("loadrooms","loadrooms");
     add_action("loadobs","loadobs");
@@ -359,6 +361,38 @@
     return 1;
 }
 
+int stressflood(string arg){
+    object env;
+    object flow;
+    int press;
+    if(arg) press=atoi(arg);
+    if(press<0) press=1;
+    press=(press||1);
+    tc("ok, flooding, pressure: "+press);
+    env=room_environment(this_object());
+    if(!env) {tc("failure: lack of room environment. Aborting.");return 0;}
+    flow = present("flow object", env);
+    if(!flow)
+    {
+      int tmp;
+      flow=new(LIB_FLOW);
+      if(!flow) {tc("failure: unable to new(LIB_FLOW). Aborting.");return 0;}
+      tmp=flow->eventMove(env);
+      if(!tmp) {tc("failure: unable to flow->evetMove(). Aborting.");return 0;}
+    }
+    flow->SetPressure(press);
+    return 1;
+}
+
+int killflood(){
+    int q;
+    q=sizeof(objects( (: inherits(LIB_FLOW, $1) :) )->eventDestruct());
+    q=q+sizeof(objects( (: base_name($1) == LIB_FLOW :) )->eventDestruct());
+    tc("killflood destructed "+q+" flow objects");
+    if(q) call_out("killflood",1);
+    return 1;
+}
+
 int stressload(string arg){
     int i;
     if(arg) i = atoi(arg);

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #7 on: March 08, 2015, 06:39:15 PM »
fixing coordinate/wizmap related issues, overlapping
Code: [Select]
diff -Naur a/lib/domains/campus/room/tunnel.c b/lib/domains/campus/room/tunnel.c
--- a/lib/domains/campus/room/tunnel.c 2013-07-20 17:07:44.000000000 +0200
+++ b/lib/domains/campus/room/tunnel.c 2015-03-01 14:17:51.000000000 +0100
@@ -27,7 +27,7 @@
                 "east" : "/domains/campus/room/basement2",
                 "west" : "/domains/campus/room/tunnel2"]));
     SetProperty("no attack", 1);
-    SetCoordinates("4003,4000,-1");
+    SetCoordinates("3997,4000,-1");//this might have been intentional to make sure map command doesn't spoil the secret passage
 }
 void init(){
     ::init();
diff -Naur a/lib/domains/cave/room/cavetroll.c b/lib/domains/cave/room/cavetroll.c
--- a/lib/domains/cave/room/cavetroll.c 2009-12-30 10:54:34.000000000 +0100
+++ b/lib/domains/cave/room/cavetroll.c 2015-03-01 17:32:33.000000000 +0100
@@ -24,6 +24,7 @@
     SetDoor("southwest", "/domains/town/doors/gate.c");
     SetFlyRoom("/domains/cave/room/chieftain");
     SetFlowLimit(2);
+    SetCoordinates("2,3,-2");
 }
 
 void init(){
diff -Naur a/lib/domains/default/room/menagerie.c b/lib/domains/default/room/menagerie.c
--- a/lib/domains/default/room/menagerie.c 2009-12-30 10:54:38.000000000 +0100
+++ b/lib/domains/default/room/menagerie.c 2015-03-01 15:11:03.000000000 +0100
@@ -16,7 +16,7 @@
     SetExits( ([
                 "south" : "/domains/default/room/menagerie_south",
                 "east" : "/domains/default/room/menagerie_e",
-                "west" : "/domains/default/room/menagerie_w",
+                "north" : "/domains/default/room/menagerie_n",
                 "up" : "/domains/default/room/wiz_corr_south",
                 ]) );
     SetInventory(([
diff -Naur a/lib/domains/default/room/menagerie_n.c b/lib/domains/default/room/menagerie_n.c
--- a/lib/domains/default/room/menagerie_n.c 1970-01-01 01:00:00.000000000 +0100
+++ b/lib/domains/default/room/menagerie_n.c 2015-03-01 15:11:20.000000000 +0100
@@ -0,0 +1,31 @@
+#include <lib.h>
+#include ROOMS_H
+
+inherit LIB_ROOM;
+
+void create() {
+    room::create();
+    SetAmbientLight(30);
+    SetShort("Menagerie, west");
+    SetLong("This is the western annex of the menagerie.");
+    SetInventory(([
+                "/domains/default/npc/dwarf" : 1,
+                "/domains/default/npc/helf" : 1,
+                "/domains/default/npc/artrell" : 1,
+                "/domains/default/npc/halfling" : 1,
+                "/domains/default/npc/nymph" : 1,
+                "/domains/default/npc/avidryl" : 1,
+                "/domains/default/npc/faerie" : 1,
+                "/domains/default/npc/hobbit" : 1,
+                "/domains/default/npc/pessis" : 1,
+                "/domains/default/npc/kender" : 1,
+                "/domains/default/npc/zoe" : 1,
+                ]));
+    SetExits(([
+                "south" : "/domains/default/room/menagerie",
+                ]));
+
+}
+void init(){
+    ::init();
+}
diff -Naur a/lib/domains/default/room/menagerie_w.c b/lib/domains/default/room/menagerie_w.c
--- a/lib/domains/default/room/menagerie_w.c 2009-12-30 10:54:38.000000000 +0100
+++ b/lib/domains/default/room/menagerie_w.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,31 +0,0 @@
-#include <lib.h>
-#include ROOMS_H
-
-inherit LIB_ROOM;
-
-void create() {
-    room::create();
-    SetAmbientLight(30);
-    SetShort("Menagerie, west");
-    SetLong("This is the western annex of the menagerie.");
-    SetInventory(([
-                "/domains/default/npc/dwarf" : 1,
-                "/domains/default/npc/helf" : 1,
-                "/domains/default/npc/artrell" : 1,
-                "/domains/default/npc/halfling" : 1,
-                "/domains/default/npc/nymph" : 1,
-                "/domains/default/npc/avidryl" : 1,
-                "/domains/default/npc/faerie" : 1,
-                "/domains/default/npc/hobbit" : 1,
-                "/domains/default/npc/pessis" : 1,
-                "/domains/default/npc/kender" : 1,
-                "/domains/default/npc/zoe" : 1,
-                ]));
-    SetExits(([
-                "east" : "/domains/default/room/menagerie",
-                ]));
-
-}
-void init(){
-    ::init();
-}
diff -Naur a/lib/domains/town/room/mansion_ext.c b/lib/domains/town/room/mansion_ext.c
--- a/lib/domains/town/room/mansion_ext.c 2014-11-02 01:34:00.000000000 +0100
+++ b/lib/domains/town/room/mansion_ext.c 2015-03-01 13:53:03.000000000 +0100
@@ -33,6 +33,7 @@
                 ]) );
     SetDoor("south","/domains/town/doors/mansion");
     AddItem(new("/domains/town/obj/lamp"));
+    SetCoordinates("-2,-2,0");
 }
 void init(){
     ::init();
diff -Naur a/lib/domains/town/room/mansion_uhall1.c b/lib/domains/town/room/mansion_uhall1.c
--- a/lib/domains/town/room/mansion_uhall1.c 2014-11-02 01:34:00.000000000 +0100
+++ b/lib/domains/town/room/mansion_uhall1.c 2015-03-01 13:42:58.000000000 +0100
@@ -27,11 +27,9 @@
     SetEnters( ([
                 "window" : "/domains/town/room/mansion_ext"
                 ]) );
-
     SetDoor("east", "/domains/town/doors/m1.c");
-
     SetDoor("west", "/domains/town/doors/m2.c");
-
+    SetCoordinates("-2,-3,1");
 }
 void init(){
     ::init();

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #8 on: March 21, 2015, 09:01:04 AM »
A NEWS_GOODBYE patch:

Code: [Select]
diff -Naur a/lib/lib/interactive.c b/lib/lib/interactive.c
--- a/lib/lib/interactive.c 2014-11-02 01:34:00.000000000 +0100
+++ b/lib/lib/interactive.c 2015-03-09 18:31:44.229687040 +0100
@@ -10,6 +10,7 @@
 #define NM_STYLE_EXITS 1
 #endif
 
+#include <news.h>
 #include <lib.h>
 #include <clock.h>
 #include <privs.h>
@@ -282,7 +283,11 @@
         return 0;
     }
     quitting = 1;
-    tell_object(this_object(),"Please come back another time!");
+#ifdef NEWS_GOODBYE
+    if(file_exists(NEWS_GOODBYE)) tmp=read_file(NEWS_GOODBYE); else
+#endif
+    tmp="Please come back another time!";
+    tell_object(this_object(),tmp);
     if(!creatorp(this_object())){
         foreach(object ob in all_inventory(this_object())){
             if((!retain && !ob->GetRetain()) || !ob->GetRetain()) ob->eventMove(env);
diff -Naur a/lib/news/goodbye b/lib/news/goodbye
--- a/lib/news/goodbye 1970-01-01 01:00:00.000000000 +0100
+++ b/lib/news/goodbye 2015-03-21 14:49:11.346453994 +0100
@@ -0,0 +1,4 @@
+Please come back another time!
+your customized goodbye message comes here. overwrite, edit or delete this file
+If you delete this file the default "Please come back another time!" will be seen by the users when quitting
+permanent MUD address: mud.domain.editme.tld 6666
diff -Naur a/lib/secure/include/news.h b/lib/secure/include/news.h
--- a/lib/secure/include/news.h 2009-05-11 16:55:52.000000000 +0200
+++ b/lib/secure/include/news.h 2015-03-09 18:16:55.947833598 +0100
@@ -14,6 +14,7 @@
 #define NEWS_NEWBIE             DIR_NEWS "/newbie"
 #define NEWS_REGISTER           DIR_NEWS "/register"
 #define NEWS_WELCOME            DIR_NEWS "/welcome"
+#define NEWS_GOODBYE            DIR_NEWS "/goodbye"
 #define DS_WELCOME              DIR_NEWS "/deadsouls"
 
 #endif /* s_news_h */

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #9 on: March 22, 2015, 03:18:51 PM »
I've found 3 testchar badges (/domains/default/armor/badge, /domains/town/armor/badge, /domains/campus/armor/badge), some had no steal flag, some had chalkboard posting prevention.. some of them missed (at least one of) these features. So I unified these badges and made them to inherit from a single badge file (/domains/default/armor/badge), this way you can make changes in all three badges by just updating one file.

Code: [Select]
diff -Naur a/lib/domains/campus/armor/badge.c b/lib/domains/campus/armor/badge.c
--- a/lib/domains/campus/armor/badge.c 2009-12-30 10:54:42.000000000 +0100
+++ b/lib/domains/campus/armor/badge.c 2015-03-22 16:11:35.500018411 +0100
@@ -1,50 +1,6 @@
-#include <lib.h>
-#include <armor_types.h>
-#include <damage_types.h>
-inherit LIB_ARMOR;
+inherit "/domains/default/armor/badge.c";
 
-static void create(){
-    armor::create();
-    SetKeyName("visitor's pass");
-    SetId(({"testchar badge","badge","pass","visitor's pass"}));
-    SetShort("a test character Visitor's Pass");
-    SetLong("This clip-on plastic badge grants the wearer access to "+
-            "some areas typically restricted to creator staff only. Abuse of this "+
-            "pass is grounds for disciplinary action. A small scribble "+
-            "at the bottom of the pass reads: click heels");
-    SetMass(10);
-    SetDollarCost(5000);
-    SetDamagePoints(100);
-    SetArmorType(A_AMULET);
-    SetRetainOnDeath(1);
-    SetRestrictLimbs( ({ "torso" }) );
-}
-void init(){
-    ::init();
-    add_action("nplh","click");
-    add_action("post_it","post");
-}
-int nplh(string str){
-    if(str=="heels"){
-        if(present(this_object()->GetKeyName(),this_player() ) ){
-            write("There's no place like home!\n"+
-                    "You are transported by an awesome whirlwind somewhere "+
-                    "else...\n");
-            this_player()->eventMoveLiving("/domains/campus/room/start");
-            return 1;
-        }
-        write("You click your heels together...but feel "+
-                "as though you're missing something.\n");
-        return 1;
-    }
-}
-int post_it(string str){
-    if(present("chalkboard",environment(this_player())) && !creatorp(this_player()) ){
-        write("As a visitor, you are not allowed to post on creator boards.");
-        return 1;
-    }
-}
-string GetAffectLong(object ob) {
-    if(!ob || !living(ob)) return 0;
-    return ob->GetName() + " is an authorized Test Character.";
+static void create()
+{
+  ::create("/domains/campus/room/start");
 }
diff -Naur a/lib/domains/default/armor/badge.c b/lib/domains/default/armor/badge.c
--- a/lib/domains/default/armor/badge.c 2009-12-30 10:54:36.000000000 +0100
+++ b/lib/domains/default/armor/badge.c 2015-03-22 16:17:54.454373180 +0100
@@ -1,10 +1,20 @@
+//this file acts as the base object for all test char visitor's badge objects
+//this file shouldn't define ROOM_CLICKHEELS here, to make sure the default can kick in a few lines later:
+//#define ROOM_CLICKHEELS "/domains/whatever/rooms/bla"
 #include <lib.h>
+#ifndef ROOM_CLICKHEELS
+//needed for ROOM_START:
 #include ROOMS_H
+//if you want to tweak the default click heels room, do it here:
+#define ROOM_CLICKHEELS ROOM_START
+#endif
 #include <armor_types.h>
 #include <damage_types.h>
 inherit LIB_ARMOR;
 
-static void create(){
+string room_clickheels=ROOM_CLICKHEELS;
+
+static void create(string rch){
     armor::create();
     SetKeyName("visitor pass");
     SetId(({"testchar badge","badge","pass","visitor's pass"}));
@@ -16,24 +26,29 @@
     SetProperties(([
                 "no steal" : 1,
                 ]));
-    SetMass(10);
-    SetBaseCost(5000);
+    SetMass(1);
+    SetBaseCost("silver",500);
     SetDamagePoints(100);
     SetArmorType(A_AMULET);
     SetRetainOnDeath(1);
     SetRestrictLimbs( ({ "torso" }) );
+    SetDestroyOnSell(1);
+    if(stringp(rch)) room_clickheels=rch;
 }
+
 void init(){
     ::init();
     add_action("nplh","click");
+    add_action("post_it","post");
 }
+
 int nplh(string str){
     if(str=="heels"){
         if(present(this_object()->GetKeyName(),this_player() ) ){
             write("There's no place like home!\n"+
                     "You are transported by an awesome whirlwind somewhere "+
                     "else...\n");
-            this_player()->eventMoveLiving(ROOM_START);
+            this_player()->eventMoveLiving(room_clickheels);
             return 1;
         }
         write("You click your heels together...but feel "+
@@ -41,7 +56,26 @@
         return 1;
     }
 }
+
+int post_it(string str){
+    if(present("chalkboard",environment(this_player())) && !creatorp(this_player()) ){
+        write("As a visitor, you are not allowed to post on creator boards.");
+        return 1;
+    }
+}
+
 string GetAffectLong(object ob) {
     if(!ob || !living(ob)) return 0;
     return ob->GetName() + " is an authorized Test Character.";
 }
+
+string GetClickHeelsRoom()
+{
+  return room_clickheels;
+}
+
+string SetClickHeelsRoom(string s)
+{
+  if(!stringp(s)) return room_clickheels;
+  return room_clickheels;
+}
diff -Naur a/lib/domains/town/armor/badge.c b/lib/domains/town/armor/badge.c
--- a/lib/domains/town/armor/badge.c 2009-12-30 10:54:54.000000000 +0100
+++ b/lib/domains/town/armor/badge.c 2015-03-22 16:10:49.153974527 +0100
@@ -1,49 +1 @@
-#include <lib.h>
-#include ROOMS_H
-#include <armor_types.h>
-#include <damage_types.h>
-inherit LIB_ARMOR;
-
-static void create(){
-    armor::create();
-    SetKeyName("visitor pass");
-    SetId(({"testchar badge","badge","pass","visitor's pass"}));
-    SetShort("a test character Visitor's Pass");
-    SetLong("This clip-on plastic badge grants the wearer access to "+
-            "some areas typically restricted to creator staff only. Abuse of this "+
-            "pass is grounds for disciplinary action. A small scribble "+
-            "at the bottom of the pass reads: click heels");
-    SetProperties(([
-                "no steal" : 1,
-                ]));
-    SetMass(1);
-    SetBaseCost("silver",500);
-    SetArmorType(A_AMULET);
-    SetRetainOnDeath(1);
-    SetRestrictLimbs( ({ "torso" }) );
-}
-
-void init(){
-    ::init();
-    add_action("nplh","click");
-}
-
-int nplh(string str){
-    if(str=="heels"){
-        if(present(this_object()->GetKeyName(),this_player() ) ){
-            write("There's no place like home!\n"+
-                    "You are transported by an awesome whirlwind somewhere "+
-                    "else...\n");
-            this_player()->eventMoveLiving(ROOM_START);
-            return 1;
-        }
-        write("You click your heels together...but feel "+
-                "as though you're missing something.\n");
-        return 1;
-    }
-}
-
-string GetAffectLong(object ob) {
-    if(!ob || !living(ob)) return 0;
-    return ob->GetName() + " is an authorized Test Character.";
-}
+inherit "/domains/default/armor/badge.c";

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #10 on: June 16, 2015, 04:21:06 PM »
makes dirk be less like a puzzle
Code: [Select]
diff -Naur a/lib/domains/town/npc/dirk.c b/lib/domains/town/npc/dirk.c
--- a/lib/domains/town/npc/dirk.c       2009-12-30 10:54:54.000000000 +0100
+++ b/lib/domains/town/npc/dirk.c       2015-06-16 22:51:26.516272582 +0200
@@ -62,7 +62,7 @@
                 "advance": (: AdvanceDude :)
                 ]) );
     SetRequestResponses( ([
-                ({ "a hint", "hints", "a clue", "clues", "a tip", "tips" }) :
+                ({ "a hint", "hints", "a clue", "clues", "a tip", "tips", "tip" }) :
                 (: TalkFunc :),
                 ]) );
     SetConsultResponses( ([

Offline toninno

  • Acquaintance
  • *
  • Posts: 16
    • View Profile
Re: toninno DS patches
« Reply #11 on: July 27, 2015, 11:54:34 AM »
this makes connect.* files more easily trackable using a VCS (e.g. no need to keep connect.c and connect.first.c in sync, basically you could have connect.c in your .gitignore)
Code: [Select]
diff --git a/secure/lib/connect.c b/secure/lib/connect.c
index ebf1886..6370dce 100644
--- a/secure/lib/connect.c
+++ b/secure/lib/connect.c
@@ -1,208 +1 @@
-/*    Installation object for Dead Souls
- *    Original author: George Reese
- */
-
-#include <lib.h>
-#include <cfg.h>
-#include <dirs.h>
-#include <flags.h>
-#include <daemons.h>
-#include <runtime_config.h>
-
-string Name, CapName, Password;
-object Admin;
-int blindmode;
-
-static void InputName(string str);
-
-static void logon() {
-    receive("Welcome to the Dead Souls " + mudlib_version() +
-            " installation process!!\n\n");
-    receive("You will be asked a series of questions for creating an "
-            "admin character.\n\n");
-    receive("What is your MUD admin username?\n ");
-    input_to((: InputName :), I_NOESC);
-}
-
-static void InputPassword(string str);
-
-static void CheckBlind(string str){
-    if( !str || str == "" || lower_case(str)[0..0] == "y" ) {
-        receive("\nOk, disabling default overhead map.\n");
-        blindmode = 1;
-    }
-    else receive("\Ok, allowing default overhead map behavior.\n");
-    receive("\nCreate a password of at least 5 letters: \n");
-    input_to((: InputPassword :), I_NOECHO | I_NOESC);
-}
-
-static void InputName(string str) {
-    if( !(BANISH_D->valid_name(Name = convert_name(CapName = str)))
-            || lower_case(str) == "guest") {
-        receive("That is not a valid name.\n");
-        receive("Name: ");
-        input_to((: InputName :));
-        return;
-    }
-    Admin = master()->player_object(Name);
-    Admin->SetKeyName(Name);
-    mkdir(DIR_PLAYERS "/" + Name[0..0]);
-    receive("\nDo you use a screen reader for the visually impaired? (y/n)\n");
-    input_to((: CheckBlind :), I_NOESC);
-}
-
-static void ConfirmPassword(string str);
-
-static void InputPassword(string str) {
-    if( strlen(str) < 5 ) {
-        receive("Password must be at least 5 letters.\n");
-        receive("Password: ");
-        input_to((: InputPassword :), I_NOECHO | I_NOESC);
-        return;
-    }
-    Password = str;
-    receive("\nConfirm password: ");
-    input_to((: ConfirmPassword :), I_NOECHO | I_NOESC);
-}
-
-static void InputCapName(string str);
-
-static void ConfirmPassword(string str) {
-    if( str != Password) {
-        receive("\nPasswords do not match.  Password: ");
-        input_to((: InputPassword :), I_NOECHO | I_NOESC);
-        return;
-    }
-    Admin->SetPassword(crypt(Password, 0));
-    CapName = capitalize(CapName);
-    receive("\nEnter your display name (" + CapName + " is default): ");
-    input_to((: InputCapName :), I_NOESC);
-}
-
-static void InputGender(string str);
-
-static void InputCapName(string str) {
-    if( !str || str == "" ) str = CapName;
-    if( convert_name(str) != Name ) {
-        receive("\nYou cannot do that! Display name (hit Enter for default): ");
-        input_to((: InputCapName :), I_NOESC);
-        return;
-    }
-    Admin->SetCapName(CapName = capitalize(str));
-    receive("\nPlease choose a gender (male, female, neutral, or none): ");
-    input_to((: InputGender :), I_NOESC);
-}
-
-static void InputRealName(string str);
-
-static void InputGender(string str) {
-    if( str ) str = lower_case(str);
-    if( !str || str == "" || ((str[0] != 'f' && str[0] != 'm') &&
-                member_array(str, ({"male","female","neutral","none"})) == -1)){
-        receive("\nPlease choose a gender (male, female, neutral, or none): ");
-        receive("Male, female, neutral or none? ");
-        input_to((: InputGender :));
-        return;
-    }
-    if( str[0] == 'f' ) Admin->SetGender("female");
-    else if( str[0] == 'm' ) Admin->SetGender("male");
-    else if( str == "none" ) Admin->SetGender("neuter");
-    else Admin->SetGender("neutral");
-    receive("What is your real name? ");
-    input_to((: InputRealName :), I_NOESC);
-}
-
-static void InputEmail(string str);
-
-static void InputRealName(string str) {
-    if( !str || str == "" ) str = "Unknown";
-    Admin->SetRealName(str);
-    receive("What is your email address? ");
-    input_to((: InputEmail :), I_NOESC);
-}
-
-static void InputEmail(string str) {
-    object ob, tool;
-    string tmp = "";
-    string filep = DIR_PLAYERS "/"+Name[0..0]+"/"+Name+__SAVE_EXTENSION__;
-    string filec = DIR_CRES "/"+Name[0..0]+"/"+Name+__SAVE_EXTENSION__;
-    int foo, err;
-
-    if( !str || str == "" ) str = "Unknown";
-    load_object("secure/cmds/admins/admintool")->eventChangeEmail(str,1);
-    Admin->SetEmail(str);
-    Admin->SetRace("human");
-    Admin->SetPrompt("cwd");
-    Admin->AddCurrency("silver",random(100)+57);
-    Admin->SetTown("FirstAdmin");
-    Admin->eventForce("cd");
-    Admin->eventForce("home");
-    Admin->SetWimpy(20);
-    Admin->SetTerminal("ansi");
-    Admin->SetLanguage("Common",100);
-    Admin->SetDefaultLanguage("Common");
-    if(blindmode){
-        Admin->SetProperty("wizmapping", 0);
-        Admin->SetProperty("minimapping", 0);
-        Admin->SetProperty("screen reader", 1);
-    }
-    Admin->save_player(Name);
-    make_workroom(Name,1);
-    PLAYERS_D->AddPlayerInfo(Name);
-
-    tmp = read_file(CFG_GROUPS);
-
-    if(sizeof(tmp)) cp(CFG_GROUPS, "/secure/save/backup/groups.orig");
-
-    rm(CFG_GROUPS);
-    tmp = replace_string(tmp, "ADMIN", Name);
-
-    if(sizeof(tmp)){
-        cp(CONFIG_H, "/secure/save/backup/config."+__PORT__+".bak");
-        rm(CONFIG_H);
-        tmp = replace_string(tmp, "DEBUG_NAME", Name);
-        write_file(CONFIG_H, tmp);
-    }
-
-    catch(cp(NETWORK_H,"/secure/save/backup/network."+__PORT__+".orig"));
-
-    if( ob = find_object(LIB_CONNECT) ) destruct(ob);
-    cp(DIR_SECURE_LIB "/connect.c", DIR_SECURE_LIB "/connect.first.c");
-    rm(DIR_SECURE_LIB "/connect.c");
-    cp(DIR_SECURE_LIB "/connect.real", DIR_SECURE_LIB "/connect.c");
-    destruct(Admin);
-    mkdir(DIR_CRES "/" + Name[0..0]);
-#if ENABLE_INSTANCES
-    filec = new_savename(filec);
-    filep = new_savename(filep);
-#endif
-    err = rename(filep, filec);
-    if(err){
-        receive("\nAn unfortunate error has ocurred. Mojo meditation: QQ\n");
-    }
-    receive("\nYou will be disconnected and the MUD will shut down.\n");
-    receive("Restart the MUD and login again as the admin character.\n");
-    flush_messages();
-    destruct(master());
-    tool = load_object("/secure/cmds/admins/admintool");
-    if(tool) foo = tool->eventChangeName("Dead_Souls_"+Name, 1);
-    if(foo){
-        receive("\n\nMud name changed. Use admintool to customize it.");
-        receive("\nFor more info, log in and type: help admintool\n");
-    }
-    else {
-        receive("Mud name unchanged.\n");
-    }
-    flush_messages();
-    cp(IMC2_D+".c", "/secure/save/backup/imc2.orig");
-    PLAYERS_D->AddPlayerInfo(Name);
-    shutdown();
-    destruct(this_object());
-}
-
-string GetKeyName() { return Name; }
+#include "connect.first.c"
diff --git a/secure/lib/connect.first.c b/secure/lib/connect.first.c
index ebf1886..375ecd2 100644
--- a/secure/lib/connect.first.c
+++ b/secure/lib/connect.first.c
@@ -172,9 +172,7 @@ static void InputEmail(string str) {
     catch(cp(NETWORK_H,"/secure/save/backup/network."+__PORT__+".orig"));
 
     if( ob = find_object(LIB_CONNECT) ) destruct(ob);
-    cp(DIR_SECURE_LIB "/connect.c", DIR_SECURE_LIB "/connect.first.c");
-    rm(DIR_SECURE_LIB "/connect.c");
-    cp(DIR_SECURE_LIB "/connect.real", DIR_SECURE_LIB "/connect.c");
+    write_file(DIR_SECURE_LIB "/connect.c","#include \"connect.real\"\n",1); //this way connect.* files are more easily trackable using a VCS
     destruct(Admin);
     mkdir(DIR_CRES "/" + Name[0..0]);
 #if ENABLE_INSTANCES