// Function from file: glass.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic CC = null; Obj_Item_Stack_LightW new_tile = null; dynamic V = null; Obj_Item_Stack_Sheet_Rglass RG = null; Obj_Item_Stack_Sheet_Glass G = null; bool replace = false; base.attackby((object)(A), (object)(user), _params, silent, replace_spent); this.add_fingerprint(user); if (A is Obj_Item_Stack_CableCoil) { CC = A; if ((this.get_amount() ?? 0) < 1 || (((Obj_Item_Stack)CC).get_amount() ?? 0) < 5) { user.WriteMsg("<span class='warning>You need five lengths of coil and one sheet of glass to make wired glass!</span>"); return(null); } CC.use(5); this.use(1); user.WriteMsg("<span class='notice'>You attach wire to the " + this.name + ".</span>"); new_tile = new Obj_Item_Stack_LightW(user.loc); new_tile.add_fingerprint(user); } else if (A is Obj_Item_Stack_Rods) { V = A; if ((((Obj_Item_Stack)V).get_amount() ?? 0) >= 1 && (this.get_amount() ?? 0) >= 1) { RG = new Obj_Item_Stack_Sheet_Rglass(user.loc); RG.add_fingerprint(user); G = this; Task13.Source = null; replace = ((Mob)user).get_inactive_hand() == G; V.use(1); G.use(1); if (!(G != null) && replace) { ((Mob)user).put_in_hands(RG); } } else { user.WriteMsg("<span class='warning'>You need one rod and one sheet of glass to make reinforced glass!</span>"); return(null); } } else { return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent)); } return(null); }
// Function from file: light.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { Obj_Item_Stack_CableCoil CC = null; Obj_Item_Stack_Sheet_Glass G = null; dynamic M = null; Obj_Item_Stack_Tile_Light L = null; base.attackby((object)(A), (object)(user), _params, silent, replace_spent); if (A is Obj_Item_Weapon_Wirecutters) { CC = new Obj_Item_Stack_CableCoil(user.loc); CC.amount = 5; CC.add_fingerprint(user); this.amount--; G = new Obj_Item_Stack_Sheet_Glass(user.loc); G.add_fingerprint(user); if ((this.amount ?? 0) <= 0) { ((Mob)user).unEquip(this, 1); GlobalFuncs.qdel(this); } } if (A is Obj_Item_Stack_Sheet_Metal) { M = A; if (Lang13.Bool(M.use(1))) { this.use(1); L = new Obj_Item_Stack_Tile_Light(user.loc); user.WriteMsg("<span class='notice'>You make a light tile.</span>"); L.add_fingerprint(user); } else { user.WriteMsg("<span class='warning'>You need one metal sheet to finish the light tile!</span>"); return(null); } } return(null); }
// Function from file: glass.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic WT = null; Obj_Item_Stack_Sheet_Glass NG = null; Obj_Item_Stack_Sheet_Glass G = null; if (A is Obj_Item_Weapon_Weldingtool) { WT = A; if (((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user)) { NG = new Obj_Item_Stack_Sheet_Glass(user.loc); foreach (dynamic _a in Lang13.Enumerate(user.loc, typeof(Obj_Item_Stack_Sheet_Glass))) { G = _a; if (G == NG) { continue; } if ((G.amount ?? 0) >= (G.max_amount ?? 0)) { continue; } G.attackby(NG, user); } user.WriteMsg(new Txt("<span class='notice'>You add the newly-formed glass to the stack. It now contains ").item(NG.amount).str(" sheet").s().str(".</span>").ToString()); GlobalFuncs.qdel(this); } } base.attackby((object)(A), (object)(user), _params, silent, replace_spent); return(null); }
// Function from file: buildandrepair.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic WT = null; Obj_Item_Stack_Sheet_Metal M = null; dynamic B = null; dynamic C = null; Obj_Item_Stack_CableCoil A2 = null; dynamic G = null; Obj_Item_Stack_Sheet_Glass G2 = null; dynamic B2 = null; this.add_fingerprint(user); switch ((int)(this.state)) { case 0: if (A is Obj_Item_Weapon_Wrench) { GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1); user.WriteMsg("<span class='notice'>You start wrenching the frame into place...</span>"); if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this)) { user.WriteMsg("<span class='notice'>You wrench the frame into place.</span>"); this.anchored = 1; this.state = 1; } } if (A is Obj_Item_Weapon_Weldingtool) { WT = A; if (!((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user)) { if (!((Obj_Item_Weapon_Weldingtool)WT).isOn()) { user.WriteMsg("<span class='warning'>The welding tool must be on to complete this task!</span>"); } return(null); } GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 50, 1); user.WriteMsg("<span class='notice'>You start deconstructing the frame...</span>"); if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this)) { if (!(this != null) || !((Obj_Item_Weapon_Weldingtool)WT).isOn()) { return(null); } user.WriteMsg("<span class='notice'>You deconstruct the frame.</span>"); M = new Obj_Item_Stack_Sheet_Metal(this.loc, 5); M.add_fingerprint(user); GlobalFuncs.qdel(this); } } break; case 1: if (A is Obj_Item_Weapon_Wrench) { GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1); user.WriteMsg("<span class='notice'>You start to unfasten the frame...</span>"); if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this)) { user.WriteMsg("<span class='notice'>You unfasten the frame.</span>"); this.anchored = 0; this.state = 0; } } if (A is Obj_Item_Weapon_Circuitboard && !Lang13.Bool(this.circuit)) { B = A; if (B.board_type == "computer") { if (!Lang13.Bool(user.drop_item())) { return(null); } GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1); user.WriteMsg("<span class='notice'>You place the circuit board inside the frame.</span>"); this.icon_state = "1"; this.circuit = A; ((Ent_Static)this.circuit).add_fingerprint(user); A.loc = null; } else { user.WriteMsg("<span class='warning'>This frame does not accept circuit boards of this type!</span>"); } } if (A is Obj_Item_Weapon_Screwdriver && Lang13.Bool(this.circuit)) { GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1); user.WriteMsg("<span class='notice'>You screw the circuit board into place.</span>"); this.state = 2; this.icon_state = "2"; } if (A is Obj_Item_Weapon_Crowbar && Lang13.Bool(this.circuit)) { GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1); user.WriteMsg("<span class='notice'>You remove the circuit board.</span>"); this.state = 1; this.icon_state = "0"; this.circuit.loc = this.loc; ((Ent_Static)this.circuit).add_fingerprint(user); this.circuit = null; } break; case 2: if (A is Obj_Item_Weapon_Screwdriver && Lang13.Bool(this.circuit)) { GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1); user.WriteMsg("<span class='notice'>You unfasten the circuit board.</span>"); this.state = 1; this.icon_state = "1"; } if (A is Obj_Item_Stack_CableCoil) { C = A; if ((((Obj_Item_Stack)C).get_amount() ?? 0) >= 5) { GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1); user.WriteMsg("<span class='notice'>You start adding cables to the frame...</span>"); if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this)) { if ((((Obj_Item_Stack)C).get_amount() ?? 0) >= 5 && this.state == 2) { C.use(5); user.WriteMsg("<span class='notice'>You add cables to the frame.</span>"); this.state = 3; this.icon_state = "3"; } } } else { user.WriteMsg("<span class='warning'>You need five lengths of cable to wire the frame!</span>"); } } break; case 3: if (A is Obj_Item_Weapon_Wirecutters) { GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 50, 1); user.WriteMsg("<span class='notice'>You remove the cables.</span>"); this.state = 2; this.icon_state = "2"; A2 = new Obj_Item_Stack_CableCoil(this.loc); A2.amount = 5; A2.add_fingerprint(user); } if (A is Obj_Item_Stack_Sheet_Glass) { G = A; if ((((Obj_Item_Stack)G).get_amount() ?? 0) < 2) { user.WriteMsg("<span class='warning'>You need two glass sheets to continue construction!</span>"); return(null); } else { GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1); user.WriteMsg("<span class='notice'>You start to put in the glass panel...</span>"); if (GlobalFuncs.do_after(user, 20, null, this)) { if ((((Obj_Item_Stack)G).get_amount() ?? 0) >= 2 && this.state == 3) { G.use(2); user.WriteMsg("<span class='notice'>You put in the glass panel.</span>"); this.state = 4; this.icon_state = "4"; } } } } break; case 4: if (A is Obj_Item_Weapon_Crowbar) { GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1); user.WriteMsg("<span class='notice'>You remove the glass panel.</span>"); this.state = 3; this.icon_state = "3"; G2 = new Obj_Item_Stack_Sheet_Glass(this.loc, 2); G2.add_fingerprint(user); } if (A is Obj_Item_Weapon_Screwdriver) { GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1); user.WriteMsg("<span class='notice'>You connect the monitor.</span>"); B2 = Lang13.Call(this.circuit.build_path, this.loc, this.circuit); this.transfer_fingerprints_to(B2); GlobalFuncs.qdel(this); } break; } return(null); }
// Function from file: circuitprinter.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { Obj_Item_Weapon_ReagentContainers_Glass G = null; Obj_Item_Stack_Sheet_Glass G2 = null; Obj_Item_Stack_Sheet_Mineral_Gold G3 = null; Obj_Item_Stack_Sheet_Mineral_Diamond G4 = null; dynamic stack = null; int amount = 0; if (this.shocked) { this.shock(user, 50); } if (this.default_deconstruction_screwdriver(user, "circuit_imprinter_t", "circuit_imprinter", A)) { if (Lang13.Bool(this.linked_console)) { this.linked_console.linked_imprinter = null; this.linked_console = null; } return(null); } if (this.exchange_parts(user, A)) { return(null); } if (Lang13.Bool(this.panel_open)) { if (A is Obj_Item_Weapon_Crowbar) { foreach (dynamic _a in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_ReagentContainers_Glass))) { G = _a; this.reagents.trans_to(G, G.reagents.maximum_volume); } if (this.g_amount >= 2000) { G2 = new Obj_Item_Stack_Sheet_Glass(this.loc); G2.amount = Num13.Floor(this.g_amount / 2000); } if (this.gold_amount >= 2000) { G3 = new Obj_Item_Stack_Sheet_Mineral_Gold(this.loc); G3.amount = Num13.Floor(this.gold_amount / 2000); } if (this.diamond_amount >= 2000) { G4 = new Obj_Item_Stack_Sheet_Mineral_Diamond(this.loc); G4.amount = Num13.Floor(this.diamond_amount / 2000); } this.default_deconstruction_crowbar(A); return(null); } else { user.WriteMsg("<span class='warning'>You can't load the " + this.name + " while it's opened!</span>"); return(null); } } if (this.disabled) { return(null); } if (!Lang13.Bool(this.linked_console)) { user.WriteMsg("<span class='warning'>The " + this.name + " must be linked to an R&D console first!</span>"); return(1); } if (Lang13.Bool(((Ent_Static)A).is_open_container())) { return(null); } if (!(A is Obj_Item_Stack_Sheet_Glass) && !(A is Obj_Item_Stack_Sheet_Mineral_Gold) && !(A is Obj_Item_Stack_Sheet_Mineral_Diamond)) { user.WriteMsg("<span class='warning'>You cannot insert this item into the " + this.name + "!</span>"); return(null); } if (this.stat != 0) { return(null); } if (this.busy) { user.WriteMsg("<span class='warning'>The " + this.name + " is busy! Please wait for completion of previous operation.</span>"); return(null); } stack = A; if (this.TotalMaterials() + stack.perunit > this.max_material_amount) { user.WriteMsg("<span class='warning'>The " + this.name + " is full! Please remove glass from the protolathe in order to insert more.</span>"); return(null); } amount = Num13.Floor(Convert.ToDouble(Interface13.Input("How many sheets do you want to add?", null, null, null, null, InputType.Num))); if (amount <= 0 || Convert.ToDouble(stack.amount) <= 0) { return(null); } if (amount > Convert.ToDouble(stack.amount)) { amount = Num13.MinInt(Convert.ToInt32(stack.amount), Num13.Floor((this.max_material_amount - this.TotalMaterials()) / stack.perunit)); } this.busy = true; this.f_use_power(Num13.MaxInt(1000, ((int)(amount * 2000 / 10)))); user.WriteMsg("<span class='notice'>You add " + amount + " sheets to the " + this.name + ".</span>"); if (stack is Obj_Item_Stack_Sheet_Glass) { this.g_amount += amount * 2000; } else if (stack is Obj_Item_Stack_Sheet_Mineral_Gold) { this.gold_amount += amount * 2000; } else if (stack is Obj_Item_Stack_Sheet_Mineral_Diamond) { this.diamond_amount += amount * 2000; } stack.use(amount); this.busy = false; this.updateUsrDialog(); return(null); }
// Function from file: window.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic WT = null; Obj_Item_Stack_Sheet_Rglass RG = null; Obj_Item_Stack_Sheet_Glass G = null; if (!this.can_be_reached(user)) { return(1); } this.add_fingerprint(user); if (A is Obj_Item_Weapon_Weldingtool && user.a_intent == "help") { WT = A; if (this.health < this.maxhealth) { if (((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user)) { user.WriteMsg("<span class='notice'>You begin repairing " + this + "...</span>"); GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 40, 1); if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this)) { this.health = this.maxhealth; GlobalFuncs.playsound(this.loc, "sound/items/welder2.ogg", 50, 1); this.update_nearby_icons(); user.WriteMsg("<span class='notice'>You repair " + this + ".</span>"); } } } else { user.WriteMsg("<span class='warning'>" + this + " is already in good condition!</span>"); } return(null); } if (!Lang13.Bool(this.flags & 128)) { if (A is Obj_Item_Weapon_Screwdriver) { GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 75, 1); if (this.reinf == true && (this.state == 2 || this.state == 1)) { user.WriteMsg((this.state == 2 ? "<span class='notice'>You begin to unscrew the window from the frame...</span>" : "<span class='notice'>You begin to screw the window to the frame...</span>")); } else if (this.reinf == true && this.state == 0) { user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You begin to unscrew the frame from the floor...</span>" : "<span class='notice'>You begin to screw the frame to the floor...</span>")); } else if (!(this.reinf == true)) { user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You begin to unscrew the window from the floor...</span>" : "<span class='notice'>You begin to screw the window to the floor...</span>")); } if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this)) { if (this.reinf == true && (this.state == 1 || this.state == 2)) { this.state = (this.state == 1 ? 2 : 1); user.WriteMsg((this.state == 1 ? "<span class='notice'>You unfasten the window from the frame.</span>" : "<span class='notice'>You fasten the window to the frame.</span>")); } else if (this.reinf == true && this.state == 0) { this.anchored = !Lang13.Bool(this.anchored); this.update_nearby_icons(); user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You fasten the frame to the floor.</span>" : "<span class='notice'>You unfasten the frame from the floor.</span>")); } else if (!(this.reinf == true)) { this.anchored = !Lang13.Bool(this.anchored); this.update_nearby_icons(); user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You fasten the window to the floor.</span>" : "<span class='notice'>You unfasten the window.</span>")); } } return(null); } else if (A is Obj_Item_Weapon_Crowbar && this.reinf == true && (this.state == 0 || this.state == 1)) { user.WriteMsg((this.state == 0 ? "<span class='notice'>You begin to lever the window into the frame...</span>" : "<span class='notice'>You begin to lever the window out of the frame...</span>")); GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 75, 1); if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this)) { this.state = (this.state == 0 ? true : false); user.WriteMsg((this.state == 1 ? "<span class='notice'>You pry the window into the frame.</span>" : "<span class='notice'>You pry the window out of the frame.</span>")); } return(null); } else if (A is Obj_Item_Weapon_Wrench && !Lang13.Bool(this.anchored)) { GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 75, 1); user.WriteMsg("<span class='notice'> You begin to disassemble " + this + "...</span>"); if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this)) { if (this.disassembled) { return(null); } if (this.reinf == true) { RG = new Obj_Item_Stack_Sheet_Rglass(user.loc); RG.add_fingerprint(user); if (this.fulltile) { RG = new Obj_Item_Stack_Sheet_Rglass(user.loc); RG.add_fingerprint(user); } } else { G = new Obj_Item_Stack_Sheet_Glass(user.loc); G.add_fingerprint(user); if (this.fulltile) { G = new Obj_Item_Stack_Sheet_Glass(user.loc); G.add_fingerprint(user); } } GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1); this.disassembled = true; user.WriteMsg("<span class='notice'>You successfully disassemble " + this + ".</span>"); GlobalFuncs.qdel(this); } return(null); } } if (A is Obj_Item_Weapon_Rcd) { return(null); } if (A.damtype == "brute" || A.damtype == "fire") { ((Mob)user).changeNext_move(8); this.hit(A.force); } else { GlobalFuncs.playsound(this.loc, "sound/effects/Glasshit.ogg", 75, 1); } base.attackby((object)(A), (object)(user), _params, silent, replace_spent); return(null); }