67 std::string name =
"Elevator Door " +
ToString(number);
122 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
135 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
224 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
245 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
368 else if (manual ==
false)
373 else if (manual ==
false)
484 else if (manual ==
false)
489 else if (manual ==
false)
578 bool elevdoors =
false, shaftdoors =
false, playsounds =
false;
631 if (elevdoors ==
true)
634 if (shaftdoors ==
true &&
index >= 0)
670 if (playsounds ==
true)
688 if (elevdoors ==
true)
691 if (shaftdoors ==
true &&
index >= 0)
701 if (elevdoors ==
true)
707 if (shaftdoors ==
true &&
index >= 0)
743 if (manual ==
false && open ==
true)
790 if (direction ==
false)
796 z1 = CenterZ - (width / 2);
797 z2 = CenterZ - spacing;
798 z3 = CenterZ + spacing;
799 z4 = CenterZ + (width / 2);
803 x1 = CenterX - (width / 2);
804 x2 = CenterX - spacing;
805 x3 = CenterX + spacing;
806 x4 = CenterX + (width / 2);
814 AddDoorComponent(
"Left", lefttexture, lefttexture, thickness,
"Left",
OpenSpeed,
OpenSpeed * 0.75, x1, z1, x2, z2, height, 0, tw, th, tw, th);
817 AddDoorComponent(
"Right", righttexture, righttexture, thickness,
"Right",
OpenSpeed,
OpenSpeed * 0.75, x3, z3, x4, z4, height, 0, tw, th, tw, th);
823DoorComponent*
ElevatorDoor::AddDoorComponent(
DoorWrapper *wrapper,
const std::string &name,
const std::string &meshname,
const std::string &texture,
const std::string &sidetexture,
Real thickness,
const std::string &direction,
Real OpenSpeed,
Real CloseSpeed,
Real x1,
Real z1,
Real x2,
Real z2,
Real height,
Real voffset,
Real tw,
Real th,
Real side_tw,
Real side_th)
849 sbs->
AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height, height, voffset, voffset, tw, th,
false);
855 sbs->
AddWallMain(wall, name, sidetexture, thickness, x1, z1, x2, z2, height, height, voffset, voffset, side_tw, side_th,
false);
887DoorWrapper*
ElevatorDoor::AddDoorComponent(
const std::string &name,
const std::string &texture,
const std::string &sidetexture,
Real thickness,
const std::string &direction,
Real OpenSpeed,
Real CloseSpeed,
Real x1,
Real z1,
Real x2,
Real z2,
Real height,
Real voffset,
Real tw,
Real th,
Real side_tw,
Real side_th)
891 std::string
Name, buffer;
896 AddDoorComponent(
Doors, name, buffer, texture, sidetexture, thickness, direction,
OpenSpeed, CloseSpeed, x1, z1, x2, z2, height, voffset, tw, th, side_tw, side_th);
900DoorWrapper*
ElevatorDoor::AddShaftDoorComponent(
int floor,
const std::string &name,
const std::string &texture,
const std::string &sidetexture,
Real thickness,
const std::string &direction,
Real OpenSpeed,
Real CloseSpeed,
Real x1,
Real z1,
Real x2,
Real z2,
Real height,
Real voffset,
Real tw,
Real th,
Real side_tw,
Real side_th)
920 std::string
Name, buffer;
925 AddDoorComponent(
ShaftDoors[
index], name, buffer, texture, sidetexture, thickness, direction,
OpenSpeed, CloseSpeed, x1, z1, x2, z2, height, voffset, tw, th, side_tw, side_th);
929void ElevatorDoor::AddShaftDoorsComponent(
const std::string &name,
const std::string &texture,
const std::string &sidetexture,
Real thickness,
const std::string &direction,
Real OpenSpeed,
Real CloseSpeed,
Real x1,
Real z1,
Real x2,
Real z2,
Real height,
Real voffset,
Real tw,
Real th,
Real side_tw,
Real side_th)
937 AddShaftDoorComponent(floor, name, texture, sidetexture, thickness, direction,
OpenSpeed, CloseSpeed, x1, z1, x2, z2, height, voffset, tw, th, side_tw, side_th);
950 if (ShaftDoor ==
true)
956 if (wrapper->
doors.empty() ==
true)
958 car->
ReportError(
"FinishDoors: no door components have been created");
963 Real x1 = 0, x2 = 0, y1 = 0, y2 = 0, z1 = 0, z2 = 0;
964 bool firstrun =
true;
965 for (
size_t i = 0; i < wrapper->
doors.size(); i++)
967 for (
int j = 1; j <= 3; j++)
969 Vector2 extents = wrapper->
doors[i]->mesh->GetExtents(j,
true);
975 if (extents.x < x1 || firstrun ==
true)
977 if (extents.y > x2 || firstrun ==
true)
982 if (extents.x < y1 || firstrun ==
true)
984 if (extents.y > y2 || firstrun ==
true)
989 if (extents.x < z1 || firstrun ==
true)
991 if (extents.y > z2 || firstrun ==
true)
998 if (x2 - x1 > z2 - z1)
1000 if (ShaftDoor ==
false)
1002 wrapper->
Width = x2 - x1;
1008 if (ShaftDoor ==
false)
1010 wrapper->
Width = z2 - z1;
1014 wrapper->
Height = y2 - y1;
1022 if (ShaftDoor ==
true)
1029 base += floorobj->
GetBase(
true);
1053 if (DoorWalls ==
true)
1062 if (TrackWalls ==
true)
1065 std::string name1, name2;
1067 if (ShaftDoor ==
false)
1071 sbs->
CreateWallBox(
car->
Mesh, name1,
"Connection", x1, x2, z1, z2, 1, -1.001f + base, 0, 0,
false,
true,
true,
true,
false);
1072 sbs->
CreateWallBox(
car->
Mesh, name2,
"Connection", x1, x2, z1, z2, 1, wrapper->
Height + 0.001f + base, 0, 0,
false,
true,
true,
true,
false);
1084 sbs->
CreateWallBox(mesh, name1,
"Connection", position.x + x1, position.x + x2, position.z + z1, position.z + z2, 1, -1.001f + base, 0, 0,
false,
true,
true,
true,
false);
1085 sbs->
CreateWallBox(mesh, name2,
"Connection", position.x + x1, position.x + x2, position.z + z1, position.z + z2, 1, wrapper->
Height + 0.001f + base, 0, 0,
false,
true,
true,
true,
false);
1092 center.x = wrapper->
GetPosition().x + x1 + ((x2 - x1) / 2);
1094 center.z = wrapper->
GetPosition().z + z1 + ((z2 - z1) / 2);
1097 if (ShaftDoor ==
false)
1112 Vector3 min (x1 - sensor_width, wrapper->
voffset, z1 - sensor_width);
1131 std::string floornum =
ToString(floor);
1152 return FinishDoors(wrapper, floor,
true, DoorWalls, TrackWalls);
1201 Real x1, x2, x3, x4;
1202 Real z1, z2, z3, z4;
1235 AddShaftDoorComponent(floor,
"Left", lefttexture, lefttexture, thickness,
"Left",
OpenSpeed,
OpenSpeed * 0.75, x1, z1, x2, z2,
Doors->
Height, voffset, tw, th, tw, th);
1238 AddShaftDoorComponent(floor,
"Right", righttexture, righttexture, thickness,
"Right",
OpenSpeed,
OpenSpeed * 0.75, x3, z3, x4, z4,
Doors->
Height, voffset, tw, th, tw, th);
1287 SBS_PROFILE(
"ElevatorDoor::ShaftDoorsEnabledRange");
1298 if (
IsEven(range) ==
true)
1301 int additionalfloors;
1303 additionalfloors = (range - 1) / 2;
1305 additionalfloors = 0;
1312 for (
int i = floor - additionalfloors; i <= floor + additionalfloors; i++)
1345 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
1351 if (skip_current_floor ==
true)
1358 if (door->
Open ==
true)
1531 if (relative_x ==
false)
1534 pos.x += position.x;
1535 if (relative_y ==
false)
1538 pos.y += position.y;
1539 if (relative_z ==
false)
1542 pos.z += position.z;
1562 else if (include_nonserviced ==
true)
1565 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
1684 std::string full_name1 =
car->
GetName() +
":" + action_name1;
1685 std::string full_name2 =
car->
GetName() +
":" + action_name2;
1687 std::vector<Object*> parents;
1688 parents.emplace_back(
car);
1692 std::vector<std::string> actions;
1693 actions.emplace_back(full_name2);
1694 actions.emplace_back(full_name1);
1708 bool result =
false;
1748 if (persistent ==
true)
1779 if (persistent ==
false)
1849 std::string doornumber;
1873 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
1884 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
1907 for (
size_t i = 0; i <
ShaftDoors.size(); i++)
bool ReportError(const std::string &message)
void SetDirectionalIndicators(int floor, bool UpLight, bool DownLight)
bool PlayMessageSound(bool type)
bool IndependentServiceOnOtherCar()
std::vector< int > ServicedFloors
void NotifyArrival(int floor, bool early=false, int direction=0)
bool IsServicedFloor(int floor, bool report=true)
int GetFloorIndex(int floor)
void FlashIndicators(bool value)
void Report(const std::string &message)
void RemoveElevatorDoor(ElevatorDoor *door)
Timer(const std::string &name, ElevatorDoor *parent, ElevatorCar *car, int Type)
DoorComponent * AddDoorComponent(DoorWrapper *wrapper, const std::string &name, const std::string &meshname, const std::string &texture, const std::string &sidetexture, Real thickness, const std::string &direction, Real OpenSpeed, Real CloseSpeed, Real x1, Real z1, Real x2, Real z2, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
void ShaftDoorsEnabledRange(int floor, int range)
void CloseDoorsEmergency(int whichdoors=1, int floor=0)
void EnableSensor(bool value, bool persistent=true)
void MoveSound(const Vector3 &position, bool relative_x, bool relative_y, bool relative_z)
DoorWrapper * AddShaftDoor(int floor, const std::string &lefttexture, const std::string &righttexture, Real tw, Real th)
bool FinishShaftDoors(bool DoorWalls=true, bool TrackWalls=true)
DoorWrapper * AddShaftDoorComponent(int floor, const std::string &name, const std::string &texture, const std::string &sidetexture, Real thickness, const std::string &direction, Real OpenSpeed, Real CloseSpeed, Real x1, Real z1, Real x2, Real z2, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
std::vector< DoorWrapper * > ShaftDoors
std::string DownChimeSound
std::string EarlyUpChimeSound
bool GetSensorStatus(bool persistent=true)
void ShaftDoorsEnabled(int floor, bool value)
bool AddShaftDoors(const std::string &lefttexture, const std::string &righttexture, Real thickness, Real CenterX, Real CenterZ, Real voffset, Real tw, Real th)
bool AreDoorsMoving(int doors=0, bool car_doors=true, bool shaft_doors=true)
Real GetShaftDoorAltitude(int floor)
void CloseDoors(int whichdoors=1, int floor=0, bool manual=false)
std::vector< int > ManualFloors
ElevatorDoor(int number, ElevatorCar *car)
int GetManualIndex(int floor)
void Hold(bool sensor=false)
DoorWrapper * GetDoorWrapper()
bool AreShaftDoorsClosed(bool skip_current_floor=false)
void SetShaftDoors(Real thickness, Real CenterX, Real CenterZ)
void ResetNudgeTimer(bool start=true)
DoorWrapper * FinishDoors(DoorWrapper *wrapper, int floor, bool ShaftDoor, bool DoorWalls=true, bool TrackWalls=true)
void OpenDoorsEmergency(int whichdoors=1, int floor=0)
std::string EarlyDownChimeSound
std::string GetNumberText()
void Reset(bool sensor=false)
void RemoveShaftDoor(DoorWrapper *door)
void RemoveServicedFloor(int floor)
void AddShaftDoorsComponent(const std::string &name, const std::string &texture, const std::string &sidetexture, Real thickness, const std::string &direction, Real OpenSpeed, Real CloseSpeed, Real x1, Real z1, Real x2, Real z2, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
DoorWrapper * FinishShaftDoor(int floor, bool DoorWalls=true, bool TrackWalls=true)
void EnableNudgeMode(bool value)
void OpenDoors(int whichdoors=1, int floor=0, bool manual=false)
bool ShaftDoorsExist(int floor, bool include_nonserviced=false)
void Chime(int floor, bool direction)
void EarlyChime(int floor, bool direction)
int earlychimesound_loaded
DoorWrapper * GetShaftDoorWrapper(int floor)
void CreateSensor(Vector3 &area_min, Vector3 &area_max)
void MoveDoors(bool open, bool manual)
void AddServicedFloor(int floor)
bool AreShaftDoorsOpen(int floor)
DoorWrapper * AddDoors(const std::string &lefttexture, const std::string &righttexture, Real thickness, Real CenterX, Real CenterZ, Real width, Real height, bool direction, Real tw, Real th)
int GetFloorForCar(int car, int number)
DynamicMesh * GetDoorContainer()
void Cut(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool fast, int checkwallnumber=0, bool prepare=false)
Real GetBase(bool relative=false)
void EnableGroup(bool value)
Wall * CreateWallObject(const std::string &name)
const std::string & GetName()
void SetName(const std::string &name)
virtual void SetPositionY(Real value)
virtual Vector3 GetPosition(bool relative=false)
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
virtual void SetPosition(const Vector3 &position)
Action * AddAction(const std::string &name, std::vector< Object * > &action_parents, const std::string &command, const std::vector< std::string > ¶meters)
void EnableBuildings(bool value)
std::string GetConfigString(const std::string &key, const std::string &default_value)
Real GetConfigFloat(const std::string &key, Real default_value)
bool AddWallMain(Wall *wallobject, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height_in1, Real height_in2, Real altitude1, Real altitude2, Real tw, Real th, bool autosize)
void ResetWalls(bool ToDefaults=false)
Floor * GetFloor(int number)
TextureManager * GetTextureManager()
void EnableLandscape(bool value)
void EnableSkybox(bool value)
Real ToLocal(Real remote_value)
bool GetConfigBool(const std::string &key, bool default_value)
int GetConfigInt(const std::string &key, int default_value)
void EnableExternal(bool value)
bool RemoveAction(std::string name)
void DrawWalls(bool MainN, bool MainP, bool SideN, bool SideP, bool Top, bool Bottom)
Wall * CreateWallBox(MeshObject *mesh, const std::string &name, const std::string &texture, Real x1, Real x2, Real z1, Real z2, Real height_in, Real voffset, Real tw, Real th, bool inside=true, bool outside=true, bool top=true, bool bottom=true, bool autosize=true)
bool Cut(bool relative, const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, int checkwallnumber=0)
MeshObject * GetMeshObject()
DynamicMesh * GetShaftDoorContainer()
bool IsShowFloor(int floor)
Level * GetLevel(int floor)
bool Load(const std::string &filename, bool force=false)
bool Play(bool reset=true)
void SetLoopState(bool value)
void ResetTextureMapping(bool todefaults=false)
void Start(int milliseconds=-1, bool oneshot=false)
Wall * AddDoorwayWalls(MeshObject *mesh, const std::string &wallname, const std::string &texture, Real tw, Real th)
std::string ToString(int number)
void TrimString(std::string &string)
#define SBS_PROFILE(name)
void MoveDoors(bool open, bool manual=false)
std::vector< DoorComponent * > doors
DoorComponent * CreateDoor(const std::string &doorname, const std::string &Direction, bool OpenClockwise, Real OpenSpeed, Real CloseSpeed, DynamicMesh *dynmesh)