81 if (open_sound !=
"" || close_sound !=
"")
117 if (type ==
"ElevatorCar")
119 else if (type ==
"Floor")
121 else if (type ==
"Shaft Level")
123 else if (type ==
"Stairwell Level")
125 else if (type ==
"DoorManager")
149 if (playsound ==
true &&
sound)
173 if (playsound ==
true &&
sound)
265 if (ctrl ==
true && shift ==
true)
294DoorWrapper*
Door::CreateDoor(
bool open_state,
const std::string &texture,
const std::string &side_texture,
Real thickness,
const std::string &face_direction,
const std::string &open_direction,
Real open_speed,
Real close_speed,
Real CenterX,
Real CenterZ,
Real width,
Real height,
Real voffset,
Real tw,
Real th,
Real side_tw,
Real side_th)
299 Real x1 = 0, z1 = 0, x2 = 0, z2 = 0;
308 if (close_speed <= 0)
309 close_speed = open_speed;
312 if (face_direction ==
"left")
314 position =
Vector3(CenterX, voffset, CenterZ - (width / 2));
320 if (face_direction ==
"right")
322 position =
Vector3(CenterX, voffset, CenterZ + (width / 2));
328 if (face_direction ==
"front")
330 position =
Vector3(CenterX + (width / 2), voffset, CenterZ);
336 if (face_direction ==
"back")
338 position =
Vector3(CenterX - (width / 2), voffset, CenterZ);
345 bool Clockwise =
true;
346 if (face_direction == open_direction)
350 AddDoorComponent(
GetName(), texture, side_texture, thickness, face_direction, open_direction, Clockwise, open_speed, close_speed, x1, z1, x2, z2, height, 0, tw, th, 0, 0);
357DoorWrapper*
Door::AddDoorComponent(
const std::string &name,
const std::string &texture,
const std::string &sidetexture,
Real thickness,
const std::string &face_direction,
const std::string &open_direction,
bool OpenClockwise,
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)
361 bool direction =
false;
362 if (face_direction ==
"right" || face_direction ==
"back")
368 if (direction ==
false)
377 sbs->
AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height, height, voffset, voffset, tw, th,
false);
384 sbs->
AddWallMain(wall, name, sidetexture, thickness, x1, z1, x2, z2, height, height, voffset, voffset, side_tw, side_th,
false);
421 ReportError(
"FinishDoors: no door components have been created");
426 Real x1 = 0, x2 = 0, y1 = 0, y2 = 0, z1 = 0, z2 = 0;
427 bool firstrun =
true;
428 for (
size_t i = 0; i <
door->
doors.size(); i++)
430 for (
int j = 1; j <= 3; j++)
438 if (extents.x < x1 || firstrun ==
true)
440 if (extents.y > x2 || firstrun ==
true)
445 if (extents.x < y1 || firstrun ==
true)
447 if (extents.y > y2 || firstrun ==
true)
452 if (extents.x < z1 || firstrun ==
true)
454 if (extents.y > z2 || firstrun ==
true)
461 if (x2 - x1 > z2 - z1)
484 if (open_state ==
true)
487 Open(pos,
false,
true);
bool ToggleLock(const Vector3 &position, bool force=false)
void SetDirection(bool direction)
bool IsLocked(const Vector3 &position)
void RemoveDoor(Door *door)
Timer(const std::string &name, Door *parent)
void Report(const std::string &message)
DoorWrapper * FinishDoor(bool open_state)
void Close(bool playsound=true)
DoorWrapper * CreateDoor(bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
bool ReportError(const std::string &message)
bool Open(Vector3 &position, bool playsound=true, bool force=false)
void AutoClose(int interval)
DoorWrapper * AddDoorComponent(const std::string &name, const std::string &texture, const std::string &sidetexture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool OpenClockwise, 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)
Door(Object *parent, DynamicMesh *wrapper, const std::string &name, const std::string &open_sound, const std::string &close_sound, bool rotate)
void ClickDoor(Vector3 &position)
void OnClick(Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
Wall * CreateWallObject(const std::string &name)
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Report(const std::string &message)
virtual void Move(const Vector3 &vector, Real speed=1.0)
virtual Vector3 GetPosition(bool relative=false)
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
void EnableLoop(bool value)
const std::string & GetType()
Real GetConfigFloat(const std::string &key, Real default_value)
DoorManager * GetDoorManager()
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)
TextureManager * GetTextureManager()
Real ToLocal(Real remote_value)
void DrawWalls(bool MainN, bool MainP, bool SideN, bool SideP, bool Top, bool Bottom)
bool Load(const std::string &filename, bool force=false)
bool Play(bool reset=true)
void SetTextureFlip(int mainneg, int mainpos, int sideneg, int sidepos, int top, int bottom)
void ResetTextureMapping(bool todefaults=false)
void Start(int milliseconds=-1, bool oneshot=false)
#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)