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 Door::Open() { if (door_state_ != CLOSED) return; SetState("door_opening"); PlaySoundIfVisible("airlock.ogg", owner.ret_id()); door_state_ = OPENING; last_tick_ = MAIN_TICK; SetFreq(1); }
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 GlassDoor::Open() { if (door_state_ != CLOSED) return; SetState(door_prefix_ + "opening"); PlaySoundIfVisible("windowdoor.ogg", owner.ret_id()); door_state_ = OPENING; last_tick_ = MAIN_TICK; SetFreq(1); }
void Lattice::AttackBy(id_ptr_on<Item> item) { if (id_ptr_on<FloorTile> tile = item) { tile->delThis(); GetTurf()->delThis(); SetTurf(GetItemFabric().newItem<ITurf>(Floor::T_ITEM_S())); PlaySoundIfVisible("Deconstruct.ogg", owner.ret_id()); delThis(); } }
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()); }
void Girder::AttackBy(id_ptr_on<Item> item) { if (id_ptr_on<Metal> metal = item) { metal->Delete(); GetTurf()->Delete(); Create<ITurf>(MetalWall::T_ITEM_S(), GetOwner()); Delete(); } else if (id_ptr_on<Wrench> wrench = item) { PlaySoundIfVisible("Ratchet.ogg", owner.ret_id()); Create<Item>(Metal::T_ITEM_S(), GetOwner()); Delete(); } }
void Door::Weld() { if ( door_state_ != CLOSED && door_state_ != WELDED) return; if (door_state_ == WELDED) { SetState("door_closed"); door_state_ = CLOSED; GetView()->RemoveOverlays(); } else { GetView()->AddOverlay("icons/Doorglass.dmi", "welded"); door_state_ = WELDED; } PlaySoundIfVisible("Welder.ogg", owner.ret_id()); }
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()); }
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); }