mud/lib/domains/voluntaria/room/airlock.c
2020-09-06 05:43:07 -07:00

134 lines
4.4 KiB
C

#include <lib.h>
#include ROOMS_H
inherit LIB_ROOM;
int planet, planetcounter, closed, my_counter, moving, callplanet, doorcounter;
string planetname;
void create() {
room::create();
SetClimate("inside");
SetAmbientLight(30);
SetShort("airlock");
SetLong("an airlock in a Voluntaryist space ship. The walls are covered with advertizements and the sound of terms of service resonate through the air. The airlock is to your south, it shut when you entered the ship and the ship seems to have taken off, so be careful opening it.");
SetItems(([
({ "announcement", "terms", "terms of service" }) : "Don't look at them, listen to them.",
({ "advertizements", "ads", "ad", "advertizement" }) : "eye catching advertizements for a wide assortment of pornography, recreational drugs, and violent videogames",
]));
SetExits( ([
"south" : "/domains/voluntaria/room/space",
"north" : "/domains/voluntaria/room/hallway.c",
]) );
set_heart_beat(1);
SetListen(([
({ "announcement", "terms of service", "terms" }) : "By entering this space ship you have agreed to pay for transport to the planet of Voluntaria. There you will participate in a labor program to repay the debt which you are taking on for the transport to that paradise. If you disagree with the terms of this agreement you are welcome to attempt to escape through the airlock doors. Be careful as if they have closed we are already airborn, and you are likely to find yourself in the vacuum of space.",
]));
SetTown("USSprofit");
SetNoModify(0);
SetCoordinates("5000,5000,0");
SetDoor("south", "/domains/voluntaria/doors/airlock.c");
}
void init(){
::init();
}
int CallMe(int i){
if(i == planet && moving == 0) {
this_object()->SetDoorClosed(0);
return 1;
}
else callplanet = i;
return 1;
}
int SetDoorClosed(int i){
if(i && i == closed) return i;
if(!i && closed == 0) return i;
if(i == 0 && closed == 0) return i;
if(i) closed = i;
else if( closed == 1 ) closed = 0;
else if( closed == 0 ) closed = 1;
if(planet == 1) planetname = "/domains/voluntaria/room/space";
if(planet == 2) planetname = "/domains/voluntaria/room/start";
if(planet == 3) planetname = "/domains/oogtopia/room/field";
if(closed < 1){
tell_room(this_object(),"The airlock opens.");
tell_room(load_object(planetname),"The airlock opens.");
doorcounter = 10;
}
if(closed > 0) {
tell_room(this_object(),"The airlock closes.");
tell_room(load_object(planetname),"The airlock closes.");
doorcounter = 0;
}
return closed;
}
int SetPlanet(int i){
if(planet == i) return 0;
RemoveExit("south");
planet = i;
if(i == 1) AddExit("south", "/domains/voluntaria/room/space");
if(i == 2) AddExit("south", "/domains/voluntaria/room/start");
if(i == 3) AddExit("south", "/domains/oogtopia/room/field");
return 1;
}
int CanReceive(object ob) {
#if 1
if(living(ob) && closed > 0 && query_verb() != "goto" &&
query_verb() != "trans" ){
message("info","The airlock is closed.", ob);
return 0;
}
#endif
return 1;
}
int CanRelease(object ob){
if(archp(ob)) {
tell_object(ob,"%^RED%^As archwizard, you are permitted to "
"exit the elevator at any time. Normal creators and "
"players cannot do this.%^RESET%^\n");
}
if(closed > 0 && query_verb() == "go" ){
message("info","The airlock is closed.", ob);
return 0;
}
return 1;
}
varargs int eventRoll(int i){
if(!i) i = 10;
moving = 1;
SetDoorClosed(1);
my_counter = i;
return i;
}
void heart_beat(){
if(doorcounter > 0){
doorcounter--;
if(doorcounter < 2) SetDoorClosed(1);
}
if(moving == 0 && closed == 1 && callplanet > 0){
tell_room(this_object(),"The elevator lurches into motion.");
eventRoll();
}
if(moving && moving > 0){
my_counter--;
if(my_counter % 5 == 0) {
tell_room(this_object(),"The elevator continues...");
}
if(my_counter < 2) {
my_counter = 0;
moving = 0;
SetPlanet(callplanet);
tell_room(this_object(),"The elevator arrives at its destination.");
SetDoorClosed(0);
callplanet = 0;
}
}
}