// Function from file: traitordevices.dm
        public override int?process(dynamic seconds = null)
        {
            dynamic T        = null;
            dynamic lumcount = null;


            if (this.user.get_item_by_slot(6) != this)
            {
                this.Deactivate();
                return(null);
            }
            T = GlobalFuncs.get_turf(this);

            if (this.on)
            {
                lumcount = ((Tile)T).get_lumcount();

                if (Convert.ToDouble(lumcount) > 3)
                {
                    this.charge = Num13.MaxInt(0, this.charge - 25);
                }
                else
                {
                    this.charge = Num13.MinInt(this.max_charge, this.charge + 50);
                }
                Icon13.Animate(new ByTable().Set(1, this.user).Set("alpha", Num13.MaxInt(0, Num13.MinInt(255 - this.charge, 255))).Set("time", 10));
            }
            return(null);
        }
		// Function from file: reagentgrinder.dm
		public void grind(  ) {
			int offset = 0;
			Obj_Item_Weapon_ReagentContainers_Food_Snacks O = null;
			dynamic allowed = null;
			dynamic r_id = null;
			dynamic space = null;
			double amount = 0;
			Obj_Item_Stack_Sheet O2 = null;
			dynamic allowed2 = null;
			double? i = null;
			dynamic r_id2 = null;
			dynamic space2 = null;
			double amount2 = 0;
			Obj_Item_Weapon_Grown O3 = null;
			dynamic allowed3 = null;
			dynamic r_id3 = null;
			dynamic space3 = null;
			bool amount3 = false;
			Obj_Item_Toy_Crayon O4 = null;
			dynamic allowed4 = null;
			dynamic r_id4 = null;
			dynamic space4 = null;
			double amount4 = 0;
			Obj_Item_Weapon_ReagentContainers O5 = null;
			double? amount5 = null;

			this.power_change();

			if ( ( this.stat & 3 ) != 0 ) {
				return;
			}

			if ( !Lang13.Bool( this.beaker ) || Lang13.Bool( this.beaker ) && ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
				return;
			}
			GlobalFuncs.playsound( this.loc, "sound/machines/blender.ogg", 50, 1 );
			offset = ( Rand13.PercentChance( 50 ) ? -2 : 2 );
			Icon13.Animate( new ByTable().Set( 1, this ).Set( "pixel_x", this.pixel_x + offset ).Set( "time", 0.2 ).Set( "loop", 250 ) );
			this.operating = true;
			this.updateUsrDialog();
			Task13.Schedule( 60, (Task13.Closure)(() => {
				this.pixel_x = Convert.ToInt32( Lang13.Initial( this, "pixel_x" ) );
				this.operating = false;
				this.updateUsrDialog();
				return;
			}));

			foreach (dynamic _b in Lang13.Enumerate( this.holdingitems, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks) )) {
				O = _b;
				

				if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
					break;
				}
				allowed = this.get_allowed_snack_by_id( O );

				if ( allowed == null ) {
					break;
				}

				foreach (dynamic _a in Lang13.Enumerate( allowed )) {
					r_id = _a;
					
					space = this.beaker.reagents.maximum_volume - this.beaker.reagents.total_volume;
					amount = Convert.ToDouble( allowed[r_id] );

					if ( amount <= 0 ) {
						
						if ( amount == 0 ) {
							
							if ( O.reagents != null && Lang13.Bool( O.reagents.has_reagent( "nutriment" ) ) ) {
								this.beaker.reagents.add_reagent( r_id, Num13.MinInt( O.reagents.get_reagent_amount( "nutriment" ) ?1:0, Convert.ToInt32( space ) ) );
								O.reagents.remove_reagent( "nutriment", Num13.MinInt( O.reagents.get_reagent_amount( "nutriment" ) ?1:0, Convert.ToInt32( space ) ) );
							}
						} else if ( O.reagents != null && Lang13.Bool( O.reagents.has_reagent( "nutriment" ) ) ) {
							this.beaker.reagents.add_reagent( r_id, Num13.MinInt( Num13.Floor( ( O.reagents.get_reagent_amount( "nutriment" ) ?1:0) * Math.Abs( amount ) ), Convert.ToInt32( space ) ) );
							O.reagents.remove_reagent( "nutriment", Num13.MinInt( O.reagents.get_reagent_amount( "nutriment" ) ?1:0, Convert.ToInt32( space ) ) );
						}
					} else {
						O.reagents.trans_id_to( this.beaker, r_id, Num13.MinInt( ((int)( amount )), Convert.ToInt32( space ) ) );
					}

					if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
						break;
					}
				}

				if ( O.reagents.reagent_list.len == 0 ) {
					this.remove_object( O );
				}
			}

			foreach (dynamic _d in Lang13.Enumerate( this.holdingitems, typeof(Obj_Item_Stack_Sheet) )) {
				O2 = _d;
				
				allowed2 = this.get_allowed_by_id( O2 );

				if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
					break;
				}
				i = null;
				i = 1;

				while (( i ??0) <= Num13.Round( O2.amount ??0, 1 )) {
					
					foreach (dynamic _c in Lang13.Enumerate( allowed2 )) {
						r_id2 = _c;
						
						space2 = this.beaker.reagents.maximum_volume - this.beaker.reagents.total_volume;
						amount2 = Convert.ToDouble( allowed2[r_id2] );
						this.beaker.reagents.add_reagent( r_id2, Num13.MinInt( ((int)( amount2 )), Convert.ToInt32( space2 ) ) );

						if ( Convert.ToDouble( space2 ) < amount2 ) {
							break;
						}
					}

					if ( i == Num13.Round( O2.amount ??0, 1 ) ) {
						this.remove_object( O2 );
						break;
					}
					i++;
				}
			}

			foreach (dynamic _f in Lang13.Enumerate( this.holdingitems, typeof(Obj_Item_Weapon_Grown) )) {
				O3 = _f;
				

				if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
					break;
				}
				allowed3 = this.get_allowed_by_id( O3 );

				foreach (dynamic _e in Lang13.Enumerate( allowed3 )) {
					r_id3 = _e;
					
					space3 = this.beaker.reagents.maximum_volume - this.beaker.reagents.total_volume;
					amount3 = Lang13.Bool( allowed3[r_id3] );

					if ( !amount3 ) {
						
						if ( O3.reagents != null && Lang13.Bool( O3.reagents.has_reagent( r_id3 ) ) ) {
							this.beaker.reagents.add_reagent( r_id3, Num13.MinInt( O3.reagents.get_reagent_amount( r_id3 ) ?1:0, Convert.ToInt32( space3 ) ) );
						}
					} else {
						this.beaker.reagents.add_reagent( r_id3, Num13.MinInt( amount3 ?1:0, Convert.ToInt32( space3 ) ) );
					}

					if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
						break;
					}
				}
				this.remove_object( O3 );
			}

			foreach (dynamic _h in Lang13.Enumerate( this.holdingitems, typeof(Obj_Item_Toy_Crayon) )) {
				O4 = _h;
				

				if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
					break;
				}
				allowed4 = this.get_allowed_by_id( O4 );

				foreach (dynamic _g in Lang13.Enumerate( allowed4 )) {
					r_id4 = _g;
					
					space4 = this.beaker.reagents.maximum_volume - this.beaker.reagents.total_volume;
					amount4 = Convert.ToDouble( allowed4[r_id4] );
					this.beaker.reagents.add_reagent( r_id4, Num13.MinInt( ((int)( amount4 )), Convert.ToInt32( space4 ) ) );

					if ( Convert.ToDouble( space4 ) < amount4 ) {
						break;
					}
					this.remove_object( O4 );
				}
			}

			foreach (dynamic _i in Lang13.Enumerate( this.holdingitems, typeof(Obj_Item_Weapon_ReagentContainers) )) {
				O5 = _i;
				

				if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
					break;
				}
				amount5 = O5.reagents.total_volume;
				O5.reagents.trans_to( this.beaker, amount5 );

				if ( !Lang13.Bool( O5.reagents.total_volume ) ) {
					this.remove_object( O5 );
				}
			}
			return;
		}
Beispiel #3
0
 // Function from file: lighting_system.dm
 public override int get_light_range(int radius = 0)
 {
     return(Num13.MinInt(radius, 7));
 }
Beispiel #4
0
        // Function from file: canister.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            dynamic label       = null;
            dynamic newtype     = null;
            dynamic replacement = null;
            dynamic pressure    = null;
            string  logmsg      = null;
            dynamic plasma      = null;
            dynamic n2o         = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "relabel":
                label = Interface13.Input("New canister label:", this.name, null, null, GlobalVars.label2types, InputType.Null | InputType.Any);

                if (Lang13.Bool(label) && !Lang13.Bool(base.ui_act(action, _params, ui, state)))
                {
                    newtype = GlobalVars.label2types[label];

                    if (Lang13.Bool(newtype))
                    {
                        replacement = Lang13.Call(newtype, this.loc, this.air_contents);
                        replacement.interact(Task13.User);
                        GlobalFuncs.qdel(this);
                    }
                }
                break;

            case "pressure":
                pressure = _params["pressure"];

                if (pressure == "reset")
                {
                    pressure = 101.32499694824219;
                    _default = GlobalVars.TRUE;
                }
                else if (pressure == "min")
                {
                    pressure = 10.132499694824219;
                    _default = GlobalVars.TRUE;
                }
                else if (pressure == "max")
                {
                    pressure = 1013.25;
                    _default = GlobalVars.TRUE;
                }
                else if (pressure == "input")
                {
                    pressure = Interface13.Input("New release pressure (" + 10.132499694824219 + "-" + 1013.25 + " kPa):", this.name, this.release_pressure, null, null, InputType.Num | InputType.Null);

                    if (!(pressure == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state)))
                    {
                        _default = GlobalVars.TRUE;
                    }
                }
                else if (String13.ParseNumber(pressure) != null)
                {
                    pressure = String13.ParseNumber(pressure);
                    _default = GlobalVars.TRUE;
                }

                if (Lang13.Bool(_default))
                {
                    this.release_pressure = Num13.MaxInt(((int)(10.132499694824219)), Num13.MinInt(Num13.Floor(Convert.ToDouble(pressure)), ((int)(1013.25))));
                    this.investigate_log("was set to " + this.release_pressure + " kPa by " + GlobalFuncs.key_name(Task13.User) + ".", "atmos");
                }
                break;

            case "valve":
                logmsg          = null;
                this.valve_open = !this.valve_open;

                if (this.valve_open)
                {
                    logmsg = new Txt("Valve was <b>opened</b> by ").item(GlobalFuncs.key_name(Task13.User)).str(", starting a transfer into ").the(Lang13.Bool(this.holding) || Lang13.Bool("air")).item().str(".<br>").ToString();

                    if (!Lang13.Bool(this.holding))
                    {
                        plasma = this.air_contents.gases["plasma"];
                        n2o    = this.air_contents.gases["n2o"];

                        if (Lang13.Bool(n2o) || Lang13.Bool(plasma))
                        {
                            GlobalFuncs.message_admins(new Txt().item(GlobalFuncs.key_name_admin(Task13.User)).str(" (<A HREF='?_src_=holder;adminmoreinfo=").Ref(Task13.User).str("'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(Task13.User).str("'>FLW</A>) opened a canister that contains ").item((Lang13.Bool(n2o) ? "N2O" : "")).item((Lang13.Bool(n2o) && Lang13.Bool(plasma) ? " & " : "")).item((Lang13.Bool(plasma) ? "Plasma" : "")).str("! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=").item(this.x).str(";Y=").item(this.y).str(";Z=").item(this.z).str("'>JMP</a>)").ToString());
                            GlobalFuncs.log_admin("" + GlobalFuncs.key_name(Task13.User) + " opened a canister that contains " + (Lang13.Bool(n2o) ? "N2O" : "") + (Lang13.Bool(n2o) && Lang13.Bool(plasma) ? " & " : "") + (Lang13.Bool(plasma) ? "Plasma" : "") + " at " + this.x + ", " + this.y + ", " + this.z);
                        }
                    }
                }
                else
                {
                    logmsg = new Txt("Valve was <b>closed</b> by ").item(GlobalFuncs.key_name(Task13.User)).str(", stopping the transfer into ").the(Lang13.Bool(this.holding) || Lang13.Bool("air")).item().str(".<br>").ToString();
                }
                this.investigate_log(logmsg, "atmos");
                this.release_log += logmsg;
                _default          = GlobalVars.TRUE;
                break;

            case "eject":

                if (Lang13.Bool(this.holding))
                {
                    if (this.valve_open)
                    {
                        this.investigate_log("" + GlobalFuncs.key_name(Task13.User) + " removed the " + this.holding + ", leaving the valve open and transfering into the <span class='boldannounce'>air</span><br>", "atmos");
                    }
                    this.holding.loc = GlobalFuncs.get_turf(this);
                    this.holding     = null;
                    _default         = GlobalVars.TRUE;
                }
                break;
            }
            this.update_icon();
            return(_default);
        }
Beispiel #5
0
        // Function from file: tuberculosis.dm
        public override void stage_act(  )
        {
            base.stage_act();

            switch ((int?)(this.stage))
            {
            case 2:

                if (Rand13.PercentChance(2))
                {
                    ((Mob)this.affected_mob).emote("cough");
                    this.affected_mob.WriteMsg("<span class='danger'>Your chest hurts.</span>");
                }

                if (Rand13.PercentChance(2))
                {
                    this.affected_mob.WriteMsg("<span class='danger'>Your stomach violently rumbles!</span>");
                }

                if (Rand13.PercentChance(5))
                {
                    this.affected_mob.WriteMsg("<span class='danger'>You feel a cold sweat form.</span>");
                }
                break;

            case 4:

                if (Rand13.PercentChance(2))
                {
                    this.affected_mob.WriteMsg("<span class='userdanger'>You see four of everything</span>");
                    ((Mob)this.affected_mob).Dizzy(5);
                }

                if (Rand13.PercentChance(2))
                {
                    this.affected_mob.WriteMsg("<span class='danger'>You feel a sharp pain from your lower chest!</span>");
                    ((Mob_Living)this.affected_mob).adjustOxyLoss(5);
                    ((Mob)this.affected_mob).emote("gasp");
                }

                if (Rand13.PercentChance(10))
                {
                    this.affected_mob.WriteMsg("<span class='danger'>You feel air escape from your lungs painfully.</span>");
                    ((Mob_Living)this.affected_mob).adjustOxyLoss(25);
                    ((Mob)this.affected_mob).emote("gasp");
                }
                break;

            case 5:

                if (Rand13.PercentChance(2))
                {
                    this.affected_mob.WriteMsg("<span class='userdanger'>" + Rand13.Pick(new object [] { "You feel your heart slowing...", "You relax and slow your heartbeat." }) + "</span>");
                    ((Mob_Living)this.affected_mob).adjustStaminaLoss(70);
                }

                if (Rand13.PercentChance(10))
                {
                    ((Mob_Living)this.affected_mob).adjustStaminaLoss(100);
                    ((Ent_Static)this.affected_mob).visible_message("<span class='warning'>" + this.affected_mob + " faints!</span>", "<span class='userdanger'>You surrender yourself and feel at peace...</span>");
                    ((Mob)this.affected_mob).AdjustSleeping(5);
                }

                if (Rand13.PercentChance(2))
                {
                    this.affected_mob.WriteMsg("<span class='userdanger'>You feel your mind relax and your thoughts drift!</span>");
                    this.affected_mob.confused = Num13.MinInt(100, ((int)(this.affected_mob.confused + 8)));
                }

                if (Rand13.PercentChance(10))
                {
                    ((Mob_Living_Carbon)this.affected_mob).vomit(20);
                }

                if (Rand13.PercentChance(3))
                {
                    this.affected_mob.WriteMsg("<span class='warning'><i>" + Rand13.Pick(new object [] { "Your stomach silently rumbles...", "Your stomach seizes up and falls limp, muscles dead and lifeless.", "You could eat a crayon" }) + "</i></span>");
                    this.affected_mob.overeatduration = Num13.MaxInt(this.affected_mob.overeatduration - 100, 0);
                    this.affected_mob.nutrition       = Num13.MaxInt(((int)(this.affected_mob.nutrition - 100)), 0);
                }

                if (Rand13.PercentChance(15))
                {
                    this.affected_mob.WriteMsg("<span class='danger'>" + Rand13.Pick(new object [] { "You feel uncomfortably hot...", "You feel like unzipping your jumpsuit", "You feel like taking off some clothes..." }) + "</span>");
                    this.affected_mob.bodytemperature += 40;
                }
                break;
            }
            return;
        }
        // Function from file: generator.dm
        public override int?process(dynamic seconds = null)
        {
            dynamic cold_air = null;
            dynamic hot_air  = null;
            double  cold_air_heat_capacity = 0;
            double  hot_air_heat_capacity  = 0;
            bool    delta_temperature      = false;
            double  efficiency             = 0;
            double  energy_transfer        = 0;
            double  heat           = 0;
            dynamic hot_circ_air1  = null;
            dynamic cold_circ_air1 = null;
            int     genlev         = 0;
            string  circ           = null;


            if (!Lang13.Bool(this.cold_circ) || !Lang13.Bool(this.hot_circ))
            {
                return(null);
            }
            this.lastgen = 0;

            if (Lang13.Bool(this.powernet))
            {
                cold_air = ((Obj_Machinery_Atmospherics_Components_Binary_Circulator)this.cold_circ).return_transfer_air();
                hot_air  = ((Obj_Machinery_Atmospherics_Components_Binary_Circulator)this.hot_circ).return_transfer_air();

                if (Lang13.Bool(cold_air) && Lang13.Bool(hot_air))
                {
                    cold_air_heat_capacity = ((GasMixture)cold_air).heat_capacity();
                    hot_air_heat_capacity  = ((GasMixture)hot_air).heat_capacity();
                    delta_temperature      = Lang13.Bool(hot_air.temperature - cold_air.temperature);

                    if ((delta_temperature ?1:0) > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0)
                    {
                        efficiency           = 0.41;
                        energy_transfer      = (delta_temperature ?1:0) * hot_air_heat_capacity * cold_air_heat_capacity / (hot_air_heat_capacity + cold_air_heat_capacity);
                        heat                 = energy_transfer * (1 - efficiency);
                        this.lastgen         = energy_transfer * efficiency;
                        hot_air.temperature  = hot_air.temperature - energy_transfer / hot_air_heat_capacity;
                        cold_air.temperature = cold_air.temperature + heat / cold_air_heat_capacity;
                        this.add_avail(this.lastgen);
                    }
                }

                if (Lang13.Bool(hot_air))
                {
                    hot_circ_air1 = this.hot_circ.airs[1];
                    hot_circ_air1.merge(hot_air);
                }

                if (Lang13.Bool(cold_air))
                {
                    cold_circ_air1 = this.cold_circ.airs[1];
                    cold_circ_air1.merge(cold_air);
                }
            }
            genlev = Num13.MaxInt(0, Num13.MinInt(Num13.Floor(this.lastgen * 11 / 100000), 11));
            circ   = "" + (Lang13.Bool(this.cold_circ) && Convert.ToDouble(this.cold_circ.last_pressure_delta) > 0 ? "1" : "0") + (Lang13.Bool(this.hot_circ) && Convert.ToDouble(this.hot_circ.last_pressure_delta) > 0 ? "1" : "0");

            if (genlev != this.lastgenlev || circ != this.lastcirc)
            {
                this.lastgenlev = genlev;
                this.lastcirc   = circ;
                this.update_icon();
            }
            this.updateDialog();
            return(null);
        }
Beispiel #7
0
        // Function from file: robot_items.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic M     = null;
            dynamic cell  = null;
            dynamic E     = null;
            int     draw  = 0;
            dynamic cell2 = null;
            dynamic E2    = null;
            int     draw2 = 0;


            if (!(proximity_flag == true) || !(user is Mob_Living_Silicon_Robot))
            {
                return(false);
            }

            if (this.mode == "draw")
            {
                if (GlobalFuncs.is_type_in_list(target, this.charge_machines))
                {
                    M = target;

                    if (Lang13.Bool(M.stat & 3) || !Lang13.Bool(M.anchored))
                    {
                        user.WriteMsg("<span class='warning'>" + M + " is unpowered!</span>");
                        return(false);
                    }
                    user.WriteMsg("<span class='notice'>You connect to " + M + "'s power line...</span>");

                    while (GlobalFuncs.do_after(user, 15, null, M, false))
                    {
                        if (!Lang13.Bool(user) || !Lang13.Bool(user.cell) || this.mode != "draw")
                        {
                            return(false);
                        }

                        if (Lang13.Bool(M.stat & 3) || !Lang13.Bool(M.anchored))
                        {
                            break;
                        }

                        if (!Lang13.Bool(user.cell.give(150)))
                        {
                            break;
                        }
                        ((Obj_Machinery)M).f_use_power(200);
                    }
                    user.WriteMsg("<span class='notice'>You stop charging youself.</span>");
                }
                else if (GlobalFuncs.is_type_in_list(target, this.charge_items))
                {
                    cell = target;

                    if (!(cell is Obj_Item_Weapon_StockParts_Cell))
                    {
                        cell = Lang13.FindIn(typeof(Obj_Item_Weapon_StockParts_Cell), target);
                    }

                    if (!Lang13.Bool(cell))
                    {
                        user.WriteMsg("<span class='warning'>" + target + " has no power cell!</span>");
                        return(false);
                    }

                    if (target is Obj_Item_Weapon_Gun_Energy)
                    {
                        E = target;

                        if (!Lang13.Bool(E.can_charge))
                        {
                            user.WriteMsg("<span class='warning'>" + target + " has no power port!</span>");
                            return(false);
                        }
                    }

                    if (!Lang13.Bool(cell.charge))
                    {
                        user.WriteMsg("<span class='warning'>" + target + " has no power!</span>");
                    }
                    user.WriteMsg("<span class='notice'>You connect to " + target + "'s power port...</span>");

                    while (GlobalFuncs.do_after(user, 15, null, target, false))
                    {
                        if (!Lang13.Bool(user) || !Lang13.Bool(user.cell) || this.mode != "draw")
                        {
                            return(false);
                        }

                        if (!Lang13.Bool(cell) || !Lang13.Bool(target))
                        {
                            return(false);
                        }

                        if (cell != target && cell.loc != target)
                        {
                            return(false);
                        }
                        draw = Num13.MinInt(Convert.ToInt32(cell.charge), ((int)(cell.chargerate * 0.5)), ((int)((user.cell.maxcharge ?? 0) - Convert.ToDouble(user.cell.charge))));

                        if (!Lang13.Bool(cell.use(draw)))
                        {
                            break;
                        }

                        if (!Lang13.Bool(user.cell.give(draw)))
                        {
                            break;
                        }
                        target.update_icon();
                    }
                    user.WriteMsg("<span class='notice'>You stop charging youself.</span>");
                }
            }
            else if (GlobalFuncs.is_type_in_list(target, this.charge_items))
            {
                cell2 = target;

                if (!(cell2 is Obj_Item_Weapon_StockParts_Cell))
                {
                    cell2 = Lang13.FindIn(typeof(Obj_Item_Weapon_StockParts_Cell), target);
                }

                if (!Lang13.Bool(cell2))
                {
                    user.WriteMsg("<span class='warning'>" + target + " has no power cell!</span>");
                    return(false);
                }

                if (target is Obj_Item_Weapon_Gun_Energy)
                {
                    E2 = target;

                    if (!Lang13.Bool(E2.can_charge))
                    {
                        user.WriteMsg("<span class='warning'>" + target + " has no power port!</span>");
                        return(false);
                    }
                }

                if (Convert.ToDouble(cell2.charge) >= (cell2.maxcharge ?? 0))
                {
                    user.WriteMsg("<span class='warning'>" + target + " is already charged!</span>");
                }
                user.WriteMsg("<span class='notice'>You connect to " + target + "'s power port...</span>");

                while (GlobalFuncs.do_after(user, 15, null, target, false))
                {
                    if (!Lang13.Bool(user) || !Lang13.Bool(user.cell) || this.mode != "charge")
                    {
                        return(false);
                    }

                    if (!Lang13.Bool(cell2) || !Lang13.Bool(target))
                    {
                        return(false);
                    }

                    if (cell2 != target && cell2.loc != target)
                    {
                        return(false);
                    }
                    draw2 = Num13.MinInt(Convert.ToInt32(user.cell.charge), ((int)(cell2.chargerate * 0.5)), ((int)((cell2.maxcharge ?? 0) - Convert.ToDouble(cell2.charge))));

                    if (!Lang13.Bool(user.cell.use(draw2)))
                    {
                        break;
                    }

                    if (!Lang13.Bool(cell2.give(draw2)))
                    {
                        break;
                    }
                    target.update_icon();
                }
                user.WriteMsg("<span class='notice'>You stop charging " + target + ".</span>");
            }
            return(false);
        }
