Skip to content

Instantly share code, notes, and snippets.

@Muirrum
Created July 2, 2019 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Muirrum/cf17f6d362a62babf195252df5bf32a7 to your computer and use it in GitHub Desktop.
Save Muirrum/cf17f6d362a62babf195252df5bf32a7 to your computer and use it in GitHub Desktop.
Hakkard Lennar Sewers Virtual Handler - Non-Working
#include <lib.h>
#include <dirs.h>
#include <terrain_types.h>
#include <medium.h>
#include <virtual.h>
inherit LIB_VIRT_LAND;
static private int Xpos, Ypos;
int max_north = 100;
int max_south = -100;
int max_east = 100;
int max_west = -100;
int max_up = 0;
int max_down = 0;
varargs void SetLongAndItems(int x, int y, int z);
varargs int LimitTravel(int requested, int maximum, int lessthan){
if (lessthan && requested < maximum) return maximum;
else if (lessthan && requested > maximum) return requested;
else if (requested > maximum) return maximum;
else return requested;
}
varargs static void create(int x, int y) {
string n, s, e, w;
SetNoReplace(1);
virt_land::create();
Xpos = x;
Ypos = y;
SetClimate("indoors");
SetLongAndItems(x, y);
SetShort("A sewer");
// If you're at the maximum distance east
if (x >= max_east) e = "sewers/" + (max_west) + "," + y;
else e = "sewers/" + (x+1) + "," + y;
// If you're at the maximum distance west
if (x <= max_west) w = "sewers/" + (max_east) + "," + y;
else w = "sewers/" + (x-1) + "," + y;
if (y >= max_north) n = "wastes/" + x + "," + (max_south);
else n = "wastes/" + x + "," + (y+1);
if (y <= max_south) s = "wastes/" + x + "," + (max_north);
else s = "wastes/" + x + "," + (y-1);
SetGoMessage("You cannot travel in that direction");
if (n) AddExit("north", __DIR__ + n);
if (s) AddExit("south", __DIR__ + s);
if (e) AddExit("east", __DIR__ + e);
if (w) AddExit("west", __DIR__ + w);
if (x == 3 && y == 2) {
RemoveExit("west");
AddExit("west", "/domains/lennarsewers/room/start");
}
if (x == 5 && y == 2) {
RemoveExit("east");
AddExit("east", "/domains/lennarsewers/room/start");
}
}
varargs void SetLongAndItems(int x, int y) {
mapping inv, items;
string str;
::SetLongAndItems(x, y);
inv = ([]);
str = "This is a small, square room. Murky water runs through a channel in the floor that takes up most of the area. There are small walkways on either side.";
SetItems( ([ ({"water", "sewage"}) : "The water is murky, with brown lumps floating in it."]));
SetLong(str);
SetAmbientLight(25);
SetInventory(inv);
SetTerrainType(T_UNDERGROUND);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment