Ejemplo n.º 1
0
        // Function from file: juicer.dm
        public void juice(  )
        {
            Obj_Item_Weapon_ReagentContainers_Food_Snacks O = null;
            dynamic r_id = null;

            this.power_change();

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

            if (!Lang13.Bool(this.beaker) || (this.beaker.reagents.total_volume ?? 0) >= Convert.ToDouble(this.beaker.reagents.maximum_volume))
            {
                return;
            }
            GlobalFuncs.playsound(this.loc, "sound/machines/juicer.ogg", 50, 1);

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

                r_id = this.get_juice_id(O);
                this.beaker.reagents.add_reagent(r_id, this.get_juice_amount(O));
                GlobalFuncs.qdel(O);

                if ((this.beaker.reagents.total_volume ?? 0) >= Convert.ToDouble(this.beaker.reagents.maximum_volume))
                {
                    break;
                }
            }
            return;
        }
Ejemplo n.º 2
0
        // Function from file: customizables.dm
        public override double examine(dynamic user = null)
        {
            string ingredients_listed = null;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks ING = null;
            string size = null;

            base.examine((object)(user));
            ingredients_listed = "";

            foreach (dynamic _a in Lang13.Enumerate(this.ingredients, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
            {
                ING = _a;

                ingredients_listed += "" + ING.name + ", ";
            }
            size = "standard";

            if (this.ingredients.len < 2)
            {
                size = "small";
            }

            if (this.ingredients.len > 5)
            {
                size = "big";
            }

            if (this.ingredients.len > 8)
            {
                size = "monster";
            }
            user.WriteMsg("It contains " + (this.ingredients.len != 0 ? "" + ingredients_listed : "no ingredient, ") + "making a " + size + "-sized " + Lang13.Initial(this, "name") + ".");
            return(0);
        }
Ejemplo n.º 3
0
        // Function from file: smartfridge.dm
        public bool rack_dry(  )
        {
            Obj_Item_Weapon_ReagentContainers_Food_Snacks S = null;
            dynamic dried = null;


            foreach (dynamic _a in Lang13.Enumerate(this.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
            {
                S = _a;


                if (S.dried_type == S.type)
                {
                    S.color = "#ad7257";
                    S.dry   = true;
                    S.loc   = GlobalFuncs.get_turf(this);
                }
                else
                {
                    dried = S.dried_type;
                    Lang13.Call(dried, this.loc);
                    GlobalFuncs.qdel(S);
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
		// Function from file: reagentgrinder.dm
		public void juice(  ) {
			int offset = 0;
			Obj_Item_Weapon_ReagentContainers_Food_Snacks O = null;
			dynamic allowed = null;
			dynamic r_id = null;
			dynamic space = null;
			int amount = 0;

			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/juicer.ogg", 20, 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( 50, (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_juice_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 = this.get_juice_amount( O );
					this.beaker.reagents.add_reagent( r_id, Num13.MinInt( amount, Convert.ToInt32( space ) ) );

					if ( ( this.beaker.reagents.total_volume ??0) >= Convert.ToDouble( this.beaker.reagents.maximum_volume ) ) {
						break;
					}
				}
				this.remove_object( O );
			}
			return;
		}
Ejemplo n.º 5
0
		// Function from file: reagentgrinder.dm
		public int get_juice_amount( Obj_Item_Weapon_ReagentContainers_Food_Snacks O = null ) {
			
			if ( !( O is Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown ) ) {
				return 5;
			} else if ( O.potency == -1 ) {
				return 5;
			} else {
				return Num13.Floor( Math.Sqrt( O.potency ??0 ) * 5 );
			}
			return 0;
		}
Ejemplo n.º 6
0
		// Function from file: reagentgrinder.dm
		public dynamic get_allowed_snack_by_id( Obj_Item_Weapon_ReagentContainers_Food_Snacks O = null ) {
			dynamic i = null;

			
			foreach (dynamic _a in Lang13.Enumerate( this.blend_items )) {
				i = _a;
				

				if ( Lang13.Bool( i.IsInstanceOfType( O ) ) ) {
					return this.blend_items[i];
				}
			}
			return null;
		}
Ejemplo n.º 7
0
        // Function from file: vending.dm
        public override dynamic Destroy(  )
        {
            Obj_Item_Weapon_ReagentContainers_Food_Snacks S = null;


            foreach (dynamic _a in Lang13.Enumerate(this.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
            {
                S = _a;

                S.loc = GlobalFuncs.get_turf(this);
            }
            GlobalFuncs.qdel(this.wires);
            this.wires = null;
            return(base.Destroy());
        }
Ejemplo n.º 8
0
        // Function from file: juicer.dm
        public dynamic get_juice_id(Obj_Item_Weapon_ReagentContainers_Food_Snacks O = null)
        {
            dynamic i = null;


            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.allowed_items))
            {
                i = _a;


                if (Lang13.Bool(i.IsInstanceOfType(O)))
                {
                    return(GlobalVars.allowed_items[i]);
                }
            }
            return(null);
        }
Ejemplo n.º 9
0
        // Function from file: microwave.dm
        public void muck_finish(  )
        {
            Obj_Item_Weapon_ReagentContainers_Food_Snacks S = null;

            GlobalFuncs.playsound(this.loc, "sound/machines/ding.ogg", 50, 1);
            this.visible_message("<span class='warning'>The microwave gets covered in muck!</span>");
            this.dirty      = 100;
            this.icon_state = "mwbloody";
            this.operating  = false;
            this.updateUsrDialog();

            foreach (dynamic _a in Lang13.Enumerate(this, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
            {
                S = _a;


                if (Rand13.PercentChance(50))
                {
                    new Obj_Item_Weapon_ReagentContainers_Food_Snacks_Badrecipe(this);
                    GlobalFuncs.qdel(S);
                }
            }
            return;
        }
Ejemplo n.º 10
0
        // Function from file: microwave.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic clean_spray = null;
            dynamic P           = null;
            dynamic T           = null;
            int     loaded      = 0;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks S = null;


            if (this.operating)
            {
                return(null);
            }

            if (!(this.broken != 0) && this.dirty < 100)
            {
                if (this.default_deconstruction_screwdriver(user, "mw-o", "mw", A))
                {
                    return(null);
                }

                if (this.default_unfasten_wrench(user, A))
                {
                    return(null);
                }

                if (this.exchange_parts(user, A))
                {
                    return(null);
                }
            }

            if (this.default_deconstruction_crowbar(A))
            {
                return(null);
            }

            if (this.broken > 0)
            {
                if (this.broken == 2 && A is Obj_Item_Weapon_Wirecutters)
                {
                    ((Ent_Static)user).visible_message("" + user + " starts to fix part of the microwave.", "<span class='notice'>You start to fix part of the microwave...</span>");

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        ((Ent_Static)user).visible_message("" + user + " fixes part of the microwave.", "<span class='notice'>You fix part of the microwave.</span>");
                        this.broken = 1;
                    }
                }
                else if (this.broken == 1 && A is Obj_Item_Weapon_Weldingtool)
                {
                    ((Ent_Static)user).visible_message("" + user + " starts to fix part of the microwave.", "<span class='notice'>You start to fix part of the microwave...</span>");

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        ((Ent_Static)user).visible_message("" + user + " fixes the microwave.", "<span class='notice'>You fix the microwave.</span>");
                        this.icon_state = "mw";
                        this.broken     = 0;
                        this.dirty      = 0;
                        this.flags      = 4096;
                        return(0);
                    }
                }
                else
                {
                    user.WriteMsg("<span class='warning'>It's broken!</span>");
                    return(1);
                }
            }
            else if (A is Obj_Item_Weapon_ReagentContainers_Spray)
            {
                clean_spray = A;

                if (Lang13.Bool(((Reagents)clean_spray.reagents).has_reagent("cleaner", Lang13.DoubleNullable(clean_spray.amount_per_transfer_from_this))))
                {
                    ((Reagents)clean_spray.reagents).remove_reagent("cleaner", clean_spray.amount_per_transfer_from_this, true);
                    GlobalFuncs.playsound(this.loc, "sound/effects/spray3.ogg", 50, 1, -6);
                    ((Ent_Static)user).visible_message("" + user + " has cleaned the microwave.", "<span class='notice'>You clean the microwave.</span>");
                    this.dirty      = 0;
                    this.broken     = 0;
                    this.icon_state = "mw";
                    this.flags      = 4096;
                    this.updateUsrDialog();
                    return(1);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need more space cleaner!<span>");
                    return(1);
                }
            }
            else if (A is Obj_Item_Weapon_Soap)
            {
                P = A;
                ((Ent_Static)user).visible_message("" + user + " starts to clean the microwave.", "<span class='notice'>You start to clean the microwave...</span>");

                if (GlobalFuncs.do_after(user, P.cleanspeed, null, this))
                {
                    ((Ent_Static)user).visible_message("" + user + " has cleaned the microwave.", "<span class='notice'>You clean the microwave.</span>");
                    this.dirty      = 0;
                    this.broken     = 0;
                    this.icon_state = "mw";
                    this.flags      = 4096;
                }
            }
            else if (this.dirty == 100)
            {
                user.WriteMsg("<span class='warning'>It's dirty!</span>");
                return(1);
            }
            else if (A is Obj_Item_Weapon_Storage_Bag_Tray)
            {
                T      = A;
                loaded = 0;

                foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
                {
                    S = _a;


                    if (this.contents.len >= Convert.ToDouble(this.max_n_of_items))
                    {
                        user.WriteMsg("<span class='warning'>" + this + " is full, you cannot put more!</span>");
                        return(1);
                    }
                    ((Obj_Item_Weapon_Storage)T).remove_from_storage(S, this);
                    loaded++;
                }

                if (loaded != 0)
                {
                    user.WriteMsg("<span class='notice'>You insert " + loaded + " items into " + this + ".</span>");
                }
            }
            else if (A is Obj_Item_Weapon_ReagentContainers_Food_Snacks)
            {
                if (this.contents.len >= Convert.ToDouble(this.max_n_of_items))
                {
                    user.WriteMsg("<span class='warning'>" + this + " is full, you cannot put more!</span>");
                    return(1);
                }
                else
                {
                    if (!Lang13.Bool(user.drop_item()))
                    {
                        user.WriteMsg(new Txt("<span class='warning'>").the(A).item().str(" is stuck to your hand, you cannot put it in ").the(this).item().str("!</span>").ToString());
                        return(0);
                    }
                    A.loc = this;
                    ((Ent_Static)user).visible_message(new Txt().item(user).str(" has added ").the(A).item().str(" to ").the(this).item().str(".").ToString(), new Txt("<span class='notice'>You add ").the(A).item().str(" to ").the(this).item().str(".</span>").ToString());
                }
            }
            else
            {
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            this.updateUsrDialog();
            return(null);
        }
Ejemplo n.º 11
0
        // Function from file: microwave.dm
        public void cook(  )
        {
            Obj_Item_Weapon_ReagentContainers_Food_Snacks F = null;
            dynamic S = null;


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

            if (Rand13.PercentChance(Num13.MaxInt(((int)(5 / (this.efficiency == true ?1:0) - 5)), this.dirty * 5)))
            {
                this.muck_start();

                if (!this.microwaving(4))
                {
                    this.muck_finish();
                    return;
                }
                this.muck_finish();
                return;
            }
            else if (this.has_extra_item())
            {
                if (!this.microwaving(4))
                {
                    this.broke();
                    return;
                }
                this.broke();
                return;
            }
            else
            {
                if (!this.microwaving(10))
                {
                    this.abort();
                    return;
                }
                this.stop();

                foreach (dynamic _a in Lang13.Enumerate(this.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
                {
                    F = _a;


                    if (F.cooked_type != null)
                    {
                        S = Lang13.Call(F.cooked_type, GlobalFuncs.get_turf(this));
                        F.initialize_cooked_food(S, this.efficiency);
                        GlobalFuncs.feedback_add_details("food_made", "" + F.type);
                    }
                    else
                    {
                        new Obj_Item_Weapon_ReagentContainers_Food_Snacks_Badrecipe(this);

                        if (this.dirty < 100)
                        {
                            this.dirty++;
                        }
                    }
                    GlobalFuncs.qdel(F);
                }
                return;
            }
            return;
        }
Ejemplo n.º 12
0
		// 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;
		}
Ejemplo n.º 13
0
        // Function from file: food_cart.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic DG = null;
            dynamic S  = null;
            dynamic G  = null;
            dynamic T  = null;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks S2 = null;


            if (A is Obj_Item_Weapon_ReagentContainers_Food_Drinks_Drinkingglass)
            {
                DG = A;

                if (!Lang13.Bool(DG.reagents.total_volume))
                {
                    if (!Lang13.Bool(user.drop_item()))
                    {
                        return(null);
                    }
                    GlobalFuncs.qdel(DG);
                    this.glasses++;
                    user.WriteMsg("<span class='notice'>The " + this + " accepts the drinking glass, sterilizing it.</span>");
                }
            }
            else if (A is Obj_Item_Weapon_ReagentContainers_Food_Snacks)
            {
                if (this.isFull())
                {
                    user.WriteMsg("<span class='warning'>The " + this + " is at full capacity.</span>");
                }
                else
                {
                    S = A;

                    if (!Lang13.Bool(user.drop_item()))
                    {
                        return(null);
                    }
                    S.loc = this;

                    if (Lang13.Bool(this.stored_food[GlobalFuncs.sanitize(S.name)]))
                    {
                        this.stored_food[GlobalFuncs.sanitize(S.name)]++;
                    }
                    else
                    {
                        this.stored_food[GlobalFuncs.sanitize(S.name)] = 1;
                    }
                }
            }
            else if (A is Obj_Item_Stack_Sheet_Glass)
            {
                G = A;

                if ((((Obj_Item_Stack)G).get_amount() ?? 0) >= 1)
                {
                    G.use(1);
                    this.glasses += 4;
                    user.WriteMsg("<span class='notice'>The " + this + " accepts a sheet of glass.</span>");
                }
            }
            else if (A is Obj_Item_Weapon_Storage_Bag_Tray)
            {
                T = A;

                foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
                {
                    S2 = _a;


                    if (this.isFull())
                    {
                        user.WriteMsg("<span class='warning'>The " + this + " is at full capacity.</span>");
                        break;
                    }
                    else
                    {
                        ((Obj_Item_Weapon_Storage)T).remove_from_storage(S2, this);

                        if (Lang13.Bool(this.stored_food[GlobalFuncs.sanitize(S2.name)]))
                        {
                            this.stored_food[GlobalFuncs.sanitize(S2.name)]++;
                        }
                        else
                        {
                            this.stored_food[GlobalFuncs.sanitize(S2.name)] = 1;
                        }
                    }
                }
            }
            else if (Lang13.Bool(((Ent_Static)A).is_open_container()))
            {
                return(null);
            }
            else
            {
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            this.updateDialog();
            return(null);
        }
        // Function from file: dog.dm
        public override bool Life(  )
        {
            Obj_Item_Weapon_ReagentContainers_Food_Snacks S = null;
            dynamic i = null;

            base.Life();

            if (!(this.stat != 0) && !(this.resting != 0) && !(this.buckled != null))
            {
                this.turns_since_scan++;

                if (this.turns_since_scan > 5)
                {
                    this.turns_since_scan = 0;

                    if (this.movement_target != null && !(this.movement_target.loc is Tile || this.movement_target.loc is Mob_Living_Carbon_Human))
                    {
                        this.movement_target         = null;
                        this.stop_automated_movement = false;
                    }

                    if (!(this.movement_target != null) || !Map13.FetchInViewExcludeThis(3, this).Contains(this.movement_target.loc))
                    {
                        this.movement_target         = null;
                        this.stop_automated_movement = false;

                        foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInViewExcludeThis(3, this), typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
                        {
                            S = _a;


                            if (S.loc is Tile || S.loc is Mob_Living_Carbon_Human)
                            {
                                this.movement_target = S;
                                break;
                            }
                        }
                    }

                    if (this.movement_target != null)
                    {
                        this.stop_automated_movement = true;
                        Map13.StepTowards(this, this.movement_target, 1);
                        Task13.Sleep(3);
                        Map13.StepTowards(this, this.movement_target, 1);
                        Task13.Sleep(3);
                        Map13.StepTowards(this, this.movement_target, 1);

                        if (this.movement_target != null)
                        {
                            if (this.movement_target.loc.x < this.x)
                            {
                                this.dir = ((int)(GlobalVars.WEST));
                            }
                            else if (this.movement_target.loc.x > this.x)
                            {
                                this.dir = ((int)(GlobalVars.EAST));
                            }
                            else if (this.movement_target.loc.y < this.y)
                            {
                                this.dir = ((int)(GlobalVars.SOUTH));
                            }
                            else if (this.movement_target.loc.y > this.y)
                            {
                                this.dir = ((int)(GlobalVars.NORTH));
                            }
                            else
                            {
                                this.dir = ((int)(GlobalVars.SOUTH));
                            }

                            if (!this.Adjacent(this.movement_target))
                            {
                                return(false);
                            }

                            if (this.movement_target.loc is Tile)
                            {
                                this.movement_target.attack_animal(this);
                            }
                            else if (this.movement_target.loc is Mob_Living_Carbon_Human)
                            {
                                if (Rand13.PercentChance(20))
                                {
                                    this.emote("me", 1, "stares at " + this.movement_target.loc + "'s " + this.movement_target + " with a sad puppy-face");
                                }
                            }
                        }
                    }
                }

                if (Rand13.PercentChance(1))
                {
                    this.emote("me", 1, Rand13.Pick(new object [] { "dances around.", "chases its tail!" }));
                    Task13.Schedule(0, (Task13.Closure)(() => {
                        foreach (dynamic _b in Lang13.Enumerate(new ByTable(new object [] { 1, 2, 4, 8, 4, 2, 1, 2, 4, 8, 4, 2, 1, 2, 4, 8, 4, 2 })))
                        {
                            i = _b;

                            this.dir = Convert.ToInt32(i);
                            Task13.Sleep(1);
                        }
                        return;
                    }));
                }
            }
            return(false);
        }
Ejemplo n.º 15
0
        // Function from file: vending.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic T            = null;
            int     loaded       = 0;
            int     denied_items = 0;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks S = null;


            if (A is Obj_Item_Weapon_ReagentContainers_Food_Snacks)
            {
                if (!this.compartment_access_check(user))
                {
                    return(null);
                }

                if (this.junk_check(A))
                {
                    if (!this.iscompartmentfull(user))
                    {
                        if (!Lang13.Bool(user.drop_item()))
                        {
                            return(null);
                        }
                        A.loc = this;
                        this.food_load(A);
                        user.WriteMsg("<span class='notice'>You insert " + A + " into " + this + "'s chef compartment.</span>");
                    }
                }
                else
                {
                    user.WriteMsg("<span class='notice'>" + this + "'s chef compartment does not accept junk food.</span>");
                }
                return(null);
            }

            if (A is Obj_Item_Weapon_Storage_Bag_Tray)
            {
                if (!this.compartment_access_check(user))
                {
                    return(null);
                }
                T            = A;
                loaded       = 0;
                denied_items = 0;

                foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks)))
                {
                    S = _a;


                    if (this.iscompartmentfull(user))
                    {
                        break;
                    }

                    if (this.junk_check(S))
                    {
                        ((Obj_Item_Weapon_Storage)T).remove_from_storage(S, this);
                        this.food_load(S);
                        loaded++;
                    }
                    else
                    {
                        denied_items++;
                    }
                }

                if (denied_items != 0)
                {
                    user.WriteMsg("<span class='notice'>" + this + " refuses some items.</span>");
                }

                if (loaded != 0)
                {
                    user.WriteMsg("<span class='notice'>You insert " + loaded + " dishes into " + this + "'s chef compartment.</span>");
                }
                this.updateUsrDialog();
                return(null);
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }