void Door::process() { if (door_state_ == OPENING) { if (MAIN_TICK - last_tick_ > 11) { door_state_ = OPEN; SetPassable(D_ALL, Passable::FULL); last_tick_ = MAIN_TICK; SetState("door_open"); } return; } if (door_state_ == CLOSING) { if (MAIN_TICK - last_tick_ > 11) { door_state_ = CLOSED; last_tick_ = MAIN_TICK; SetState("door_closed"); SetFreq(0); } return; } if (door_state_ == OPEN) if (MAIN_TICK - last_tick_ > 50) Close(); }
void GlassDoor::process() { if (door_state_ == OPENING) { if (MAIN_TICK - last_tick_ > 9) { door_state_ = OPEN; SetPassable(GetDir(), Passable::FULL); last_tick_ = MAIN_TICK; SetState(door_prefix_ + "open"); } return; } if (door_state_ == CLOSING) { if (MAIN_TICK - last_tick_ > 9) { door_state_ = CLOSED; last_tick_ = MAIN_TICK; SetState(door_prefix_); SetFreq(0); } return; } if (door_state_ == OPEN) if (MAIN_TICK - last_tick_ > 50) Close(); }
void GlassDoor::AfterWorldCreation() { IMovable::AfterWorldCreation(); SetPassable(GetDir(), Passable::EMPTY); SetState(door_prefix_); }
Closet::Closet(size_t id) : IMovable(id) { v_level = 4; name = "Closet"; open_ = false; SetPassable(D_ALL, Passable::AIR); SetPassable(D_UP, Passable::AIR); SetPassable(D_DOWN, Passable::AIR); SetPassable(D_LEFT, Passable::AIR); SetPassable(D_RIGHT, Passable::AIR); SetSprite("icons/closet.dmi"); SetState("closed"); }
void Closet::Open() { for (auto it = content_.begin(); it != content_.end(); ++it) { owner->AddItem(*it); } content_.clear(); open_ = true; SetPassable(D_ALL, Passable::FULL); SetPassable(D_UP, Passable::FULL); SetPassable(D_DOWN, Passable::FULL); SetPassable(D_LEFT, Passable::FULL); SetPassable(D_RIGHT, Passable::FULL); SetState("open"); PlaySoundIfVisible("click.ogg", owner.ret_id()); }
Girder::Girder(size_t id) : Structure(id) { SetSprite("icons/structures.dmi"); SetState("girder"); SetPassable(D_ALL, Passable::AIR); anchored = true; name = "Girder"; }
void Door::Close() { if (door_state_ != OPEN) return; SetState("door_closing"); PlaySoundIfVisible("airlock.ogg", owner.ret_id()); SetPassable(D_ALL, Passable::EMPTY); door_state_ = CLOSING; last_tick_ = MAIN_TICK; }
void GlassDoor::Close() { if (door_state_ != OPEN) return; SetState(door_prefix_ + "closing"); PlaySoundIfVisible("windowdoor.ogg", owner.ret_id()); SetPassable(GetDir(), Passable::EMPTY); door_state_ = CLOSING; last_tick_ = MAIN_TICK; }
void Closet::Close() { owner->ForEach([this](id_ptr_on<IOnMapBase> item) { if (AddItem(item)) { owner->RemoveItem(item); } }); open_ = false; SetPassable(D_ALL, Passable::AIR); SetPassable(D_UP, Passable::AIR); SetPassable(D_DOWN, Passable::AIR); SetPassable(D_LEFT, Passable::AIR); SetPassable(D_RIGHT, Passable::AIR); SetState("closed"); PlaySoundIfVisible("click.ogg", owner.ret_id()); }
Computer::Computer(size_t id) : IOnMapObject(id) { transparent = true; SetPassable(D_ALL, Passable::AIR); SetSprite("icons/computer.dmi"); SetState("securityb"); v_level = 3; name = "Computer"; }
Space::Space(size_t id) : ITurf(id) { SetAtmosState(SPACE); SetPassable(D_ALL, Passable::FULL); transparent = true; SetFriction(0); SetSprite("icons/space.png"); SetState("10"); name = "Space"; }
Door::Door(size_t id) : IOnMapObject(id) { transparent = true; SetPassable(D_ALL, Passable::EMPTY); v_level = 10; door_state_ = CLOSED; SetSprite("icons/Doorglass.dmi"); SetState("door_closed"); name = "Door"; }
bool IMovable::CheckPassable() { PassableLevel loc = GetPassable(dMove); if (loc != Passable::FULL) { SetPassable(dMove, Passable::FULL); } if (!CanPass(owner->GetPassable(dMove), passable_level)) { owner->Bump(GetId()); force_.x = 0; force_.y = 0; force_.z = 0; if (loc != Passable::FULL) { SetPassable(dMove, loc); } return false; } if (loc != Passable::FULL) { SetPassable(dMove, loc); } auto neighbour = owner->GetNeighbour(dMove); if ( !CanPass(neighbour->GetPassable(D_ALL), passable_level) || !CanPass(neighbour->GetPassable(helpers::revert_dir(dMove)), passable_level)) { neighbour->Bump(GetId()); force_.x = 0; force_.y = 0; force_.z = 0; return false; } return true; }
Grille::Grille(size_t id) : Structure(id) { transparent = true; SetPassable(D_ALL, Passable::AIR); tickSpeed = 5; pixSpeed = 1; v_level = 8; SetSprite("icons/structures.dmi"); SetState("grille"); name = "Grille"; cutted_ = false; }
GasTank::GasTank(size_t id) : IMovable(id) { name = "Oxygen tank"; v_level = 5; SetPassable(D_ALL, Passable::AIR); SetSprite("icons/atmos.dmi"); SetState("blue"); open_ = false; atmos_holder_.AddGase(OXYGEN, 20000); atmos_holder_.AddEnergy(10000); // atmos_holder_.SetVolume(); }
void Grille::AttackBy(id_ptr_on<Item> item) { if (id_ptr_on<Wirecutters> w = item) { PlaySoundIfVisible("Wirecutter.ogg", owner.ret_id()); if (!cutted_) { SetState("brokengrille"); SetPassable(D_ALL, Passable::FULL); cutted_ = true; GetFactory().Create<IOnMapObject>(Rod::T_ITEM_S(), GetOwner()); } else { GetFactory().Create<IOnMapObject>(Rod::T_ITEM_S(), GetOwner()); delThis(); } } else Structure::AttackBy(item); }