Update 'lib/domains/voluntaria/room/commandexit.c'

This commit is contained in:
Babylon 2020-09-06 06:24:10 -07:00
parent c25179c183
commit 18b2a98365

View File

@ -2,6 +2,8 @@
#include ROOMS_H
inherit LIB_ROOM;
int planet, planetcounter, closed, my_counter, moving, callplanet, doorcounter;
string planetname;
void create() {
room::create();
@ -21,7 +23,7 @@ void create() {
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.",
]));
set_heart_beat(1);
SetTown("USSprofit");
SetNoModify(0);
SetCoordinates("5000,5000,0");
@ -32,3 +34,99 @@ void create() {
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;
}
}
}