// Function from file: grille.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic R = null; dynamic ST = null; double? dir_to_set = null; Obj_Structure_Window WINDOW = null; Obj_Structure_Window WINDOW2 = null; Obj_Structure_Window WD = null; ((Mob)user).changeNext_move(8); this.add_fingerprint(user); if (A is Obj_Item_Weapon_Wirecutters) { if (!this.shock(user, 100)) { GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 100, 1); this.Deconstruct(); } } else if (A is Obj_Item_Weapon_Screwdriver && (this.loc is Tile_Simulated || Lang13.Bool(this.anchored))) { if (!this.shock(user, 90)) { GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1); this.anchored = !Lang13.Bool(this.anchored); ((Ent_Static)user).visible_message("<span class='notice'>" + user + " " + (Lang13.Bool(this.anchored) ? "fastens" : "unfastens") + " " + this + ".</span>", "<span class='notice'>You " + (Lang13.Bool(this.anchored) ? "fasten " + this + " to" : "unfasten " + this + " from") + " the floor.</span>"); return(null); } } else if (A is Obj_Item_Stack_Rods && this.destroyed) { R = A; if (!this.shock(user, 90)) { ((Ent_Static)user).visible_message("<span class='notice'>" + user + " rebuilds the broken grille.</span>", "<span class='notice'>You rebuild the broken grille.</span>"); this.health = 10; this.density = true; this.destroyed = false; this.icon_state = "grille"; R.use(1); return(null); } } else if (A is Obj_Item_Weapon_Rcd && this.loc is Tile_Simulated) { return(null); } else if (A is Obj_Item_Stack_Sheet_Rglass || A is Obj_Item_Stack_Sheet_Glass) { if (!this.destroyed) { ST = A; if ((((Obj_Item_Stack)ST).get_amount() ?? 0) < 2) { user.WriteMsg("<span class='warning'>You need at least two sheets of glass for that!</span>"); return(null); } dir_to_set = GlobalVars.SOUTHWEST; if (!Lang13.Bool(this.anchored)) { user.WriteMsg("<span class='warning'>" + this + " needs to be fastened to the floor first!</span>"); return(null); } foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Structure_Window))) { WINDOW = _a; user.WriteMsg("<span class='warning'>There is already a window there!</span>"); return(null); } user.WriteMsg("<span class='notice'>You start placing the window...</span>"); if (GlobalFuncs.do_after(user, 20, null, this)) { if (!(this.loc != null) || !Lang13.Bool(this.anchored)) { return(null); } foreach (dynamic _b in Lang13.Enumerate(this.loc, typeof(Obj_Structure_Window))) { WINDOW2 = _b; return(null); } WD = null; if (A is Obj_Item_Stack_Sheet_Rglass) { WD = new Obj_Structure_Window_Reinforced_Fulltile(this.loc); } else { WD = new Obj_Structure_Window_Fulltile(this.loc); } WD.dir = ((int)(dir_to_set ?? 0)); WD.ini_dir = dir_to_set; WD.anchored = 0; WD.state = 0; ST.use(2); user.WriteMsg("<span class='notice'>You place " + WD + " on " + this + ".</span>"); } return(null); } } else if (A is Obj_Item_Weapon_Shard) { GlobalFuncs.playsound(this.loc, "sound/effects/grillehit.ogg", 80, 1); this.health -= Convert.ToDouble(A.force * 0.1); } else if (!this.shock(user, 70)) { dynamic _c = A.damtype; // Was a switch-case, sorry for the mess. if (_c == "stamina") { return(null); } else if (_c == "fire") { GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 80, 1); } else { GlobalFuncs.playsound(this.loc, "sound/effects/grillehit.ogg", 80, 1); } this.health -= Convert.ToDouble(A.force * 0.3); } this.healthcheck(); base.attackby((object)(A), (object)(user), _params, silent, replace_spent); 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 W = null; Obj_Structure_Window_Fulltile W2 = 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); } if (this.zero_amount()) { return(false); } title = "Sheet-Glass"; title += new Txt(" (").item(this.get_amount()).str(" sheet").s().str(" left)").ToString(); switch ((string)(Interface13.Alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel"))) { case "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='warning'>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(user.loc, false); W.dir = Convert.ToInt32(dir_to_set); W.ini_dir = W.dir; W.anchored = 0; W.air_update_turf(true); this.use(1); W.add_fingerprint(user); break; case "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_Fulltile(user.loc, false); W2.anchored = 0; W2.air_update_turf(true); W2.add_fingerprint(user); this.use(2); break; } return(false); }
// Function from file: RCD.dm public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null) { dynamic S = null; dynamic F = null; bool door_check = false; Obj_Machinery_Door D = null; dynamic T = null; dynamic W = null; dynamic F2 = null; dynamic G = null; Obj_Structure_Grille GRILLE = null; Obj_Structure_Grille G2 = null; Obj_Structure_Window_Fulltile WD = null; if (!(proximity_flag == true)) { return(false); } if (target is Zone_Shuttle || target is Tile_Space_Transit) { return(false); } if (!(target is Tile || target is Obj_Machinery_Door_Airlock || target is Obj_Structure_Grille || target is Obj_Structure_Window)) { return(false); } switch ((int)(this.mode)) { case 1: if (target is Tile_Space) { S = target; if (this.useResource(this.floorcost, user)) { user.WriteMsg("<span class='notice'>You start building floor...</span>"); this.activate(); ((Tile)S).ChangeTurf(typeof(Tile_Simulated_Floor_Plating)); return(true); } return(false); } if (target is Tile_Simulated_Floor) { F = target; if (this.checkResource(this.wallcost, user)) { user.WriteMsg("<span class='notice'>You start building wall...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.walldelay, null, target)) { if (!this.useResource(this.wallcost, user)) { return(false); } this.activate(); ((Tile)F).ChangeTurf(typeof(Tile_Simulated_Wall)); return(true); } } return(false); } break; case 2: if (target is Tile_Simulated_Floor) { if (this.checkResource(this.airlockcost, user)) { door_check = true; foreach (dynamic _a in Lang13.Enumerate(target, typeof(Obj_Machinery_Door))) { D = _a; if (!D.sub_door) { door_check = false; break; } } if (door_check) { user.WriteMsg("<span class='notice'>You start building airlock...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.airlockdelay, null, target)) { if (!this.useResource(this.airlockcost, user)) { return(false); } this.activate(); T = Lang13.Call(this.airlock_type, target); T.electronics = new Obj_Item_Weapon_Electronics_Airlock(this.loc); if (this.conf_access != null) { T.electronics.accesses = this.conf_access.Copy(); } T.electronics.one_access = this.use_one_access; if (T.electronics.one_access) { T.req_one_access = T.electronics.accesses; } else { T.req_access = T.electronics.accesses; } if (!((Obj_Machinery_Door)T).checkForMultipleDoors()) { GlobalFuncs.qdel(T); this.useResource(-this.airlockcost, user); return(false); } T.autoclose = true; return(true); } return(false); } else { user.WriteMsg("<span class='warning'>There is another door here!</span>"); return(false); } } return(false); } break; case 3: if (target is Tile_Simulated_Wall) { W = target; if (W is Tile_Simulated_Wall_RWall && !this.canRturf) { return(false); } if (this.checkResource(this.deconwallcost, user)) { user.WriteMsg("<span class='notice'>You start deconstructing wall...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.deconwalldelay, null, target)) { if (!this.useResource(this.deconwallcost, user)) { return(false); } this.activate(); ((Tile)W).ChangeTurf(typeof(Tile_Simulated_Floor_Plating)); return(true); } } return(false); } if (target is Tile_Simulated_Floor) { F2 = target; if (F2 is Tile_Simulated_Floor_Engine && !this.canRturf) { return(false); } if (Lang13.Bool(((dynamic)F2.baseturf).IsInstanceOfType(F2))) { user.WriteMsg("<span class='notice'>You can't dig any deeper!</span>"); return(false); } else if (this.checkResource(this.deconfloorcost, user)) { user.WriteMsg("<span class='notice'>You start deconstructing floor...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.deconfloordelay, null, target)) { if (!this.useResource(this.deconfloorcost, user)) { return(false); } this.activate(); ((Tile)F2).ChangeTurf(F2.baseturf); return(true); } } return(false); } if (target is Obj_Machinery_Door_Airlock) { if (this.checkResource(this.deconairlockcost, user)) { user.WriteMsg("<span class='notice'>You start deconstructing airlock...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.deconairlockdelay, null, target)) { if (!this.useResource(this.deconairlockcost, user)) { return(false); } this.activate(); GlobalFuncs.qdel(target); return(true); } } return(false); } if (target is Obj_Structure_Window) { if (this.checkResource(this.deconwindowcost, user)) { user.WriteMsg("<span class='notice'>You start deconstructing the window...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.deconwindowdelay, null, target)) { if (!this.useResource(this.deconwindowcost, user)) { return(false); } this.activate(); GlobalFuncs.qdel(target); return(true); } } return(false); } if (target is Obj_Structure_Grille) { G = target; if (!((Obj_Structure_Grille)G).shock(user, 90)) { if (this.useResource(this.decongrillecost, user)) { user.WriteMsg("<span class='notice'>You start deconstructing the grille...</span>"); this.activate(); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); GlobalFuncs.qdel(target); return(true); } return(false); } } break; case 4: if (target is Tile_Simulated_Floor) { if (this.checkResource(this.grillecost, user)) { foreach (dynamic _b in Lang13.Enumerate(target, typeof(Obj_Structure_Grille))) { GRILLE = _b; user.WriteMsg("<span class='warning'>There is already a grille there!</span>"); return(false); } user.WriteMsg("<span class='notice'>You start building a grille...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.grilledelay, null, target)) { if (!this.useResource(this.grillecost, user)) { return(false); } this.activate(); G2 = new Obj_Structure_Grille(target); G2.anchored = 1; return(true); } return(false); } return(false); } if (target is Obj_Structure_Grille) { if (this.checkResource(this.windowcost, user)) { user.WriteMsg("<span class='notice'>You start building a window...</span>"); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, this.windowdelay, null, target)) { if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_Window), target.loc))) { return(false); } if (!this.useResource(this.windowcost, user)) { return(false); } this.activate(); WD = new Obj_Structure_Window_Fulltile(target.loc); WD.anchored = 1; return(true); } return(false); } return(false); } break; default: user.WriteMsg("ERROR: RCD in MODE: " + this.mode + " attempted use by " + user + ". Send this text #coderbus or an admin."); return(false); break; } return(false); }