// Function from file: windowdoor.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { Obj_Structure_WindoorAssembly WA = null; dynamic ae = null; dynamic aforce = null; if (this.operating) { return(null); } if (A is Obj_Item_Weapon_Card_Emag) { return(null); } this.add_fingerprint(user); if (!Lang13.Bool(this.flags & 128)) { if (A is Obj_Item_Weapon_Screwdriver) { if (this.density || this.operating) { user.WriteMsg("<span class='warning'>You need to open the door to access the maintenance panel!</span>"); return(null); } GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1); this.p_open = !this.p_open; user.WriteMsg("<span class='notice'>You " + (this.p_open ? "open" : "close") + " the maintenance panel of the " + this.name + ".</span>"); return(null); } if (A is Obj_Item_Weapon_Crowbar) { if (this.p_open && !this.density && !this.operating) { GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1); ((Ent_Static)user).visible_message("" + user + " removes the electronics from the " + this.name + ".", "<span class='notice'>You start to remove electronics from the " + this.name + "...</span>"); if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this)) { if (this.p_open && !this.density && !this.operating && this.loc != null) { WA = new Obj_Structure_WindoorAssembly(this.loc); switch ((string)(this.base_state)) { case "left": WA.facing = "l"; break; case "right": WA.facing = "r"; break; case "leftsecure": WA.facing = "l"; WA.secure = true; break; case "rightsecure": WA.facing = "r"; WA.secure = true; break; } WA.anchored = 1; WA.state = "02"; WA.dir = this.dir; WA.ini_dir = this.dir; WA.update_icon(); WA.created_name = this.name; if (Lang13.Bool(this.emagged)) { user.WriteMsg("<span class='warning'>You discard the damaged electronics.</span>"); GlobalFuncs.qdel(this); return(null); } user.WriteMsg("<span class='notice'>You remove the airlock electronics.</span>"); ae = null; if (!Lang13.Bool(this.electronics)) { ae = new Obj_Item_Weapon_Electronics_Airlock(this.loc); if (Lang13.Bool(this.req_one_access)) { ae.one_access = true; ae.accesses = this.req_one_access; } else { ae.accesses = this.req_access; } } else { ae = this.electronics; this.electronics = null; ae.loc = this.loc; } GlobalFuncs.qdel(this); } } return(null); } } } if (A is Obj_Item_Weapon_Crowbar || A is Obj_Item_Weapon_Twohanded_Fireaxe || A is Obj_Item_Weapon_Melee_ArmBlade) { if (!this.hasPower()) { if (this.density) { this.open(2); } else { this.close(2); } return(null); } } if (this.density && A is Obj_Item_Weapon && !(A is Obj_Item_Weapon_Card)) { ((Mob)user).changeNext_move(8); ((Ent_Dynamic)user).do_attack_animation(this); if (Lang13.Bool(A.flags & 4) || !Lang13.Bool(A.force)) { return(null); } aforce = A.force; GlobalFuncs.playsound(this.loc, "sound/effects/Glasshit.ogg", 75, 1); this.visible_message(new Txt("<span class='danger'>").item(user).str(" has hit ").the(this).item().str(" with ").item(A).str(".</span>").ToString()); if (A.damtype == "fire" || A.damtype == "brute") { this.take_damage(aforce); } return(null); } if (!this.requiresID()) { user = null; } if (this.allowed(user)) { if (this.density) { this.open(); } else { this.close(); } } else if (this.density) { Icon13.Flick("" + this.base_state + "deny", this); } return(null); }
// Function from file: glass.dm public bool construct_window(dynamic user = null) { string title = null; ByTable directions = null; int i = 0; Obj_Structure_Window win = null; dynamic dir_to_set = null; dynamic direction = null; bool found = false; Obj_Structure_Window WT = null; Obj_Structure_Window_Reinforced W = null; Obj_Structure_Window_Reinforced_Fulltile W2 = null; Obj_Structure_WindoorAssembly WA = null; Obj_Machinery_Door_Window W3 = null; Obj_Structure_WindoorAssembly WD = null; if (!Lang13.Bool(user) || !(this != null)) { return(false); } if (!(user.loc is Tile)) { return(false); } if (!((Mob)user).IsAdvancedToolUser()) { user.WriteMsg("<span class='warning'>You don't have the dexterity to do this!</span>"); return(false); } title = "Sheet Reinf. Glass"; title += new Txt(" (").item(this.get_amount()).str(" sheet").s().str(" left)").ToString(); dynamic _g = Interface13.Input(title, "Would you like full tile glass a one direction glass pane or a windoor?", null, null, new ByTable(new object [] { "One Direction", "Full Window", "Windoor", "Cancel" }), InputType.Any); // Was a switch-case, sorry for the mess. if (_g == "One Direction") { if (!(this != null)) { return(true); } if (this.loc != user) { return(true); } directions = new ByTable(GlobalVars.cardinal); i = 0; foreach (dynamic _a in Lang13.Enumerate(user.loc, typeof(Obj_Structure_Window))) { win = _a; i++; if (i >= 4) { user.WriteMsg("<span class='danger'>There are too many windows in this location.</span>"); return(true); } directions.Remove(win.dir); if (!GlobalVars.cardinal.Contains(win.ini_dir)) { user.WriteMsg("<span class='danger'>Can't let you do that.</span>"); return(true); } } dir_to_set = 2; foreach (dynamic _c in Lang13.Enumerate(new ByTable(new object [] { user.dir, Num13.Rotate(user.dir, 90), Num13.Rotate(user.dir, 180), Num13.Rotate(user.dir, 270) }))) { direction = _c; found = false; foreach (dynamic _b in Lang13.Enumerate(user.loc, typeof(Obj_Structure_Window))) { WT = _b; if (WT.dir == direction) { found = true; } } if (!found) { dir_to_set = direction; break; } } W = null; W = new Obj_Structure_Window_Reinforced(user.loc, true); W.state = 0; W.dir = Convert.ToInt32(dir_to_set); W.ini_dir = W.dir; W.anchored = 0; W.add_fingerprint(user); this.use(1); } else if (_g == "Full Window") { if (!(this != null)) { return(true); } if (this.loc != user) { return(true); } if ((this.get_amount() ?? 0) < 2) { user.WriteMsg("<span class='warning'>You need more glass to do that!</span>"); return(true); } if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_Window), user.loc))) { user.WriteMsg("<span class='warning'>There is a window in the way!</span>"); return(true); } W2 = null; W2 = new Obj_Structure_Window_Reinforced_Fulltile(user.loc, true); W2.state = 0; W2.anchored = 0; W2.add_fingerprint(user); this.use(2); } else if (_g == "Windoor") { if (!(this != null) || this.loc != user || !(user.loc is Tile)) { return(true); } foreach (dynamic _d in Lang13.Enumerate(user.loc, typeof(Obj_Structure_WindoorAssembly))) { WA = _d; if (WA.dir == Convert.ToInt32(user.dir)) { user.WriteMsg("<span class='warning'>There is already a windoor assembly in that location!</span>"); return(true); } } foreach (dynamic _e in Lang13.Enumerate(user.loc, typeof(Obj_Machinery_Door_Window))) { W3 = _e; if (W3.dir == Convert.ToInt32(user.dir)) { user.WriteMsg("<span class='warning'>There is already a windoor in that location!</span>"); return(true); } } if ((this.get_amount() ?? 0) < 5) { user.WriteMsg("<span class='warning'>You need more glass to do that!</span>"); return(true); } WD = new Obj_Structure_WindoorAssembly(user.loc); WD.state = "01"; WD.anchored = 0; WD.add_fingerprint(user); this.use(5); dynamic _f = user.dir; // Was a switch-case, sorry for the mess. if (_f == 2) { WD.dir = ((int)(GlobalVars.SOUTH)); WD.ini_dir = GlobalVars.SOUTH; } else if (_f == 4) { WD.dir = ((int)(GlobalVars.EAST)); WD.ini_dir = GlobalVars.EAST; } else if (_f == 8) { WD.dir = ((int)(GlobalVars.WEST)); WD.ini_dir = GlobalVars.WEST; } else { WD.dir = ((int)(GlobalVars.NORTH)); WD.ini_dir = GlobalVars.NORTH; } } else { return(true); } return(false); }