Пример #1
0
        // Function from file: biogenerator.dm
        public void activate(  )
        {
            int S = 0;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown I = null;


            if (Task13.User.stat != 0)
            {
                return;
            }

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

            if (this.processing)
            {
                Task13.User.WriteMsg("<span class='warning'>The biogenerator is in the process of working.</span>");
                return;
            }
            S = 0;

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

                S += 5;

                if ((I.reagents.get_reagent_amount("nutriment") ?1:0) < 0.1)
                {
                    this.points += this.productivity;
                }
                else
                {
                    this.points += (I.reagents.get_reagent_amount("nutriment") ?1:0) * this.productivity * 10;
                }
                GlobalFuncs.qdel(I);
            }

            if (S != 0)
            {
                this.processing = true;
                this.update_icon();
                this.updateUsrDialog();
                GlobalFuncs.playsound(this.loc, "sound/machines/blender.ogg", 50, 1);
                this.f_use_power(S * 30);
                Task13.Sleep(((int)(S + 15 / this.productivity)));
                this.processing = false;
                this.update_icon();
            }
            else
            {
                this.menustat = "void";
            }
            return;
        }
		// Function from file: reagentgrinder.dm
		public override dynamic attackby( dynamic A = null, dynamic user = null, string _params = null, bool? silent = null, bool? replace_spent = null ) {
			dynamic G = null;
			dynamic B = null;
			Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown G2 = null;

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

			if ( A is Obj_Item_Weapon_ReagentContainers && Lang13.Bool( A.flags & 4096 ) ) {
				
				if ( Lang13.Bool( this.beaker ) ) {
					return 1;
				} else {
					
					if ( !Lang13.Bool( user.drop_item() ) ) {
						return 1;
					}
					this.beaker = A;
					this.beaker.loc = this;
					this.update_icon();
					this.updateUsrDialog();
					return 0;
				}
			}

			if ( GlobalFuncs.is_type_in_list( A, this.dried_items ) ) {
				
				if ( A is Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown ) {
					G = A;

					if ( !G.dry ) {
						user.WriteMsg( "<span class='warning'>You must dry that first!</span>" );
						return 1;
					}
				}
			}

			if ( this.holdingitems != null && this.holdingitems.len >= this.limit ) {
				Task13.User.WriteMsg( "The machine cannot hold anymore items." );
				return 1;
			}

			if ( A is Obj_Item_Weapon_Storage_Bag ) {
				B = A;

				foreach (dynamic _a in Lang13.Enumerate( B.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown) )) {
					G2 = _a;
					
					((Obj_Item_Weapon_Storage)B).remove_from_storage( G2, this );
					this.holdingitems.Add( G2 );

					if ( this.holdingitems != null && this.holdingitems.len >= this.limit ) {
						user.WriteMsg( "<span class='notice'>You fill the All-In-One grinder to the brim.</span>" );
						break;
					}
				}

				if ( !( A.contents.len != 0 ) ) {
					user.WriteMsg( "<span class='notice'>You empty the plant bag into the All-In-One grinder.</span>" );
				}
				this.updateUsrDialog();
				return 0;
			}

			if ( !GlobalFuncs.is_type_in_list( A, this.blend_items ) && !GlobalFuncs.is_type_in_list( A, this.juice_items ) ) {
				user.WriteMsg( "<span class='warning'>Cannot refine into a reagent!</span>" );
				return 1;
			}
			((Mob)user).unEquip( A );
			A.loc = this;
			this.holdingitems.Add( A );
			this.updateUsrDialog();
			return 0;
		}
Пример #3
0
        // Function from file: biogenerator.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            int i = 0;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown G  = null;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown G2 = null;
            int i2 = 0;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown G3 = null;
            dynamic B = null;


            if (A is Obj_Item_Weapon_ReagentContainers_Glass && !Lang13.Bool(this.panel_open))
            {
                if (Lang13.Bool(this.beaker))
                {
                    user.WriteMsg("<span class='warning'>A container is already loaded into the machine.</span>");
                }
                else
                {
                    ((Mob)user).unEquip(A);
                    A.loc       = this;
                    this.beaker = A;
                    user.WriteMsg("<span class='notice'>You add the container to the machine.</span>");
                    this.updateUsrDialog();
                }
            }
            else if (this.processing)
            {
                user.WriteMsg("<span class='warning'>The biogenerator is currently processing.</span>");
            }
            else if (A is Obj_Item_Weapon_Storage_Bag_Plants)
            {
                i = 0;

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

                    i++;
                }

                if (i >= Convert.ToDouble(this.max_items))
                {
                    user.WriteMsg("<span class='warning'>The biogenerator is already full! Activate it.</span>");
                }
                else
                {
                    foreach (dynamic _b in Lang13.Enumerate(A.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown)))
                    {
                        G2 = _b;


                        if (i >= Convert.ToDouble(this.max_items))
                        {
                            break;
                        }
                        G2.loc = this;
                        i++;
                    }

                    if (i < Convert.ToDouble(this.max_items))
                    {
                        user.WriteMsg("<span class='info'>You empty the plant bag into the biogenerator.</span>");
                    }
                    else if (A.contents.len == 0)
                    {
                        user.WriteMsg("<span class='info'>You empty the plant bag into the biogenerator, filling it to its capacity.</span>");
                    }
                    else
                    {
                        user.WriteMsg("<span class='info'>You fill the biogenerator to its capacity.</span>");
                    }
                }
            }
            else if (!(A is Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown))
            {
                user.WriteMsg("<span class='warning'>You cannot put this in " + this.name + "!</span>");
            }
            else
            {
                i2 = 0;

                foreach (dynamic _c in Lang13.Enumerate(this.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown)))
                {
                    G3 = _c;

                    i2++;
                }

                if (i2 >= Convert.ToDouble(this.max_items))
                {
                    user.WriteMsg("<span class='warning'>The biogenerator is full! Activate it.</span>");
                }
                else
                {
                    ((Mob)user).unEquip(A);
                    A.loc = this;
                    user.WriteMsg("<span class='info'>You put " + A.name + " in " + this.name + "</span>");
                }
            }

            if (!this.processing)
            {
                if (this.default_deconstruction_screwdriver(user, "biogen-empty-o", "biogen-empty", A))
                {
                    if (Lang13.Bool(this.beaker))
                    {
                        B           = this.beaker;
                        B.loc       = this.loc;
                        this.beaker = null;
                    }
                }
            }

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