Beispiel #8
0
        // Function from file: work_tools.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            double?m = null;
            Obj_Item_Stack_CableCoil CC = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (Lang13.Bool(href_list["toggle"]))
            {
                this.set_ready_state(!this.equip_ready);
                this.occupant_message("" + this + " " + (this.equip_ready ? "dea" : "a") + "ctivated.");
                this.log_message("" + (this.equip_ready ? "Dea" : "A") + "ctivated.");
                return(null);
            }

            if (Lang13.Bool(href_list["cut"]))
            {
                if (this.cable != null && Lang13.Bool(this.cable.amount))
                {
                    m = Num13.Round(Convert.ToDouble(Interface13.Input(this.chassis.occupant, "Please specify the length of cable to cut", "Cut cable", Num13.MinInt(((int)(this.cable.amount ?? 0)), 30), null, InputType.Num)), 1);
                    m = Num13.MinInt(((int)(m ?? 0)), ((int)(this.cable.amount ?? 0)));

                    if (Lang13.Bool(m))
                    {
                        this.use_cable(m);
                        CC        = new Obj_Item_Stack_CableCoil(GlobalFuncs.get_turf(this.chassis));
                        CC.amount = m;
                    }
                }
                else
                {
                    this.occupant_message("There's no more cable on the reel.");
                }
            }
            return(null);
        }
        // Function from file: dp_vent_pump.dm
        public override int?process_atmos(  )
        {
            dynamic    air1                 = null;
            dynamic    air2                 = null;
            GasMixture environment          = null;
            double     environment_pressure = 0;
            int        pressure_delta       = 0;
            double     transfer_moles       = 0;
            dynamic    removed              = null;
            dynamic    parent1              = null;
            int        pressure_delta2      = 0;
            double     transfer_moles2      = 0;
            dynamic    removed2             = null;
            dynamic    parent2              = null;

            base.process_atmos();

            if (!Lang13.Bool(this.on))
            {
                return(0);
            }
            air1                 = this.airs[1];
            air2                 = this.airs[2];
            environment          = this.loc.return_air();
            environment_pressure = environment.return_pressure();

            if (Lang13.Bool(this.pump_direction))
            {
                pressure_delta = 10000;

                if ((((int)(this.pressure_checks ?? 0)) & 1) != 0)
                {
                    pressure_delta = Num13.MinInt(pressure_delta, ((int)(this.external_pressure_bound - environment_pressure)));
                }

                if ((((int)(this.pressure_checks ?? 0)) & 2) != 0)
                {
                    pressure_delta = Num13.MinInt(pressure_delta, Convert.ToInt32(air1.return_pressure() - this.input_pressure_min));
                }

                if (pressure_delta > 0)
                {
                    if (Convert.ToDouble(air1.temperature) > 0)
                    {
                        transfer_moles = pressure_delta * (environment.volume ?? 0) / Convert.ToDouble(air1.temperature * 8.31);
                        removed        = air1.remove(transfer_moles);
                        this.loc.assume_air(removed);
                        this.air_update_turf();
                        parent1        = this.parents[1];
                        parent1.update = 1;
                    }
                }
            }
            else
            {
                pressure_delta2 = 10000;

                if ((((int)(this.pressure_checks ?? 0)) & 1) != 0)
                {
                    pressure_delta2 = Num13.MinInt(pressure_delta2, ((int)(environment_pressure - this.external_pressure_bound)));
                }

                if ((((int)(this.pressure_checks ?? 0)) & 2) != 0)
                {
                    pressure_delta2 = Num13.MinInt(pressure_delta2, ((int)(this.output_pressure_max - Convert.ToDouble(air2.return_pressure()))));
                }

                if (pressure_delta2 > 0)
                {
                    if (Convert.ToDouble(environment.temperature) > 0)
                    {
                        transfer_moles2 = pressure_delta2 * Convert.ToDouble(air2.volume) / Convert.ToDouble(environment.temperature * 8.31);
                        removed2        = this.loc.remove_air(transfer_moles2);
                        air2.merge(removed2);
                        this.air_update_turf();
                        parent2        = this.parents[2];
                        parent2.update = 1;
                    }
                }
            }
            return(1);
        }
Beispiel #10
0
        // Function from file: life.dm
        public override void handle_environment(GasMixture environment = null)
        {
            dynamic loc_temp          = null;
            dynamic pressure          = null;
            dynamic adjusted_pressure = null;


            if (!(environment != null))
            {
                return;
            }
            loc_temp = this.get_temperature(environment);

            if (this.stat != 2)
            {
                this.natural_bodytemperature_stabilization();
            }

            if (!this.on_fire)
            {
                if (Convert.ToDouble(loc_temp) < Convert.ToDouble(this.bodytemperature))
                {
                    this.bodytemperature += Num13.MinInt(Convert.ToInt32((loc_temp - this.bodytemperature) / 6), 30);
                }
                else
                {
                    this.bodytemperature += Num13.MinInt(Convert.ToInt32((loc_temp - this.bodytemperature) / 6), 30);
                }
            }

            if (Convert.ToDouble(this.bodytemperature) > 360.41)
            {
                dynamic _a = this.bodytemperature;                 // Was a switch-case, sorry for the mess.
                if (360 <= _a && _a <= 400)
                {
                    this.throw_alert("temp", typeof(Obj_Screen_Alert_Hot), 1);
                    this.adjustFireLoss(2);
                }
                else if (400 <= _a && _a <= 460)
                {
                    this.throw_alert("temp", typeof(Obj_Screen_Alert_Hot), 2);
                    this.adjustFireLoss(3);
                }
                else if (460 <= _a && _a <= Double.PositiveInfinity)
                {
                    this.throw_alert("temp", typeof(Obj_Screen_Alert_Hot), 3);

                    if (this.on_fire)
                    {
                        this.adjustFireLoss(8);
                    }
                    else
                    {
                        this.adjustFireLoss(3);
                    }
                }
            }
            else if (Convert.ToDouble(this.bodytemperature) < 260.41)
            {
                if (!(this.loc is Obj_Machinery_Atmospherics_Components_Unary_CryoCell))
                {
                    dynamic _b = this.bodytemperature;                     // Was a switch-case, sorry for the mess.
                    if (200 <= _b && _b <= 260)
                    {
                        this.throw_alert("temp", typeof(Obj_Screen_Alert_Cold), 1);
                        this.adjustFireLoss(0.5);
                    }
                    else if (120 <= _b && _b <= 200)
                    {
                        this.throw_alert("temp", typeof(Obj_Screen_Alert_Cold), 2);
                        this.adjustFireLoss(1.5);
                    }
                    else if (Double.NegativeInfinity <= _b && _b <= 120)
                    {
                        this.throw_alert("temp", typeof(Obj_Screen_Alert_Cold), 3);
                        this.adjustFireLoss(3);
                    }
                }
                else
                {
                    this.clear_alert("temp");
                }
            }
            else
            {
                this.clear_alert("temp");
            }
            pressure          = environment.return_pressure();
            adjusted_pressure = this.calculate_affecting_pressure(pressure);

            dynamic _c = adjusted_pressure;             // Was a switch-case, sorry for the mess.

            if (550 <= _c && _c <= Double.PositiveInfinity)
            {
                this.adjustBruteLoss(Num13.MinInt(Convert.ToInt32((adjusted_pressure / 550 - 1) * 4), 4));
                this.throw_alert("pressure", typeof(Obj_Screen_Alert_Highpressure), 2);
            }
            else if (325 <= _c && _c <= 550)
            {
                this.throw_alert("pressure", typeof(Obj_Screen_Alert_Highpressure), 1);
            }
            else if (50 <= _c && _c <= 325)
            {
                this.clear_alert("pressure");
            }
            else if (20 <= _c && _c <= 50)
            {
                this.throw_alert("pressure", typeof(Obj_Screen_Alert_Lowpressure), 1);
            }
            else
            {
                this.adjustBruteLoss(2);
                this.throw_alert("pressure", typeof(Obj_Screen_Alert_Lowpressure), 2);
            }
            return;
        }
        // Function from file: absorb.dm
        public override dynamic sting_action(Mob user = null, Ent_Static target = null)
        {
            Changeling changeling     = null;
            dynamic    G              = null;
            Mob_Living target2        = null;
            int?       stage          = null;
            ByTable    recent_speech  = null;
            dynamic    spoken_memory  = null;
            dynamic    spoken_memory2 = null;

            changeling             = user.mind.changeling;
            G                      = user.get_active_hand();
            target2                = G.affecting;
            changeling.isabsorbing = true;
            stage                  = null;
            stage                  = 1;

            while ((stage ?? 0) <= 3)
            {
                switch ((int?)(stage))
                {
                case 1:
                    user.WriteMsg("<span class='notice'>This creature is compatible. We must hold still...</span>");
                    break;

                case 2:
                    user.visible_message("<span class='warning'>" + user + " extends a proboscis!</span>", "<span class='notice'>We extend a proboscis.</span>");
                    break;

                case 3:
                    user.visible_message("<span class='danger'>" + user + " stabs " + target2 + " with the proboscis!</span>", "<span class='notice'>We stab " + target2 + " with the proboscis.</span>");
                    target2.WriteMsg("<span class='userdanger'>You feel a sharp stabbing pain!</span>");
                    target2.take_overall_damage(40);
                    break;
                }
                GlobalFuncs.feedback_add_details("changeling_powers", "A" + stage);

                if (!GlobalFuncs.do_mob(user, target2, 150))
                {
                    user.WriteMsg("<span class='warning'>Our absorption of " + target2 + " has been interrupted!</span>");
                    changeling.isabsorbing = false;
                    return(null);
                }
                stage++;
            }
            user.visible_message("<span class='danger'>" + user + " sucks the fluids from " + target2 + "!</span>", "<span class='notice'>We have absorbed " + target2 + ".</span>");
            target2.WriteMsg("<span class='userdanger'>You are absorbed by the changeling!</span>");

            if (!changeling.has_dna(((dynamic)target2).dna))
            {
                changeling.add_new_profile(target2, user);
            }

            if (user.nutrition < 450)
            {
                user.nutrition = Num13.MinInt(((int)(user.nutrition + target2.nutrition)), 450);
            }

            if (target2.mind != null)
            {
                target2.mind.show_memory(this, false);
                recent_speech = new ByTable();

                if (target2.say_log.len > 8)
                {
                    recent_speech = target2.say_log.Copy(target2.say_log.len - 8 + 1, 0);
                }
                else
                {
                    foreach (dynamic _b in Lang13.Enumerate(target2.say_log))
                    {
                        spoken_memory = _b;


                        if (recent_speech.len >= 8)
                        {
                            break;
                        }
                        recent_speech.Add(spoken_memory);
                    }
                }

                if (recent_speech.len != 0)
                {
                    user.mind.store_memory("<B>Some of " + target2 + "'s speech patterns, we should study these to better impersonate them!</B>");
                    user.WriteMsg("<span class='boldnotice'>Some of " + target2 + "'s speech patterns, we should study these to better impersonate them!</span>");

                    foreach (dynamic _c in Lang13.Enumerate(recent_speech))
                    {
                        spoken_memory2 = _c;

                        user.mind.store_memory("\"" + spoken_memory2 + "\"");
                        user.WriteMsg("<span class='notice'>\"" + spoken_memory2 + "\"</span>");
                    }
                    user.mind.store_memory("<B>We have no more knowledge of " + target2 + "'s speech patterns.</B>");
                    user.WriteMsg("<span class='boldnotice'>We have no more knowledge of " + target2 + "'s speech patterns.</span>");
                }

                if (target2.mind.changeling != null)
                {
                    changeling.chem_charges  += Num13.MinInt(((int)(target2.mind.changeling.chem_charges)), Convert.ToInt32(changeling.chem_storage));
                    changeling.absorbedcount += target2.mind.changeling.absorbedcount;
                    target2.mind.changeling.stored_profiles.len = 1;
                    target2.mind.changeling.absorbedcount       = 0;
                }
            }
            changeling.chem_charges = Num13.MinInt(((int)(changeling.chem_charges + 10)), Convert.ToInt32(changeling.chem_storage));
            changeling.isabsorbing  = false;
            changeling.canrespec    = true;
            target2.death(false);
            ((dynamic)target2).Drain();
            return(1);
        }
Beispiel #12
0
        // Function from file: swapmaps.dm
        public ByTable ConsiderRegion(int X1 = 0, int Y1 = 0, int X2 = 0, int Y2 = 0, int?Z1 = null, int?Z2 = null)
        {
            ByTable _default = null;

            int     nextz = 0;
            Swapmap M     = null;
            int?    nz2   = null;


            while (true)
            {
                nextz = 0;

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.swapmaps_loaded, typeof(Swapmap)))
                {
                    M = _a;


                    if ((M.z2 ?? 0) < (Z1 ?? 0) || Lang13.Bool(Z2) && (M.z1 ?? 0) > (Z2 ?? 0) || (M.z1 ?? 0) >= (Z1 ?? 0) + (this.z2 ?? 0) || M.x1 > X2 || M.x2 < X1 || M.x1 >= X1 + this.x2 || M.y1 > Y2 || M.y2 < Y1 || M.y1 >= Y1 + this.y2)
                    {
                        continue;
                    }
                    nz2 = (Lang13.Bool(Z2) ? Z2 : (Z1 ?? 0) + (this.z2 ?? 0) - 1 + (M.z2 ?? 0) - (M.z1 ?? 0));

                    if (M.x1 >= X1 + this.x2)
                    {
                        _default = this.ConsiderRegion(X1, Y1, M.x1 - 1, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    else if (M.x2 <= X2 - this.x2)
                    {
                        _default = this.ConsiderRegion(M.x2 + 1, Y1, X2, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }

                    if (M.y1 >= Y1 + this.y2)
                    {
                        _default = this.ConsiderRegion(X1, Y1, X2, M.y1 - 1, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    else if (M.y2 <= Y2 - this.y2)
                    {
                        _default = this.ConsiderRegion(X1, M.y2 + 1, X2, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    nextz = (nextz != 0 ? Num13.MinInt(nextz, (M.z2 ?? 0) + 1) : (M.z2 ?? 0) + 1);
                }

                if (!(M != null))
                {
                    if (nextz != 0)
                    {
                        Z1 = nextz;
                    }

                    if (!(nextz != 0) || Lang13.Bool(Z2) && (Z2 ?? 0) - (Z1 ?? 0) + 1 < (this.z2 ?? 0))
                    {
                        return(!Lang13.Bool(Z2) || (Z2 ?? 0) - (Z1 ?? 0) + 1 >= (this.z2 ?? 0) ? new ByTable(new object [] { X1, Y1, Z1 }) : null);
                    }
                    X1 = 1;
                    X2 = Game13.map_size_x;
                    Y1 = 1;
                    Y2 = Game13.map_size_y;
                }
            }
            return(_default);
        }
Beispiel #13
0
        // Function from file: ticker.dm
        public bool declare_completion(  )
        {
            bool                     station_evacuated = false;
            int                      num_survivors     = 0;
            int                      num_escapees      = 0;
            dynamic                  Player            = null;
            StationState             end_state         = null;
            int                      station_integrity = 0;
            Mob_Living_Silicon_Ai    aiPlayer          = null;
            string                   robolist          = null;
            Mob_Living_Silicon_Robot robo              = null;
            Mob_Living_Silicon_Robot robo2             = null;
            dynamic                  handler           = null;
            ByTable                  total_antagonists = null;
            Mind                     Mind              = null;
            string                   temprole          = null;
            dynamic                  i      = null;
            string                   dellog = null;
            dynamic                  path   = null;


            if (GlobalVars.SSshuttle.emergency.mode >= 5)
            {
                station_evacuated = true;
            }
            num_survivors = 0;
            num_escapees  = 0;
            Game13.WriteMsg("<BR><BR><BR><FONT size=3><B>The round has ended.</B></FONT>");

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.mob_list))
            {
                Player = _a;


                if (Lang13.Bool(Player.mind) && !(Player is Mob_NewPlayer))
                {
                    if (Convert.ToInt32(Player.stat) != 2 && !(Player is Mob_Living_Carbon_Brain))
                    {
                        num_survivors++;

                        if (station_evacuated)
                        {
                            if (!((Ent_Static)Player).onCentcom() && !((Ent_Static)Player).onSyndieBase())
                            {
                                Player.WriteMsg("<font color='blue'><b>You managed to survive, but were marooned on " + GlobalFuncs.station_name() + "...</b></FONT>");
                            }
                            else
                            {
                                num_escapees++;
                                Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>");
                            }
                        }
                        else
                        {
                            Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>");
                        }
                    }
                    else
                    {
                        Player.WriteMsg("<font color='red'><b>You did not survive the events on " + GlobalFuncs.station_name() + "...</b></FONT>");
                    }
                }
            }
            end_state = new StationState();
            end_state.count();
            station_integrity = Num13.MinInt(((int)(Num13.Round(GlobalVars.start_state.score(end_state) * 100, 0.1))), 100);
            Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Shift Duration: <B>" + Num13.Floor(Game13.time / 36000) + ":" + GlobalFuncs.add_zero("" + Game13.time / 600 % 60, 2) + ":" + Game13.time / 100 % 6 + Game13.time / 100 % 10 + "</B>");
            Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Station Integrity: <B>" + (this.mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "" + station_integrity + "%") + "</B>");

            if (GlobalVars.joined_player_list.len != 0)
            {
                Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Total Population: <B>" + GlobalVars.joined_player_list.len + "</B>");

                if (station_evacuated)
                {
                    Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Evacuation Rate: <B>" + num_escapees + " (" + Num13.Round(num_escapees / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>");
                }
                Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Survival Rate: <B>" + num_survivors + " (" + Num13.Round(num_survivors / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>");
            }
            Game13.WriteMsg("<BR>");

            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Ai)))
            {
                aiPlayer = _c;


                if (aiPlayer.stat != 2 && aiPlayer.mind != null)
                {
                    Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws at the end of the round were:</b>");
                    aiPlayer.show_laws(true);
                }
                else if (aiPlayer.mind != null)
                {
                    Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws when it was deactivated were:</b>");
                    aiPlayer.show_laws(true);
                }
                Game13.WriteMsg("<b>Total law changes: " + aiPlayer.law_change_counter + "</b>");

                if (aiPlayer.connected_robots.len != 0)
                {
                    robolist = "<b>" + aiPlayer.real_name + "'s minions were:</b> ";

                    foreach (dynamic _b in Lang13.Enumerate(aiPlayer.connected_robots, typeof(Mob_Living_Silicon_Robot)))
                    {
                        robo = _b;


                        if (robo.mind != null)
                        {
                            robolist += "" + robo.name + (robo.stat != 0 ? " (Deactivated) (Played by: " + robo.mind.key + "), " : " (Played by: " + robo.mind.key + "), ");
                        }
                    }
                    Game13.WriteMsg("" + robolist);
                }
            }

            foreach (dynamic _d in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Robot)))
            {
                robo2 = _d;


                if (!Lang13.Bool(robo2.connected_ai) && robo2.mind != null)
                {
                    if (robo2.stat != 2)
                    {
                        Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") survived as an AI-less borg! Its laws were:</b>");
                    }
                    else
                    {
                        Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") was unable to survive the rigors of being a cyborg without an AI. Its laws were:</b>");
                    }

                    if (robo2 != null)
                    {
                        robo2.laws.show_laws(typeof(Game13));
                    }
                }
            }
            this.mode.declare_completion();

            foreach (dynamic _e in Lang13.Enumerate(Lang13.GetTypes("/datum/game_mode/proc")))
            {
                handler = _e;


                if (String13.FindIgnoreCase("" + handler, "auto_declare_completion_", 1, 0) != 0)
                {
                    Lang13.Call(Lang13.BindFunc(this.mode, handler), this.force_ending);
                }
            }
            total_antagonists = new ByTable();

            foreach (dynamic _f in Lang13.Enumerate(this.minds, typeof(Mind)))
            {
                Mind = _f;

                temprole = Mind.special_role;

                if (Lang13.Bool(temprole))
                {
                    if (total_antagonists.Contains(temprole))
                    {
                        total_antagonists[temprole] += ", " + Mind.name + "(" + Mind.key + ")";
                    }
                    else
                    {
                        total_antagonists.Add(temprole);
                        total_antagonists[temprole] += ": " + Mind.name + "(" + Mind.key + ")";
                    }
                }
            }
            GlobalFuncs.log_game("Antagonists at round end were...");

            foreach (dynamic _g in Lang13.Enumerate(total_antagonists))
            {
                i = _g;

                GlobalFuncs.log_game("" + i + "s" + total_antagonists[i] + ".");
            }

            if (GlobalVars.SSgarbage.didntgc.len != 0)
            {
                dellog = "";

                foreach (dynamic _h in Lang13.Enumerate(GlobalVars.SSgarbage.didntgc))
                {
                    path = _h;

                    dellog += "Path : " + path + " \n";
                    dellog += "Failures : " + GlobalVars.SSgarbage.didntgc[path] + " \n";
                }
                Game13.log.WriteMsg(dellog);
            }
            return(true);
        }
        // Function from file: solar.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            double?adjust  = null;
            double?adjust2 = null;
            double?mode    = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "direction":
                adjust = String13.ParseNumber(_params["adjust"]);

                if (Lang13.Bool(adjust))
                {
                    this.currentdir = Num13.MaxInt(0, Num13.MinInt(((int)(((adjust ?? 0) + (this.currentdir ?? 0) + 360) % 360)), 359));
                    this.targetdir  = this.currentdir;
                    this.set_panels(this.currentdir);
                    _default = GlobalVars.TRUE;
                }
                break;

            case "rate":
                adjust2 = String13.ParseNumber(_params["adjust"]);

                if (Lang13.Bool(adjust2))
                {
                    this.trackrate = Num13.MaxInt(-7200, Num13.MinInt(((int)(this.trackrate + (adjust2 ?? 0))), 7200));

                    if (this.trackrate != 0)
                    {
                        this.nexttime = Game13.time + 36000 / Math.Abs(this.trackrate);
                    }
                    _default = GlobalVars.TRUE;
                }
                break;

            case "tracking":
                mode = String13.ParseNumber(_params["mode"]);

                if (Lang13.Bool(mode))
                {
                    this.track = mode;
                    _default   = GlobalVars.TRUE;
                }

                if (mode == 2 && this.connected_tracker != null)
                {
                    this.connected_tracker.set_angle(GlobalVars.SSsun.angle);
                    this.set_panels(this.currentdir);
                }
                else if (mode == 1)
                {
                    this.targetdir = this.currentdir;

                    if (this.trackrate != 0)
                    {
                        this.nexttime = Game13.time + 36000 / Math.Abs(this.trackrate);
                    }
                    this.set_panels(this.targetdir);
                }
                break;

            case "refresh":
                this.search_for_connected();

                if (this.connected_tracker != null && this.track == 2)
                {
                    this.connected_tracker.set_angle(GlobalVars.SSsun.angle);
                }
                this.set_panels(this.currentdir);
                _default = GlobalVars.TRUE;
                break;
            }
            return(_default);
        }
Beispiel #15
0
        // Function from file: chunk.dm
        public Camerachunk(dynamic loc = null, int?x = null, int?y = null, int z = 0)
        {
            Obj_Machinery_Camera c = null;
            dynamic t      = null;
            dynamic camera = null;
            dynamic c2     = null;
            dynamic t2     = null;
            dynamic turf   = null;
            dynamic t3     = null;

            x     &= 65520;
            y     &= 65520;
            this.x = x;
            this.y = y;
            this.z = z;

            foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.ultra_range(GlobalVars.CHUNK_SIZE, Map13.GetTile((x ?? 0) + 8, (y ?? 0) + 8, z)), typeof(Obj_Machinery_Camera)))
            {
                c = _a;


                if (c.can_use())
                {
                    this.cameras.Add(c);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(x ?? 0, y ?? 0, z), Map13.GetTile(Num13.MinInt((x ?? 0) + 16 - 1, Game13.map_size_x), Num13.MinInt((y ?? 0) + 16 - 1, Game13.map_size_y), z))))
            {
                t = _b;

                this.turfs[t] = t;
            }

            foreach (dynamic _d in Lang13.Enumerate(this.cameras))
            {
                camera = _d;

                c2 = camera;

                if (!Lang13.Bool(c2))
                {
                    continue;
                }

                if (!((Obj_Machinery_Camera)c2).can_use())
                {
                    continue;
                }

                foreach (dynamic _c in Lang13.Enumerate(((Obj_Machinery_Camera)c2).can_see()))
                {
                    t2 = _c;

                    this.visibleTurfs[t2] = t2;
                }
            }
            this.visibleTurfs.And(this.turfs);
            this.obscuredTurfs = this.turfs - this.visibleTurfs;

            foreach (dynamic _e in Lang13.Enumerate(this.obscuredTurfs))
            {
                turf = _e;

                t3 = turf;

                if (!Lang13.Bool(t3.obscured))
                {
                    t3.obscured = new Image("icons/effects/cameravis.dmi", t3, "black", 16);
                }
                this.obscured.Add(t3.obscured);
            }
            return;
        }
        // Function from file: dp_vent_pump.dm
        public override bool receive_signal(Signal signal = null, bool?receive_method = null, dynamic receive_param = null)
        {
            if (!Lang13.Bool(signal.data["tag"]) || signal.data["tag"] != this.id || signal.data["sigtype"] != "command")
            {
                return(false);
            }

            if (signal.data.Contains("power"))
            {
                this.on = String13.ParseNumber(signal.data["power"]);
            }

            if (signal.data.Contains("power_toggle"))
            {
                this.on = !Lang13.Bool(this.on) ?1:0;
            }

            if (signal.data.Contains("set_direction"))
            {
                this.pump_direction = String13.ParseNumber(signal.data["set_direction"]);
            }

            if (signal.data.Contains("checks"))
            {
                this.pressure_checks = String13.ParseNumber(signal.data["checks"]);
            }

            if (signal.data.Contains("purge"))
            {
                this.pressure_checks = ((int)(this.pressure_checks)) & (65534);
                this.pump_direction  = 0;
            }

            if (signal.data.Contains("stabalize"))
            {
                this.pressure_checks = ((int)(this.pressure_checks)) | (1);
                this.pump_direction  = 1;
            }

            if (signal.data.Contains("set_input_pressure"))
            {
                this.input_pressure_min = Num13.MaxInt(0, Num13.MinInt(((int)(String13.ParseNumber(signal.data["set_input_pressure"]) ?? 0)), ((int)(5066.25))));
            }

            if (signal.data.Contains("set_output_pressure"))
            {
                this.output_pressure_max = Num13.MaxInt(0, Num13.MinInt(((int)(String13.ParseNumber(signal.data["set_output_pressure"]) ?? 0)), ((int)(5066.25))));
            }

            if (signal.data.Contains("set_external_pressure"))
            {
                this.external_pressure_bound = Num13.MaxInt(0, Num13.MinInt(((int)(String13.ParseNumber(signal.data["set_external_pressure"]) ?? 0)), ((int)(5066.25))));
            }

            if (signal.data.Contains("status"))
            {
                Task13.Schedule(2, (Task13.Closure)(() => {
                    this.broadcast_status();
                    return;
                }));
                return(false);
            }
            Task13.Schedule(2, (Task13.Closure)(() => {
                this.broadcast_status();
                return;
            }));
            this.update_icon();
            return(false);
        }
Beispiel #17
0
        // Function from file: holder.dm
        public dynamic trans_to(dynamic target = null, dynamic amount = null, dynamic multiplier = null, bool?preserve_data = null)
        {
            amount        = amount ?? 1;
            multiplier    = multiplier ?? 1;
            preserve_data = preserve_data ?? true;

            dynamic R               = null;
            dynamic part            = null;
            dynamic trans_data      = null;
            dynamic reagent         = null;
            dynamic T               = null;
            dynamic H               = null;
            dynamic transfer_amount = null;


            if (!Lang13.Bool(target))
            {
                return(null);
            }

            if (target is Reagents)
            {
                R = target;
            }
            else
            {
                if (!Lang13.Bool(target.reagents) || (this.total_volume ?? 0) <= 0)
                {
                    return(null);
                }
                R = target.reagents;
            }
            amount     = Num13.MinInt(Num13.MinInt(Convert.ToInt32(amount), ((int)(this.total_volume ?? 0))), Convert.ToInt32(R.maximum_volume - R.total_volume));
            part       = amount / this.total_volume;
            trans_data = null;

            foreach (dynamic _a in Lang13.Enumerate(this.reagent_list))
            {
                reagent = _a;

                T = reagent;

                if (T.id == "blood" && target is Mob_Living_Carbon_Human)
                {
                    H = target;
                    ((Mob_Living_Carbon)H).inject_blood(this.my_atom, amount);
                    continue;
                }
                transfer_amount = T.volume * part;

                if (preserve_data == true)
                {
                    trans_data = this.copy_data(T);
                }
                ((Reagents)R).add_reagent(T.id, transfer_amount * multiplier, trans_data, this.chem_temp, true);
                this.remove_reagent(T.id, transfer_amount);
            }
            this.update_total();
            ((Reagents)R).update_total();
            ((Reagents)R).handle_reactions();
            this.handle_reactions();
            return(amount);
        }
Beispiel #18
0
        // Function from file: pizzabox.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            dynamic topbox = null;


            if (((Mob)a).get_inactive_hand() != this)
            {
                base.attack_hand((object)(a), b, c);
                return(null);
            }

            if (this.open)
            {
                if (Lang13.Bool(this.pizza))
                {
                    ((Mob)a).put_in_hands(this.pizza);
                    a.WriteMsg("<span class='notice'>You take " + this.pizza + " out of " + this + ".</span>");
                    this.pizza = null;
                    this.update_icon();
                    return(null);
                }
                else if (Lang13.Bool(this.bomb))
                {
                    if (Lang13.Bool(((Wires)this.wires).is_all_cut()) && Lang13.Bool(this.bomb_defused))
                    {
                        ((Mob)a).put_in_hands(this.bomb);
                        a.WriteMsg("<span class='notice'>You carefully remove the " + this.bomb + " from " + this + ".</span>");
                        this.bomb = null;
                        this.update_icon();
                        return(null);
                    }
                    else
                    {
                        this.bomb_timer   = Interface13.Input(a, "Set the " + this.bomb + " timer from " + GlobalVars.BOMB_TIMER_MIN + " to " + GlobalVars.BOMB_TIMER_MAX + ".", this.bomb, this.bomb_timer, null, InputType.Num);
                        this.bomb_timer   = Num13.MaxInt(GlobalVars.BOMB_TIMER_MIN ?1:0, Num13.MinInt(GlobalFuncs.Ceiling(this.bomb_timer / 2), GlobalVars.BOMB_TIMER_MAX));
                        this.bomb_defused = GlobalVars.FALSE;
                        GlobalFuncs.message_admins(new Txt().item(GlobalFuncs.key_name_admin(a)).str("<A HREF='?_src_=holder;adminmoreinfo=").Ref(a).str("'>?</A> (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(a).str("'>FLW</A>) has trapped a ").item(this).str(" with ").item(this.bomb).str(" set to ").item(this.bomb_timer * 2).str(" seconds.").ToString());
                        GlobalFuncs.log_game("" + GlobalFuncs.key_name(a) + " has trapped a " + this + " with " + this.bomb + " set to " + this.bomb_timer * 2 + " seconds.");
                        this.bomb.adminlog = "The " + this.bomb.name + " in " + this.name + " that " + GlobalFuncs.key_name(a) + " activated has detonated!";
                        a.WriteMsg("<span class='warning'>You trap " + this + " with " + this.bomb + ".</span>");
                        this.update_icon();
                    }
                    return(null);
                }
            }
            else if (this.boxes.len != 0)
            {
                topbox = this.boxes[this.boxes.len];
                this.boxes.Remove(topbox);
                ((Mob)a).put_in_hands(topbox);
                a.WriteMsg("<span class='notice'>You remove the topmost " + this.name + " from the stack.</span>");
                topbox.update_icon();
                this.update_icon();
                return(null);
            }
            base.attack_hand((object)(a), b, c);
            return(null);
        }
Beispiel #19
0
        // Function from file: chem_master.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string name = null;
            Obj_Item_Weapon_ReagentContainers P = null;
            dynamic R         = null;
            string  dat       = null;
            dynamic T         = null;
            Browser popup     = null;
            string  id        = null;
            double? amount    = null;
            dynamic id2       = null;
            dynamic amt_temp  = null;
            string  id3       = null;
            double? amount2   = null;
            dynamic id4       = null;
            dynamic amt_temp2 = null;
            int?    amount3   = null;
            int     vol_each  = 0;
            string  name2     = null;
            Obj_Item_Weapon_ReagentContainers_Pill P2 = null;
            int?   i     = null;
            string name3 = null;
            Obj_Item_Weapon_ReagentContainers_Food_Condiment_Pack P3 = null;
            int?   amount4   = null;
            int    vol_each2 = 0;
            string name4     = null;
            Obj_Item_Weapon_ReagentContainers_Pill_Patch P4 = null;
            int?i2 = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            Task13.User.set_machine(this);

            if (Lang13.Bool(href_list["ejectp"]))
            {
                if (Lang13.Bool(this.bottle))
                {
                    this.bottle.loc = this.loc;
                    this.bottle     = null;
                }
            }
            else if (Lang13.Bool(href_list["close"]))
            {
                Interface13.Browse(Task13.User, null, "window=chem_master");
                Task13.User.unset_machine();
                return(null);
            }
            else if (Lang13.Bool(href_list["toggle"]))
            {
                this.mode = !this.mode;
            }
            else if (Lang13.Bool(href_list["createbottle"]))
            {
                name = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your bottle!", (Lang13.Bool(this.reagents.total_volume) ? this.reagents.get_master_reagent_name() : " "), 26);

                if (!Lang13.Bool(name))
                {
                    return(null);
                }

                if (this.condi)
                {
                    P = new Obj_Item_Weapon_ReagentContainers_Food_Condiment(this.loc);
                }
                else
                {
                    P         = new Obj_Item_Weapon_ReagentContainers_Glass_Bottle(this.loc);
                    P.pixel_x = Rand13.Int(-7, 7);
                    P.pixel_y = Rand13.Int(-7, 7);
                }
                P.name = GlobalFuncs.trim("" + name + " bottle");
                this.reagents.trans_to(P, P.volume);
            }

            if (Lang13.Bool(this.beaker))
            {
                if (Lang13.Bool(href_list["analyze"]))
                {
                    if (Lang13.Bool(Lang13.FindObj(href_list["reagent"])))
                    {
                        R = Lang13.FindObj(href_list["reagent"]);

                        if (Lang13.Bool(R))
                        {
                            dat  = "";
                            dat += "<H1>" + (this.condi ? "Condiment" : "Chemical") + " information:</H1>";
                            dat += "<B>Name:</B> " + Lang13.Initial(R, "name") + "<BR><BR>";
                            dat += "<B>State:</B> ";

                            if (Lang13.Initial(R, "reagent_state") == 1)
                            {
                                dat += "Solid";
                            }
                            else if (Lang13.Initial(R, "reagent_state") == 2)
                            {
                                dat += "Liquid";
                            }
                            else if (Lang13.Initial(R, "reagent_state") == 3)
                            {
                                dat += "Gas";
                            }
                            else
                            {
                                dat += "Unknown";
                            }
                            dat  += "<BR>";
                            dat  += "<B>Color:</B> <span style='color:" + Lang13.Initial(R, "color") + ";background-color:" + Lang13.Initial(R, "color") + ";font:Lucida Console'>" + Lang13.Initial(R, "color") + "</span><BR><BR>";
                            dat  += "<B>Description:</B> " + Lang13.Initial(R, "description") + "<BR><BR>";
                            T     = Lang13.Initial(R, "metabolization_rate") * 20;
                            dat  += "<B>Metabolization Rate:</B> " + T + "u/minute<BR>";
                            dat  += "<B>Overdose Threshold:</B> " + (Lang13.Bool(Lang13.Initial(R, "overdose_threshold")) ? "" + Lang13.Initial(R, "overdose_threshold") + "u" : "none") + "<BR>";
                            dat  += "<B>Addiction Threshold:</B> " + (Lang13.Bool(Lang13.Initial(R, "addiction_threshold")) ? "" + Lang13.Initial(R, "addiction_threshold") + "u" : "none") + "<BR><BR>";
                            dat  += new Txt("<BR><A href='?src=").Ref(this).str(";main=1'>Back</A>").ToString();
                            popup = new Browser(Task13.User, "chem_master", this.name);
                            popup.set_content(dat);
                            popup.set_title_image(Task13.User.browse_rsc_icon(this.icon, this.icon_state));
                            popup.open(true);
                            return(null);
                        }
                    }
                }
                else if (Lang13.Bool(href_list["main"]))
                {
                    this.attack_hand(Task13.User);
                    return(null);
                }
                else if (Lang13.Bool(href_list["add"]))
                {
                    if (Lang13.Bool(href_list["amount"]))
                    {
                        id     = href_list["add"];
                        amount = String13.ParseNumber(href_list["amount"]);

                        if ((amount ?? 0) > 0)
                        {
                            ((Reagents)this.beaker.reagents).trans_id_to(this, id, amount);
                        }
                    }
                }
                else if (Lang13.Bool(href_list["addcustom"]))
                {
                    id2      = href_list["addcustom"];
                    amt_temp = this.isgoodnumber(Interface13.Input(Task13.User, "Select the amount to transfer.", "Transfer how much?", this.useramount, null, InputType.Num | InputType.Null));

                    if (!Lang13.Bool(amt_temp))
                    {
                        return(null);
                    }
                    this.useramount = amt_temp;
                    this.Topic(null, new ByTable().Set("amount", "" + this.useramount).Set("add", "" + id2));
                }
                else if (Lang13.Bool(href_list["remove"]))
                {
                    if (Lang13.Bool(href_list["amount"]))
                    {
                        id3     = href_list["remove"];
                        amount2 = String13.ParseNumber(href_list["amount"]);

                        if ((amount2 ?? 0) > 0)
                        {
                            if (this.mode)
                            {
                                this.reagents.trans_id_to(this.beaker, id3, amount2);
                            }
                            else
                            {
                                this.reagents.remove_reagent(id3, amount2);
                            }
                        }
                    }
                }
                else if (Lang13.Bool(href_list["removecustom"]))
                {
                    id4       = href_list["removecustom"];
                    amt_temp2 = this.isgoodnumber(Interface13.Input(Task13.User, "Select the amount to transfer.", "Transfer how much?", this.useramount, null, InputType.Num | InputType.Null));

                    if (!Lang13.Bool(amt_temp2))
                    {
                        return(null);
                    }
                    this.useramount = amt_temp2;
                    this.Topic(null, new ByTable().Set("amount", "" + this.useramount).Set("remove", "" + id4));
                }
                else if (Lang13.Bool(href_list["eject"]))
                {
                    if (Lang13.Bool(this.beaker))
                    {
                        this.beaker.loc = this.loc;
                        this.beaker     = null;
                        this.reagents.clear_reagents();
                        this.icon_state = "mixer0";
                    }
                }
                else if (Lang13.Bool(href_list["createpill"]))
                {
                    if (this.reagents.total_volume == 0)
                    {
                        return(null);
                    }

                    if (!this.condi)
                    {
                        amount3  = 1;
                        vol_each = Num13.MinInt(((int)(this.reagents.total_volume ?? 0)), 50);

                        if (Lang13.Bool(String13.ParseNumber(href_list["many"])))
                        {
                            amount3 = Num13.MinInt(Num13.MaxInt(Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Max 10. Buffer content will be split evenly.", "How many pills?", amount3, null, InputType.Num | InputType.Null))), 0), 10);

                            if (!Lang13.Bool(amount3))
                            {
                                return(null);
                            }
                            vol_each = Num13.MinInt(((int)((this.reagents.total_volume ?? 0) / (amount3 ?? 0))), 50);
                        }
                        name2 = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your pill!", "" + this.reagents.get_master_reagent_name() + " (" + vol_each + "u)", 26);

                        if (!Lang13.Bool(name2) || !Lang13.Bool(this.reagents.total_volume))
                        {
                            return(null);
                        }
                        i = null;
                        i = 0;

                        while ((i ?? 0) < (amount3 ?? 0))
                        {
                            if (Lang13.Bool(this.bottle) && this.bottle.contents.len < (this.bottle.storage_slots ?? 0))
                            {
                                P2 = new Obj_Item_Weapon_ReagentContainers_Pill(this.bottle);
                            }
                            else
                            {
                                P2 = new Obj_Item_Weapon_ReagentContainers_Pill(this.loc);
                            }
                            P2.name    = GlobalFuncs.trim("" + name2 + " pill");
                            P2.pixel_x = Rand13.Int(-7, 7);
                            P2.pixel_y = Rand13.Int(-7, 7);
                            this.reagents.trans_to(P2, vol_each);
                            i++;
                        }
                    }
                    else
                    {
                        name3 = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your pack!", this.reagents.get_master_reagent_name(), 26);

                        if (!Lang13.Bool(name3) || !Lang13.Bool(this.reagents.total_volume))
                        {
                            return(null);
                        }
                        P3 = new Obj_Item_Weapon_ReagentContainers_Food_Condiment_Pack(this.loc);
                        P3.originalname = name3;
                        P3.name         = GlobalFuncs.trim("" + name3 + " pack");
                        P3.desc         = "A small condiment pack. The label says it contains " + name3 + ".";
                        this.reagents.trans_to(P3, 10);
                    }
                }
                else if (Lang13.Bool(href_list["createpatch"]))
                {
                    if (this.reagents.total_volume == 0)
                    {
                        return(null);
                    }
                    amount4   = 1;
                    vol_each2 = Num13.MinInt(((int)(this.reagents.total_volume ?? 0)), 50);

                    if (Lang13.Bool(String13.ParseNumber(href_list["many"])))
                    {
                        amount4 = Num13.MinInt(Num13.MaxInt(Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Max 10. Buffer content will be split evenly.", "How many patches?", amount4, null, InputType.Num | InputType.Null))), 0), 10);

                        if (!Lang13.Bool(amount4))
                        {
                            return(null);
                        }
                        vol_each2 = Num13.MinInt(((int)((this.reagents.total_volume ?? 0) / (amount4 ?? 0))), 50);
                    }
                    name4 = GlobalFuncs.stripped_input(Task13.User, "Name:", "Name your patch!", "" + this.reagents.get_master_reagent_name() + " (" + vol_each2 + "u)", 26);

                    if (!Lang13.Bool(name4) || !Lang13.Bool(this.reagents.total_volume))
                    {
                        return(null);
                    }
                    P4 = null;
                    i2 = null;
                    i2 = 0;

                    while ((i2 ?? 0) < (amount4 ?? 0))
                    {
                        P4         = new Obj_Item_Weapon_ReagentContainers_Pill_Patch(this.loc);
                        P4.name    = GlobalFuncs.trim("" + name4 + " patch");
                        P4.pixel_x = Rand13.Int(-7, 7);
                        P4.pixel_y = Rand13.Int(-7, 7);
                        this.reagents.trans_to(P4, vol_each2);
                        i2++;
                    }
                }
            }
            this.updateUsrDialog();
            return(null);
        }
Beispiel #20
0
        // Function from file: spacevine.dm
        public override int?process(dynamic seconds = null)
        {
            int     length          = 0;
            int     i               = 0;
            ByTable queue_end       = null;
            Obj_Effect_Spacevine SV = null;
            SpacevineMutation    SM = null;


            if (!(this.vines != null))
            {
                GlobalFuncs.qdel(this);
                return(null);
            }

            if (!(this.growth_queue != null))
            {
                GlobalFuncs.qdel(this);
                return(null);
            }
            length    = 0;
            length    = Num13.MinInt(((int)(this.spread_cap)), Num13.MaxInt(1, ((int)(this.vines.len / this.spread_multiplier))));
            i         = 0;
            queue_end = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(this.growth_queue, typeof(Obj_Effect_Spacevine)))
            {
                SV = _b;


                if (Lang13.Bool(SV.gc_destroyed))
                {
                    continue;
                }
                i++;
                queue_end.Add(SV);
                this.growth_queue.Remove(SV);

                foreach (dynamic _a in Lang13.Enumerate(SV.mutations, typeof(SpacevineMutation)))
                {
                    SM = _a;

                    SM.process_mutation(SV);
                }

                if (SV.energy < 2)
                {
                    if (Rand13.PercentChance(20))
                    {
                        SV.grow();
                    }
                }
                else
                {
                    SV.entangle_mob();
                }
                SV.spread();

                if (i >= length)
                {
                    break;
                }
            }
            this.growth_queue = this.growth_queue + queue_end;
            return(null);
        }
        // Function from file: food_cart.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Obj O = null;
            Obj_Item_Weapon_ReagentContainers_Food_Drinks_Drinkingglass DG = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (Lang13.Bool(href_list["disposeI"]))
            {
                this.reagents.del_reagent(href_list["disposeI"]);
            }

            if (Lang13.Bool(href_list["dispense"]))
            {
                if (Convert.ToDouble(this.stored_food[href_list["dispense"]]--) <= 0)
                {
                    this.stored_food[href_list["dispense"]] = 0;
                }
                else
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.contents, typeof(Obj)))
                    {
                        O = _a;


                        if (GlobalFuncs.sanitize(O.name) == href_list["dispense"])
                        {
                            O.loc = this.loc;
                            break;
                        }
                    }
                }
            }

            if (Lang13.Bool(href_list["portion"]))
            {
                this.portion = Num13.MaxInt(0, Num13.MinInt(Convert.ToInt32(Interface13.Input("How much drink do you want to dispense per glass?", null, null, null, null, InputType.Num)), 50));
            }

            if (Lang13.Bool(href_list["pour"]) || Lang13.Bool(href_list["m_pour"]))
            {
                if (this.glasses-- <= 0)
                {
                    Task13.User.WriteMsg("<span class='warning'>There are no glasses left!</span>");
                    this.glasses = 0;
                }
                else
                {
                    DG = new Obj_Item_Weapon_ReagentContainers_Food_Drinks_Drinkingglass(this.loc);

                    if (Lang13.Bool(href_list["pour"]))
                    {
                        this.reagents.trans_id_to(DG, href_list["pour"], this.portion);
                    }

                    if (Lang13.Bool(href_list["m_pour"]))
                    {
                        this.mixer.reagents.trans_id_to(DG, href_list["m_pour"], this.portion);
                    }
                }
            }

            if (Lang13.Bool(href_list["mix"]))
            {
                if (this.reagents.trans_id_to(this.mixer, href_list["mix"], this.portion) == 0)
                {
                    Task13.User.WriteMsg("<span class='warning'>The " + this.mixer + " is full!</span>");
                }
            }

            if (Lang13.Bool(href_list["transfer"]))
            {
                if (this.mixer.reagents.trans_id_to(this, href_list["transfer"], this.portion) == 0)
                {
                    Task13.User.WriteMsg("<span class='warning'>The " + this + " is full!</span>");
                }
            }
            this.updateDialog();

            if (Lang13.Bool(href_list["close"]))
            {
                Task13.User.unset_machine();
                Interface13.Browse(Task13.User, null, "window=foodcart");
            }
            return(null);
        }
        // Function from file: dna_console.dm
        public void apply_buffer(int action = 0, double?buffer_num = null)
        {
            dynamic buffer_slot     = null;
            Mob     viable_occupant = null;

            buffer_num      = Num13.MaxInt(1, Num13.MinInt(((int)(buffer_num ?? 0)), 3));
            buffer_slot     = this.buffer[buffer_num];
            viable_occupant = this.get_viable_occupant();

            if (buffer_slot is ByTable)
            {
                viable_occupant.radiation += Rand13.Int(((int)(10 / Math.Pow(Convert.ToDouble(this.connected.damage_coeff), 2))), ((int)(25 / Math.Pow(Convert.ToDouble(this.connected.damage_coeff), 2))));

                switch ((int)(action))
                {
                case 1:

                    if (Lang13.Bool(buffer_slot["SE"]))
                    {
                        ((dynamic)viable_occupant).dna.struc_enzymes = buffer_slot["SE"];
                        viable_occupant.domutcheck();
                    }
                    break;

                case 2:

                    if (Lang13.Bool(buffer_slot["UI"]))
                    {
                        ((dynamic)viable_occupant).dna.uni_identity = buffer_slot["UI"];
                        new ByTable().Set("mutations_overlay_update", 1).Apply(Lang13.BindFunc(viable_occupant, "updateappearance"));
                    }
                    break;

                case 3:

                    if (Lang13.Bool(buffer_slot["name"]) && Lang13.Bool(buffer_slot["UE"]) && Lang13.Bool(buffer_slot["blood_type"]))
                    {
                        viable_occupant.real_name = buffer_slot["name"];
                        viable_occupant.name      = buffer_slot["name"];
                        ((dynamic)viable_occupant).dna.unique_enzymes = buffer_slot["UE"];
                        ((dynamic)viable_occupant).dna.blood_type     = buffer_slot["blood_type"];
                    }
                    break;

                case 4:

                    if (Lang13.Bool(buffer_slot["UI"]))
                    {
                        ((dynamic)viable_occupant).dna.uni_identity = buffer_slot["UI"];
                        new ByTable().Set("mutations_overlay_update", 1).Apply(Lang13.BindFunc(viable_occupant, "updateappearance"));
                    }

                    if (Lang13.Bool(buffer_slot["name"]) && Lang13.Bool(buffer_slot["UE"]) && Lang13.Bool(buffer_slot["blood_type"]))
                    {
                        viable_occupant.real_name = buffer_slot["name"];
                        viable_occupant.name      = buffer_slot["name"];
                        ((dynamic)viable_occupant).dna.unique_enzymes = buffer_slot["UE"];
                        ((dynamic)viable_occupant).dna.blood_type     = buffer_slot["blood_type"];
                    }
                    break;
                }
            }
            return;
        }
Beispiel #23
0
 // Function from file: robot_modules.dm
 public void add_charge(double amount = 0)
 {
     this.energy = Num13.MinInt(((int)(this.energy + amount)), this.max_energy);
     return;
 }
        // Function from file: dna_console.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Mob     viable_occupant             = null;
            double? num                         = null;
            string  last_change                 = null;
            bool    epinephrine_amount          = false;
            int     can_add                     = 0;
            string  text                        = null;
            dynamic buffer_slot                 = null;
            ByTable buffer_slot2                = null;
            dynamic buffer_slot3                = null;
            Obj_Item_Weapon_Dnainjector_Timed I = null;
            Mutation_Human HM                   = null;
            int?           time_coeff           = null;
            Mutation_Human HM2                  = null;
            dynamic        buffer_slot4         = null;
            dynamic        locked_state         = null;
            int            len                  = 0;
            int            block                = 0;
            double         subblock             = 0;
            string         hex                  = null;
            int            len2                 = 0;
            int            block2               = 0;
            double         subblock2            = 0;
            string         hex2                 = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (!(Task13.User.loc is Tile))
            {
                return(null);
            }

            if (!(this.loc is Tile && Map13.GetDistance(this, Task13.User) <= 1 || Task13.User is Mob_Living_Silicon))
            {
                return(null);
            }

            if (this.current_screen == "working")
            {
                return(null);
            }
            this.add_fingerprint(Task13.User);
            Task13.User.set_machine(this);
            viable_occupant = this.get_viable_occupant();
            num             = Num13.Floor(String13.ParseNumber(href_list["num"]) ?? 0);

            dynamic _f = href_list["task"];             // Was a switch-case, sorry for the mess.

            if (_f == "togglelock")
            {
                if (Lang13.Bool(this.connected))
                {
                    this.connected.locked = !Lang13.Bool(this.connected.locked);
                }
            }
            else if (_f == "toggleopen")
            {
                if (Lang13.Bool(this.connected))
                {
                    ((Obj_Machinery_DnaScannernew)this.connected).toggle_open(Task13.User);
                }
            }
            else if (_f == "setduration")
            {
                if (!Lang13.Bool(num))
                {
                    num = Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Choose pulse duration:", "Input an Integer", null, null, InputType.Num | InputType.Null)));
                }

                if (Lang13.Bool(num))
                {
                    this.radduration = GlobalFuncs.Wrap(num, true, 31);
                }
            }
            else if (_f == "setstrength")
            {
                if (!Lang13.Bool(num))
                {
                    num = Num13.Floor(Convert.ToDouble(Interface13.Input(Task13.User, "Choose pulse strength:", "Input an Integer", null, null, InputType.Num | InputType.Null)));
                }

                if (Lang13.Bool(num))
                {
                    this.radstrength = GlobalFuncs.Wrap(num, true, 16);
                }
            }
            else if (_f == "screen")
            {
                this.current_screen = href_list["text"];
            }
            else if (_f == "rejuv")
            {
                if (viable_occupant != null && viable_occupant.reagents != null)
                {
                    epinephrine_amount = viable_occupant.reagents.get_reagent_amount("epinephrine");
                    can_add            = Num13.MaxInt(Num13.MinInt(90 - (epinephrine_amount ?1:0), 15), 0);
                    viable_occupant.reagents.add_reagent("epinephrine", can_add);
                }
            }
            else if (_f == "setbufferlabel")
            {
                text = GlobalFuncs.sanitize(Interface13.Input(Task13.User, "Input a new label:", "Input an Text", null, null, InputType.Str | InputType.Null));

                if (Lang13.Bool(num) && Lang13.Bool(text))
                {
                    num         = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot = this.buffer[num];

                    if (buffer_slot is ByTable)
                    {
                        buffer_slot["label"] = text;
                    }
                }
            }
            else if (_f == "setbuffer")
            {
                if (Lang13.Bool(num) && viable_occupant != null)
                {
                    num = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    this.buffer[num] = new ByTable()
                                       .Set("label", "Buffer" + num + ":" + viable_occupant.real_name)
                                       .Set("UI", ((dynamic)viable_occupant).dna.uni_identity)
                                       .Set("SE", ((dynamic)viable_occupant).dna.struc_enzymes)
                                       .Set("UE", ((dynamic)viable_occupant).dna.unique_enzymes)
                                       .Set("name", viable_occupant.real_name)
                                       .Set("blood_type", ((dynamic)viable_occupant).dna.blood_type)
                    ;
                }
            }
            else if (_f == "clearbuffer")
            {
                if (Lang13.Bool(num))
                {
                    num          = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot2 = this.buffer[num];

                    if (buffer_slot2 is ByTable)
                    {
                        buffer_slot2.Cut();
                    }
                }
            }
            else if (_f == "transferbuffer")
            {
                if (Lang13.Bool(num) && viable_occupant != null)
                {
                    dynamic _a = href_list["text"];                     // Was a switch-case, sorry for the mess.
                    if (_a == "se")
                    {
                        this.apply_buffer(1, num);
                    }
                    else if (_a == "ui")
                    {
                        this.apply_buffer(2, num);
                    }
                    else if (_a == "ue")
                    {
                        this.apply_buffer(3, num);
                    }
                    else if (_a == "mixed")
                    {
                        this.apply_buffer(4, num);
                    }
                }
            }
            else if (_f == "injector")
            {
                if (Lang13.Bool(num) && this.injectorready)
                {
                    num          = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot3 = this.buffer[num];

                    if (buffer_slot3 is ByTable)
                    {
                        I = null;

                        dynamic _d = href_list["text"];                         // Was a switch-case, sorry for the mess.
                        if (_d == "se")
                        {
                            if (Lang13.Bool(buffer_slot3["SE"]))
                            {
                                I = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);

                                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.good_mutations + GlobalVars.bad_mutations + GlobalVars.not_good_mutations, typeof(Mutation_Human)))
                                {
                                    HM = _b;


                                    if (HM.check_block_string(buffer_slot3["SE"]))
                                    {
                                        I.add_mutations.Add(HM);
                                    }
                                    else
                                    {
                                        I.remove_mutations.Add(HM);
                                    }
                                }
                                time_coeff = null;

                                foreach (dynamic _c in Lang13.Enumerate(I.add_mutations, typeof(Mutation_Human)))
                                {
                                    HM2 = _c;


                                    if (!Lang13.Bool(time_coeff))
                                    {
                                        time_coeff = HM2.time_coeff;
                                        continue;
                                    }
                                    time_coeff = Num13.MinInt(time_coeff ?? 0, HM2.time_coeff);
                                }

                                if (Lang13.Bool(this.connected))
                                {
                                    I.duration     = I.duration * (time_coeff ?? 0) * Convert.ToDouble(this.connected.damage_coeff);
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }
                        else if (_d == "ui")
                        {
                            if (Lang13.Bool(buffer_slot3["UI"]))
                            {
                                I        = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);
                                I.fields = new ByTable().Set("UI", buffer_slot3["UI"]);

                                if (Lang13.Bool(this.connected))
                                {
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }
                        else if (_d == "ue")
                        {
                            if (Lang13.Bool(buffer_slot3["name"]) && Lang13.Bool(buffer_slot3["UE"]) && Lang13.Bool(buffer_slot3["blood_type"]))
                            {
                                I        = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);
                                I.fields = new ByTable().Set("name", buffer_slot3["name"]).Set("UE", buffer_slot3["UE"]).Set("blood_type", buffer_slot3["blood_type"]);

                                if (Lang13.Bool(this.connected))
                                {
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }
                        else if (_d == "mixed")
                        {
                            if (Lang13.Bool(buffer_slot3["UI"]) && Lang13.Bool(buffer_slot3["name"]) && Lang13.Bool(buffer_slot3["UE"]) && Lang13.Bool(buffer_slot3["blood_type"]))
                            {
                                I        = new Obj_Item_Weapon_Dnainjector_Timed(this.loc);
                                I.fields = new ByTable().Set("UI", buffer_slot3["UI"]).Set("name", buffer_slot3["name"]).Set("UE", buffer_slot3["UE"]).Set("blood_type", buffer_slot3["blood_type"]);

                                if (Lang13.Bool(this.connected))
                                {
                                    I.damage_coeff = Convert.ToDouble(this.connected.damage_coeff);
                                }
                            }
                        }

                        if (I != null)
                        {
                            this.injectorready = false;
                            Task13.Schedule(100, (Task13.Closure)(() => {
                                this.injectorready = true;
                                return;
                            }));
                        }
                    }
                }
            }
            else if (_f == "loaddisk")
            {
                if (Lang13.Bool(num) && Lang13.Bool(this.diskette) && Lang13.Bool(this.diskette.fields))
                {
                    num = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    this.buffer[num] = this.diskette.fields.Copy();
                }
            }
            else if (_f == "savedisk")
            {
                if (Lang13.Bool(num) && Lang13.Bool(this.diskette) && !this.diskette.read_only)
                {
                    num          = Num13.MaxInt(1, Num13.MinInt(((int)(num ?? 0)), 3));
                    buffer_slot4 = this.buffer[num];

                    if (buffer_slot4 is ByTable)
                    {
                        this.diskette.name   = "data disk [" + buffer_slot4["label"] + "]";
                        this.diskette.fields = buffer_slot4.Copy();
                    }
                }
            }
            else if (_f == "ejectdisk")
            {
                if (Lang13.Bool(this.diskette))
                {
                    this.diskette.loc = GlobalFuncs.get_turf(this);
                    this.diskette     = null;
                }
            }
            else if (_f == "setdelayed")
            {
                if (Lang13.Bool(num))
                {
                    this.delayed_action = new ByTable().Set("action", String13.ParseNumber(href_list["delayaction"])).Set("buffer", num);
                }
            }
            else if (_f == "pulseui" || _f == "pulsese")
            {
                if (Lang13.Bool(num) && viable_occupant != null && Lang13.Bool(this.connected))
                {
                    this.radduration      = GlobalFuncs.Wrap(this.radduration, true, 31);
                    this.radstrength      = GlobalFuncs.Wrap(this.radstrength, true, 16);
                    locked_state          = this.connected.locked;
                    this.connected.locked = 1;
                    this.current_screen   = "working";
                    this.ShowInterface(Task13.User);
                    Task13.Sleep(((int)((this.radduration ?? 0) * 10)));
                    this.current_screen = "mainmenu";

                    if (viable_occupant != null && Lang13.Bool(this.connected) && this.connected.occupant == viable_occupant)
                    {
                        viable_occupant.radiation += (this.radduration ?? 0) * (this.radstrength ?? 0) * 0.2 / Math.Pow(Convert.ToDouble(this.connected.damage_coeff), 2);

                        dynamic _e = href_list["task"];                         // Was a switch-case, sorry for the mess.
                        if (_e == "pulseui")
                        {
                            len          = Lang13.Length(((dynamic)viable_occupant).dna.uni_identity);
                            num          = GlobalFuncs.Wrap(num, true, len + 1);
                            num          = this.randomize_radiation_accuracy(num, (this.radduration ?? 0) + Math.Pow(Convert.ToDouble(this.connected.precision_coeff), 2), len);
                            block        = Num13.Floor(((num ?? 0) - 1) / 3) + 1;
                            subblock     = (num ?? 0) - block * 3;
                            last_change  = "UI #" + block + "-" + subblock + "; ";
                            hex          = String13.SubStr(((dynamic)viable_occupant).dna.uni_identity, ((int)(num ?? 0)), ((int)((num ?? 0) + 1)));
                            last_change += "" + hex;
                            hex          = this.scramble(hex, this.radstrength, this.radduration);
                            last_change += "->" + hex;
                            ((dynamic)viable_occupant).dna.uni_identity = String13.SubStr(((dynamic)viable_occupant).dna.uni_identity, 1, ((int)(num ?? 0))) + hex + String13.SubStr(((dynamic)viable_occupant).dna.uni_identity, ((int)((num ?? 0) + 1)), 0);
                            new ByTable().Set("mutations_overlay_update", 1).Apply(Lang13.BindFunc(viable_occupant, "updateappearance"));
                        }
                        else if (_e == "pulsese")
                        {
                            len2         = Lang13.Length(((dynamic)viable_occupant).dna.struc_enzymes);
                            num          = GlobalFuncs.Wrap(num, true, len2 + 1);
                            num          = this.randomize_radiation_accuracy(num, (this.radduration ?? 0) + Math.Pow(Convert.ToDouble(this.connected.precision_coeff), 2), len2);
                            block2       = Num13.Floor(((num ?? 0) - 1) / 3) + 1;
                            subblock2    = (num ?? 0) - block2 * 3;
                            last_change  = "SE #" + block2 + "-" + subblock2 + "; ";
                            hex2         = String13.SubStr(((dynamic)viable_occupant).dna.struc_enzymes, ((int)(num ?? 0)), ((int)((num ?? 0) + 1)));
                            last_change += "" + hex2;
                            hex2         = this.scramble(hex2, this.radstrength, this.radduration);
                            last_change += "->" + hex2;
                            ((dynamic)viable_occupant).dna.struc_enzymes = String13.SubStr(((dynamic)viable_occupant).dna.struc_enzymes, 1, ((int)(num ?? 0))) + hex2 + String13.SubStr(((dynamic)viable_occupant).dna.struc_enzymes, ((int)((num ?? 0) + 1)), 0);
                            viable_occupant.domutcheck();
                        }
                    }
                    else
                    {
                        this.current_screen = "mainmenu";
                    }

                    if (Lang13.Bool(this.connected))
                    {
                        this.connected.locked = locked_state;
                    }
                }
            }
            this.ShowInterface(Task13.User, last_change);
            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);
        }
