Beispiel #1
0
        // Function from file: watertank.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            bool     Adj = false;
            Reagents R   = null;
            Obj_Effect_NanofrostContainer A = null;
            int?    a = null;
            dynamic F = null;


            if (this.nozzle_mode == 0)
            {
                base.afterattack((object)(target), (object)(user), proximity_flag, click_parameters);
                return(false);
            }
            Adj = ((Ent_Static)user).Adjacent(target);

            if (Adj)
            {
                this.AttemptRefill(target, user);
            }

            if (this.nozzle_mode == 1)
            {
                if (Adj)
                {
                    return(false);
                }
                R = this.reagents;

                if ((R.total_volume ?? 0) < 100)
                {
                    user.WriteMsg("<span class='warning'>You need at least 100 units of water to use the nanofrost launcher!</span>");
                    return(false);
                }

                if (this.nanofrost_cooldown)
                {
                    user.WriteMsg("<span class='warning'>Nanofrost launcher is still recharging...</span>");
                    return(false);
                }
                this.nanofrost_cooldown = true;
                R.remove_any(100);
                A = new Obj_Effect_NanofrostContainer(GlobalFuncs.get_turf(this));
                GlobalFuncs.log_game("" + user.ckey + " (" + user.name + ") used Nanofrost at " + GlobalFuncs.get_area(user) + " (" + user.x + ", " + user.y + ", " + user.z + ").");
                GlobalFuncs.playsound(this, "sound/items/syringeproj.ogg", 40, 1);
                a = null;
                a = 0;

                while ((a ?? 0) < 5)
                {
                    Map13.StepTowardsSimple(A, target);
                    Task13.Sleep(2);
                    a++;
                }
                A.Smoke();
                Task13.Schedule(100, (Task13.Closure)(() => {
                    if (this != null)
                    {
                        this.nanofrost_cooldown = false;
                    }
                    return;
                }));
                return(false);
            }

            if (this.nozzle_mode == 2)
            {
                if (!Adj || !(target is Tile))
                {
                    return(false);
                }

                if (this.metal_synthesis_cooldown < 5)
                {
                    F        = GlobalFuncs.PoolOrNew(typeof(Obj_Effect_ParticleEffect_Foam_Metal), GlobalFuncs.get_turf(target));
                    F.amount = 0;
                    this.metal_synthesis_cooldown++;
                    Task13.Schedule(100, (Task13.Closure)(() => {
                        this.metal_synthesis_cooldown--;
                        return;
                    }));
                }
                else
                {
                    user.WriteMsg("<span class='warning'>Metal foam mix is still being synthesized...</span>");
                    return(false);
                }
            }
            return(false);
        }