52Escalator::Escalator(
Object *parent,
const std::string &name,
int run,
Real speed,
const std::string &sound_file,
const std::string &riser_texture,
const std::string &tread_texture,
const std::string &direction,
Real CenterX,
Real CenterZ,
Real width,
Real risersize,
Real treadsize,
int num_steps,
Real voffset,
Real tw,
Real th) :
Object(parent)
73 start = Vector3::ZERO;
92 Move(CenterX, voffset, CenterZ);
95 for (
int i = 0; i < num_steps; i++)
98 Steps.emplace_back(mesh);
134 for (
size_t i = 0; i <
Steps.size(); i++)
138 Steps[i]->parent_deleting =
true;
169 for (
size_t i = 0; i <
Steps.size(); i++)
182 for (
size_t i = 0; i <
Steps.size(); i++)
184 Steps[i]->vector = Vector3::ZERO;
243 int num_steps = (int)
Steps.size();
254 for (
int i = 1; i <= num_steps; i++)
260 Wall *wall =
Steps[i - 1]->CreateWallObject(base);
268 sbs->
AddWallMain(wall, base +
"-riser", riser_texture, thickness,
treadsize, -(width / 2),
treadsize, width / 2,
risersize,
risersize, 0, 0, tw, th,
true);
270 sbs->
DrawWalls(
false,
true,
false,
false,
false,
false);
271 sbs->
AddFloorMain(wall, base +
"-tread", tread_texture, 0, 0, -(width / 2),
treadsize, width / 2,
risersize,
risersize,
false,
false, tw, th,
true);
279 Steps[i - 1]->vector = Vector3::ZERO;
280 Steps[1 - 1]->speed = 0;
286 Steps[i - 1]->start =
Steps[i - 1]->GetPosition();
292 sbs->
AddWallMain(wall, base +
"-riser", riser_texture, thickness, -
treadsize, width / 2, -
treadsize, -(width / 2),
risersize,
risersize, 0, 0, tw, th,
true);
294 sbs->
DrawWalls(
false,
true,
false,
false,
false,
false);
295 sbs->
AddFloorMain(wall, base +
"-tread", tread_texture, 0, -
treadsize, -(width / 2), 0, width / 2,
risersize,
risersize,
false,
false, tw, th,
true);
303 Steps[i - 1]->vector = Vector3::ZERO;
304 Steps[1 - 1]->speed = 0;
310 Steps[i - 1]->start =
Steps[i - 1]->GetPosition();
316 sbs->
AddWallMain(wall, base +
"-riser", riser_texture, thickness, width / 2,
treadsize, -(width / 2),
treadsize,
risersize,
risersize, 0, 0, tw, th,
true);
318 sbs->
DrawWalls(
false,
true,
false,
false,
false,
false);
319 sbs->
AddFloorMain(wall, base +
"-tread", tread_texture, 0, -(width / 2), 0, width / 2,
treadsize,
risersize,
risersize,
false,
false, tw, th,
true);
327 Steps[i - 1]->vector = Vector3::ZERO;
328 Steps[1 - 1]->speed = 0;
334 Steps[i - 1]->start =
Steps[i - 1]->GetPosition();
340 sbs->
AddWallMain(wall, base +
"-riser", riser_texture, thickness, -(width / 2), -
treadsize, width / 2, -
treadsize,
risersize,
risersize, 0, 0, tw, th,
true);
342 sbs->
DrawWalls(
false,
true,
false,
false,
false,
false);
343 sbs->
AddFloorMain(wall, base +
"-tread", tread_texture, 0, -(width / 2), -
treadsize, width / 2, 0,
risersize,
risersize,
false,
false, tw, th,
true);
351 Steps[i - 1]->vector = Vector3::ZERO;
352 Steps[1 - 1]->speed = 0;
358 Steps[i - 1]->start =
Steps[i - 1]->GetPosition();
370 for (
size_t i = 0; i <
Steps.size(); i++)
422 else if (pos <= end.x + treadsize || pos >=
start.x - (
treadsize * 2))
442 else if (pos <= end.z + treadsize || pos >=
start.z - (
treadsize * 2))
474 for (
size_t i = 0; i <
Steps.size(); i++)
476 Steps[i]->vector = Vector3::ZERO;
492 for (
size_t i = 0; i <
Steps.size(); i++)
527 Report(
"Enabling malfunctions");
532 Report(
"Disabling malfunctions");
Vector3 GetPosition(bool relative=false)
Timer(const std::string &name, Escalator *parent)
Timer * malfunction_timer
void OnClick(Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
bool ReportError(const std::string &message)
void EnableMalfunctions(bool value)
void Report(const std::string &message)
Escalator(Object *parent, const std::string &name, int run, Real speed, const std::string &sound_file, const std::string &riser_texture, const std::string &tread_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real risersize, Real treadsize, int num_steps, Real voffset, Real tw, Real th)
std::vector< Step * > Steps
void CreateSteps(const std::string &riser_texture, const std::string &tread_texture, const std::string &direction, Real width, Real risersize, Real treadsize, Real tw, Real th)
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Report(const std::string &message)
void SetName(const std::string &name)
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()
void UnregisterEscalator(Escalator *escalator)
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 RegisterEscalator(Escalator *escalator)
void ResetWalls(bool ToDefaults=false)
TextureManager * GetTextureManager()
int GetConfigInt(const std::string &key, int default_value)
bool SetWallOrientation(std::string direction)
void DrawWalls(bool MainN, bool MainP, bool SideN, bool SideP, bool Top, bool Bottom)
bool AddFloorMain(Wall *wallobject, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real altitude1, Real altitude2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool autosize, bool legacy_behavior=false)
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)
void SetCase(std::string &string, bool uppercase)
std::string ToString(int number)
void TrimString(std::string &string)
#define SBS_PROFILE(name)