Beispiel #26
0
        // Function from file: effects_other.dm
        public override void start(  )
        {
            EffectSystem_SparkSpread s = null;
            dynamic M           = null;
            double  devastation = 0;
            double  heavy       = 0;
            double  light       = 0;
            double  flash       = 0;


            if (this.explosion_message == true)
            {
                ((Ent_Static)this.location).visible_message("<span class='danger'>The solution violently explodes!</span>", "<span class='italics'>You hear an explosion!</span>");
            }

            if (Convert.ToDouble(this.amount) <= 2)
            {
                s = new EffectSystem_SparkSpread();
                s.set_up(2, 1, this.location);
                s.start();

                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchViewers(this.location, 1)))
                {
                    M = _a;


                    if (Rand13.PercentChance(Convert.ToInt32(this.amount * 50)))
                    {
                        M.WriteMsg("<span class='danger'>The explosion knocks you down.</span>");
                        ((Mob)M).Weaken(Rand13.Int(1, 5));
                    }
                }
                return;
            }
            else
            {
                devastation = -1;
                heavy       = -1;
                light       = -1;
                flash       = -1;

                if (Num13.Floor(Convert.ToDouble(this.amount / 12)) > 0)
                {
                    devastation = Num13.MinInt(GlobalVars.MAX_EX_DEVESTATION_RANGE, ((int)(devastation + Num13.Floor(Convert.ToDouble(this.amount / 12)))));
                }

                if (Num13.Floor(Convert.ToDouble(this.amount / 6)) > 0)
                {
                    heavy = Num13.MinInt(GlobalVars.MAX_EX_HEAVY_RANGE, ((int)(heavy + Num13.Floor(Convert.ToDouble(this.amount / 6)))));
                }

                if (Num13.Floor(Convert.ToDouble(this.amount / 3)) > 0)
                {
                    light = Num13.MinInt(Convert.ToInt32(GlobalVars.MAX_EX_LIGHT_RANGE), ((int)(light + Num13.Floor(Convert.ToDouble(this.amount / 3)))));
                }

                if (Lang13.Bool(this.flashing) && Lang13.Bool(this.flashing_factor))
                {
                    flash += Num13.Floor(Convert.ToDouble(this.amount / 4)) * Convert.ToDouble(this.flashing_factor);
                }
                GlobalFuncs.explosion(this.location, devastation, heavy, light, flash);
            }
            return;
        }
Beispiel #27
0
        // Function from file: customizables.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic _default = null;

            dynamic S   = null;
            string  txt = null;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks_Customizable S2 = null;


            if (A is Obj_Item_Weapon_ReagentContainers_Food_Snacks)
            {
                S = A;

                if (Convert.ToDouble(A.w_class) > 2)
                {
                    user.WriteMsg("<span class='warning'>The ingredient is too big for " + this + "!</span>");
                }
                else if (this.ingredients.len >= this.ingMax || (this.reagents.total_volume ?? 0) >= (this.volume ?? 0))
                {
                    user.WriteMsg("<span class='warning'>You can't add more ingredients to " + this + "!</span>");
                }
                else
                {
                    if (!((Mob)user).unEquip(A))
                    {
                        return(_default);
                    }

                    if (S.trash != null)
                    {
                        Lang13.Call(S.trash, GlobalFuncs.get_turf(user));
                        S.trash = null;
                    }
                    this.ingredients.Add(S);
                    S.loc = this;
                    this.mix_filling_color(S);
                    ((Reagents)S.reagents).trans_to(this, Num13.MinInt(((int)(S.reagents.total_volume ?? 0)), 15));
                    this.update_overlays(S);
                    user.WriteMsg("<span class='notice'>You add the " + A.name + " to the " + this.name + ".</span>");
                    this.update_name(S);
                }
            }
            else if (A is Obj_Item_Weapon_Pen)
            {
                txt = GlobalFuncs.stripped_input(user, "What would you like the food to be called?", "Food Naming", "", 30);

                if (Lang13.Bool(txt))
                {
                    this.ingMax = this.ingredients.len;
                    user.WriteMsg("<span class='notice'>You add a last touch to the dish by renaming it.</span>");
                    this.customname = txt;

                    if (this is Obj_Item_Weapon_ReagentContainers_Food_Snacks_Customizable_Sandwich)
                    {
                        S2 = this;

                        if (Lang13.Bool(((dynamic)S2).finished))
                        {
                            this.name = "" + this.customname + " sandwich";
                            return(_default);
                        }
                    }
                    this.name = "" + this.customname + " " + Lang13.Initial(this, "name");
                }
            }
            else
            {
                _default = base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            return(_default);
        }
Beispiel #28
0
        // Function from file: other_reagents.dm
        public override double reaction_mob(dynamic M = null, int?method = null, double?reac_volume = null, bool?show_message = null, dynamic touch_protection = null, Mob_Camera_Blob O = null)
        {
            method           = method ?? GlobalVars.TOUCH;
            show_message     = show_message ?? true;
            touch_protection = touch_protection ?? 0;


            if (method == GlobalVars.PATCH || method == GlobalVars.INGEST || method == GlobalVars.INJECT || method == GlobalVars.VAPOR && Rand13.PercentChance(((int)(Num13.MinInt(((int)(reac_volume ?? 0)), 100) * (1 - Convert.ToDouble(touch_protection))))))
            {
                ((Mob)M).ForceContractDisease(new Disease_Transformation_Robot(/* Pruned args, no ctor exists. */));
            }
            return(0);
        }
        // Function from file: mech_fabricator.dm
        public double remove_material(dynamic mat_string = null, double?amount = null)
        {
            Type    type         = null;
            double  result       = 0;
            int     total_amount = 0;
            dynamic res          = null;


            if (Convert.ToDouble(this.resources[mat_string]) < 2000)
            {
                return(-1);
            }

            dynamic _a = mat_string;             // Was a switch-case, sorry for the mess.

            if (_a == "$metal")
            {
                type = typeof(Obj_Item_Stack_Sheet_Metal);
            }
            else if (_a == "$glass")
            {
                type = typeof(Obj_Item_Stack_Sheet_Glass);
            }
            else if (_a == "$gold")
            {
                type = typeof(Obj_Item_Stack_Sheet_Mineral_Gold);
            }
            else if (_a == "$silver")
            {
                type = typeof(Obj_Item_Stack_Sheet_Mineral_Silver);
            }
            else if (_a == "$diamond")
            {
                type = typeof(Obj_Item_Stack_Sheet_Mineral_Diamond);
            }
            else if (_a == "$plasma")
            {
                type = typeof(Obj_Item_Stack_Sheet_Mineral_Plasma);
            }
            else if (_a == "$uranium")
            {
                type = typeof(Obj_Item_Stack_Sheet_Mineral_Uranium);
            }
            else if (_a == "$bananium")
            {
                type = typeof(Obj_Item_Stack_Sheet_Mineral_Bananium);
            }
            else
            {
                return(0);
            }
            result = 0;

            while ((amount ?? 0) > 50)
            {
                Lang13.Call(type, GlobalFuncs.get_turf(this), 50);
                amount -= 50;
                result += 50;
                this.resources[mat_string] -= 100000;
            }
            total_amount = Num13.Floor(Convert.ToDouble(this.resources[mat_string] / 2000));

            if (total_amount != 0)
            {
                res = Lang13.Call(type, GlobalFuncs.get_turf(this), Num13.MinInt(((int)(amount ?? 0)), total_amount));
                this.resources[mat_string] -= res.amount * 2000;
                result += Convert.ToDouble(res.amount);
            }
            return(result);
        }
Beispiel #30
0
        // Function from file: watercloset.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic RG        = null;
            dynamic B         = null;
            double  stunforce = 0;
            dynamic I         = null;


            if (this.busy)
            {
                user.WriteMsg("<span class='warning'>Someone's already washing here!</span>");
                return(null);
            }

            if (A is Obj_Item_Weapon_ReagentContainers)
            {
                RG = A;

                if (Lang13.Bool(RG.flags & 4096))
                {
                    RG.reagents.add_reagent("water", Num13.MinInt(Convert.ToInt32(RG.volume - RG.reagents.total_volume), Convert.ToInt32(RG.amount_per_transfer_from_this)));
                    user.WriteMsg("<span class='notice'>You fill " + RG + " from " + this + ".</span>");
                    return(null);
                }
            }

            if (A is Obj_Item_Weapon_Melee_Baton)
            {
                B = A;

                if (Lang13.Bool(B.bcell))
                {
                    if (Convert.ToDouble(B.bcell.charge) > 0 && Lang13.Bool(B.status) == true)
                    {
                        Icon13.Flick("baton_active", this);
                        stunforce = B.stunforce;
                        ((Mob)user).Stun(stunforce);
                        ((Mob)user).Weaken(stunforce);
                        user.stuttering = stunforce;
                        B.deductcharge(B.hitcost);
                        ((Ent_Static)user).visible_message("<span class='warning'>" + user + " shocks themself while attempting to wash the active " + B.name + "!</span>", "<span class='userdanger'>You unwisely attempt to wash " + B + " while it's still on.</span>");
                        GlobalFuncs.playsound(this, "sparks", 50, 1);
                        return(null);
                    }
                }
            }

            if (A is Obj_Item_Weapon_Mop)
            {
                A.reagents.add_reagent("water", 5);
                user.WriteMsg("<span class='notice'>You wet " + A + " in " + this + ".</span>");
                GlobalFuncs.playsound(this.loc, "sound/effects/slosh.ogg", 25, 1);
            }
            I = A;

            if (!Lang13.Bool(I) || !(I is Obj_Item))
            {
                return(null);
            }

            if (Lang13.Bool(I.flags & 128))
            {
                return(null);
            }
            user.WriteMsg("<span class='notice'>You start washing " + I + "...</span>");
            this.busy = true;

            if (!GlobalFuncs.do_after(user, 40, null, this))
            {
                this.busy = false;
                return(null);
            }
            this.busy = false;
            ((Ent_Static)A).clean_blood();
            ((Ent_Static)user).visible_message("<span class='notice'>" + user + " washes " + I + " using " + this + ".</span>", "<span class='notice'>You wash " + I + " using " + this + ".</span>");
            return(null);
        }