// Function from file: pipe_dispenser.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { double?p_type = null; Obj_Structure_Disposalconstruct C = null; if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(1); } Task13.User.set_machine(this); this.add_fingerprint(Task13.User); if (Lang13.Bool(href_list["dmake"])) { if (!this.wait) { p_type = String13.ParseNumber(href_list["dmake"]); C = new Obj_Structure_Disposalconstruct(this.loc, p_type); if (!C.can_place()) { Task13.User.WriteMsg("<span class='warning'>There's not enough room to build that here!</span>"); GlobalFuncs.qdel(C); return(null); } C.add_fingerprint(Task13.User); C.update(); this.wait = true; Task13.Schedule(15, (Task13.Closure)(() => { this.wait = false; return; })); } } return(null); }
// Function from file: RPD.dm public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null) { dynamic queued_p_type = null; double? queued_p_dir = null; double? queued_p_flipped = null; dynamic P = null; Obj_Item_Pipe P2 = null; Obj_Structure_Disposalconstruct C = null; if (!(Map13.GetDistance(target, user) <= 1) || this.loc != user) { return(false); } if (!((Mob)user).IsAdvancedToolUser()) { user.WriteMsg("<span class='warning'>You don't have the dexterity to do this!</span>"); return(false); } if (target is Zone_Shuttle || target is Tile_Space_Transit) { return(false); } queued_p_type = this.p_type; queued_p_dir = this.p_dir; queued_p_flipped = this.p_flipped; switch ((int)(this.p_class)) { case -2: if (!(target is Obj_Machinery_Atmospherics_Pipe)) { user.WriteMsg(new Txt("<span class='warning'>").The(this).item().str("'s error light flickers! Perhaps you need to only use it on pipes and pipe meters?</span>").ToString()); return(false); } P = target; GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1); P.color = this.paint_colors[this.paint_color]; P.pipe_color = this.paint_colors[this.paint_color]; P.stored.color = this.paint_colors[this.paint_color]; ((Ent_Static)user).visible_message(new Txt("<span class='notice'>").item(user).str(" paints ").the(P).item().str(" ").item(this.paint_color).str(".</span>").ToString(), new Txt("<span class='notice'>You paint ").the(P).item().str(" ").item(this.paint_color).str(".</span>").ToString()); ((Obj_Machinery_Atmospherics_Pipe)P).update_node_icon(); return(true); break; case -1: if (target is Obj_Item_Pipe || target is Obj_Item_PipeMeter || target is Obj_Structure_Disposalconstruct) { user.WriteMsg("<span class='notice'>You start destroying pipe...</span>"); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, 2, null, target)) { this.activate(); GlobalFuncs.qdel(target); return(true); } return(false); } user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers! Perhaps you need to only use it on pipes and pipe meters?</span>"); return(false); break; case 0: if (!(target is Tile)) { user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers!</span>"); return(false); } user.WriteMsg("<span class='notice'>You start building pipes...</span>"); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, 2, null, target)) { this.activate(); P2 = new Obj_Item_Pipe(target, queued_p_type, queued_p_dir); P2.flipped = queued_p_flipped; P2.update(); P2.add_fingerprint(Task13.User); return(true); } return(false); break; case 1: if (!(target is Tile)) { user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers!</span>"); return(false); } user.WriteMsg("<span class='notice'>You start building meter...</span>"); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, 2, null, target)) { this.activate(); new Obj_Item_PipeMeter(target); return(true); } return(false); break; case 2: if (!(target is Tile) || GlobalFuncs.is_anchored_dense_turf(target)) { user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers!</span>"); return(false); } user.WriteMsg("<span class='notice'>You start building pipes...</span>"); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1); if (GlobalFuncs.do_after(user, 20, null, target)) { C = new Obj_Structure_Disposalconstruct(target, queued_p_type, queued_p_dir); if (!C.can_place()) { user.WriteMsg("<span class='warning'>There's not enough room to build that here!</span>"); GlobalFuncs.qdel(C); return(false); } this.activate(); C.add_fingerprint(Task13.User); C.update(); return(true); } return(false); break; default: base.afterattack((object)(target), (object)(user), proximity_flag, click_parameters); return(false); break; } return(false); }