// Function from file: mutations.dm
        public override void on_life(Mob_Living owner = null)
        {
            int x_offset_old = 0;
            int y_offset_old = 0;
            int x_offset     = 0;
            int y_offset     = 0;


            if (Rand13.PercentChance(10) && owner.paralysis <= 1)
            {
                owner.Stun(10);

                dynamic _a = Rand13.Int(1, 3);                   // Was a switch-case, sorry for the mess.
                if (2 <= _a && _a <= 3)
                {
                    owner.say("" + (Rand13.PercentChance(50) ? ";" : "") + Rand13.Pick(new object [] { "SHIT", "PISS", "F**K", "C**T", "C********R", "M**********R", "T**S" }));
                }
                else if (_a == 1)
                {
                    owner.emote("twitch");
                }
                x_offset_old = owner.pixel_x;
                y_offset_old = owner.pixel_y;
                x_offset     = owner.pixel_x + Rand13.Int(-2, 2);
                y_offset     = owner.pixel_y + Rand13.Int(-1, 1);
                Icon13.Animate(new ByTable().Set(1, owner).Set("pixel_x", x_offset).Set("pixel_y", y_offset).Set("time", 1));
                Icon13.Animate(new ByTable().Set(1, owner).Set("pixel_x", x_offset_old).Set("pixel_y", y_offset_old).Set("time", 1));
            }
            return;
        }
        // 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: ninja_stealth.dm
        public void toggle_stealth(  )
        {
            dynamic U = null;

            U = this.affecting;

            if (!Lang13.Bool(U))
            {
                return;
            }

            if (this.s_active)
            {
                this.cancel_stealth();
            }
            else
            {
                if (Convert.ToDouble(this.cell.charge) <= 0)
                {
                    U.WriteMsg("<span class='warning'>You don't have enough power to enable Stealth!</span>");
                    return;
                }
                this.s_active = !this.s_active;
                Icon13.Animate(new ByTable().Set(1, U).Set("alpha", 0).Set("time", 15));
                ((Ent_Static)U).visible_message("<span class='warning'>" + U.name + " vanishes into thin air!</span>", "<span class='notice'>You are now invisible to normal detection.</span>");
            }
            return;
        }
		// 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;
		}
Example #5
0
        // Function from file: lighting_system.dm
        public void redraw_lighting(bool?instantly = null)
        {
            instantly = instantly ?? false;

            int newalpha = 0;
            int num      = 0;


            if (Lang13.Bool(this.lighting_object))
            {
                if (this.lighting_lumcount <= 0)
                {
                    newalpha = 255;
                }
                else
                {
                    this.lighting_object.luminosity = 1;

                    if (this.lighting_lumcount < 10)
                    {
                        num      = Num13.MaxInt(0, Num13.MinInt(((int)(this.lighting_lumcount * 25.5)), 255));
                        newalpha = 255 - num;
                    }
                    else
                    {
                        newalpha = 0;
                    }
                }

                if (newalpha >= 250)
                {
                    newalpha = 255;
                }

                if (Convert.ToInt32(this.lighting_object.alpha) != newalpha)
                {
                    if (instantly == true)
                    {
                        this.lighting_object.alpha = newalpha;
                    }
                    else
                    {
                        Icon13.Animate(new ByTable().Set(1, this.lighting_object).Set("alpha", newalpha).Set("time", 2));
                    }

                    if (newalpha >= 250)
                    {
                        this.luminosity = 0;
                        this.lighting_object.luminosity = 0;
                    }
                }
            }
            this.lighting_changed = false;
            return;
        }
        // Function from file: kitchen_spike.dm
        public override dynamic user_unbuckle_mob(dynamic user = null)
        {
            dynamic M    = null;
            Matrix  m180 = null;


            if (Lang13.Bool(this.buckled_mob) && this.buckled_mob.buckled == this)
            {
                M = this.buckled_mob;

                if (M != user)
                {
                    ((Ent_Static)M).visible_message("" + user.name + " tries to pull " + M.name + " free of the " + this + "!", "<span class='notice'>" + user.name + " is trying to pull you off the " + this + ", opening up fresh wounds!</span>", "<span class='italics'>You hear a squishy wet noise.</span>");

                    if (!GlobalFuncs.do_after(user, 300, null, this))
                    {
                        if (Lang13.Bool(M) && M.buckled != null)
                        {
                            ((Ent_Static)M).visible_message("" + user.name + " fails to free " + M.name + "!", "<span class='notice'>" + user.name + " fails to pull you off of the " + this + ".</span>");
                        }
                        return(null);
                    }
                }
                else
                {
                    ((Ent_Static)M).visible_message("<span class='warning'>" + M.name + " struggles to break free from the " + this + "!</span>", "<span class='notice'>You struggle to break free from the " + this + ", exacerbating your wounds! (Stay still for two minutes.)</span>", "<span class='italics'>You hear a wet squishing noise..</span>");
                    ((Mob_Living)M).adjustBruteLoss(30);

                    if (!GlobalFuncs.do_after(M, 1200, null, this))
                    {
                        if (Lang13.Bool(M) && M.buckled != null)
                        {
                            M.WriteMsg("<span class='warning'>You fail to free yourself!</span>");
                        }
                        return(null);
                    }
                }

                if (!(M.buckled != null))
                {
                    return(null);
                }
                m180 = Num13.Matrix(M.transform);
                m180.Turn(180);
                Icon13.Animate(new ByTable().Set(1, M).Set("transform", m180).Set("time", 3));
                M.pixel_y = ((Mob_Living)M).get_standard_pixel_y_offset(180);
                ((Mob_Living)M).adjustBruteLoss(30);
                this.visible_message("<span class='danger'>" + M + " falls free of the " + this + "!</span>");
                this.unbuckle_mob();
                ((Mob)M).emote("scream");
                ((Mob)M).AdjustWeakened(10);
            }
            return(null);
        }
Example #7
0
        // Function from file: observer.dm
        public override dynamic orbit(dynamic A = null, double?radius = null, int?clockwise = null, double?rotation_speed = null, int?rotation_segments = null, int?pre_rotation = null, int?lockinorbit = null)
        {
            base.orbit((object)(A), radius, clockwise, rotation_speed, rotation_segments, pre_rotation, lockinorbit);
            Task13.Sleep(2);

            if (!Lang13.Bool(this.orbiting))
            {
                this.pixel_y = 0;
                Icon13.Animate(new ByTable().Set(1, this).Set("pixel_y", 2).Set("time", 10).Set("loop", -1));
            }
            return(null);
        }
Example #8
0
        // Function from file: traps.dm
        public override double examine(dynamic user = null)
        {
            base.examine((object)(user));

            if (!(user is Mob_Living))
            {
                return(0);
            }
            user.WriteMsg("You reveal a trap!");
            this.alpha = 200;
            Icon13.Animate(new ByTable().Set(1, this).Set("alpha", 30).Set("time", this.time_between_triggers));
            return(0);
        }
Example #9
0
        // Function from file: observer.dm
        public Mob_Dead_Observer(dynamic body = null) : base((object)(body))
        {
            dynamic T = null;

            this.verbs.Add(typeof(Mob_Dead_Observer).GetMethod("dead_tele"));
            this.ghostimage = new Image(this.icon, this, this.icon_state);
            GlobalVars.ghost_darkness_images.Or(this.ghostimage);
            GlobalFuncs.updateallghostimages();

            if (body is Mob)
            {
                T = GlobalFuncs.get_turf(body);
                this.attack_log = body.attack_log;
                this.gender     = body.gender;

                if (Lang13.Bool(body.mind) && Lang13.Bool(body.mind.name))
                {
                    this.name = body.mind.name;
                }
                else if (Lang13.Bool(body.real_name))
                {
                    this.name = body.real_name;
                }
                else
                {
                    this.name = GlobalFuncs.random_unique_name(this.gender);
                }
                this.mind = body.mind;
            }

            if (!Lang13.Bool(T))
            {
                T = Rand13.PickFromTable(GlobalVars.latejoin);
            }
            this.loc = T;

            if (!Lang13.Bool(this.name))
            {
                this.name = GlobalFuncs.random_unique_name(this.gender);
            }
            this.real_name = this.name;

            if (!this.fun_verbs)
            {
                this.verbs.Remove(typeof(Mob_Dead_Observer).GetMethod("boo"));
                this.verbs.Remove(typeof(Mob_Dead_Observer).GetMethod("possess"));
            }
            Icon13.Animate(new ByTable().Set(1, this).Set("pixel_y", 2).Set("time", 10).Set("loop", -1));
            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            return;
        }
Example #10
0
        // Function from file: he_pipes.dm
        public override int?process(dynamic seconds = null)
        {
            GasMixture pipe_air   = null;
            double     h_r        = 0;
            double     h_g        = 0;
            double     h_b        = 0;
            dynamic    scale      = null;
            int        heat_limit = 0;


            if (!(this.parent != null))
            {
                return(null);
            }
            pipe_air = this.return_air();

            if (Lang13.Bool(pipe_air.temperature) && (Convert.ToDouble(this.icon_temperature) > 500 || Convert.ToDouble(pipe_air.temperature) > 500))
            {
                if (Math.Abs(Convert.ToDouble(pipe_air.temperature - this.icon_temperature)) > 10)
                {
                    this.icon_temperature = pipe_air.temperature;
                    h_r = GlobalFuncs.heat2colour_r(this.icon_temperature);
                    h_g = GlobalFuncs.heat2colour_g(this.icon_temperature);
                    h_b = GlobalFuncs.heat2colour_b(this.icon_temperature);

                    if (Convert.ToDouble(this.icon_temperature) < 2000)
                    {
                        scale = (this.icon_temperature - 500) / 1500;
                        h_r   = (h_r - 64) * Convert.ToDouble(scale) + 64;
                        h_g   = (h_g - 64) * Convert.ToDouble(scale) + 64;
                        h_b   = (h_b - 64) * Convert.ToDouble(scale) + 64;
                    }
                    Icon13.Animate(new ByTable().Set(1, this).Set("color", String13.ColorCode(((int)(h_r)), ((int)(h_g)), ((int)(h_b)))).Set("time", 20).Set("easing", 1));
                }
            }

            if (Lang13.Bool(this.buckled_mob))
            {
                heat_limit = 1000;

                if (Convert.ToDouble(pipe_air.temperature) > heat_limit + 1)
                {
                    this.buckled_mob.apply_damage(Math.Log(Convert.ToDouble(pipe_air.temperature - heat_limit)) * 4, "fire", "chest");
                }
            }
            return(null);
        }
Example #11
0
        // Function from file: runes.dm
        public override void timestop(  )
        {
            Mob_Living M = null;

            Icon13.Animate(new ByTable().Set(1, this).Set("alpha", 255).Set("time", 5).Set("loop", -1));
            this.SpinAnimation(5);

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


                if (GlobalFuncs.iscultist(M) || Lang13.Bool(M.null_rod_check()))
                {
                    this.immune.Or(M);
                }
            }
            base.timestop();
            return;
        }
        // Function from file: ninja_stealth.dm
        public bool cancel_stealth(  )
        {
            dynamic U = null;

            U = this.affecting;

            if (!Lang13.Bool(U))
            {
                return(false);
            }

            if (this.s_active)
            {
                this.s_active = !this.s_active;
                Icon13.Animate(new ByTable().Set(1, U).Set("alpha", 255).Set("time", 15));
                ((Ent_Static)U).visible_message("<span class='warning'>" + U.name + " appears from thin air!</span>", "<span class='notice'>You are now visible.</span>");
                return(true);
            }
            return(false);
        }
Example #13
0
        // Function from file: simple_animal.dm
        public override void update_transform(  )
        {
            Matrix ntransform = null;
            int    changed    = 0;

            ntransform = Num13.Matrix(this.transform);
            changed    = 0;

            if (this.resize != 1)
            {
                changed++;
                ntransform.Scale(this.resize);
                this.resize = 1;
            }

            if (changed != 0)
            {
                Icon13.Animate(new ByTable().Set(1, this).Set("transform", ntransform).Set("time", 2).Set("easing", 192));
            }
            return;
        }
Example #14
0
        // Function from file: traps.dm
        public override dynamic Crossed(Ent_Dynamic O = null, dynamic X = null)
        {
            Ent_Dynamic L = null;


            if (this.last_trigger + this.time_between_triggers > Game13.time)
            {
                return(null);
            }
            this.alpha = 30;

            if (O is Mob_Living)
            {
                L = O;
                this.last_trigger = Game13.time;
                this.alpha        = 200;
                this.trap_effect(L);
                Icon13.Animate(new ByTable().Set(1, this).Set("alpha", 30).Set("time", this.time_between_triggers));
            }
            return(null);
        }
Example #15
0
        // Function from file: living.dm
        public virtual void do_attack_animation(dynamic A = null, dynamic end_pixel_y = null)
        {
            int     pixel_x_diff  = 0;
            int     pixel_y_diff  = 0;
            dynamic final_pixel_y = null;
            int     direction     = 0;

            pixel_x_diff  = 0;
            pixel_y_diff  = 0;
            final_pixel_y = Lang13.Initial(this, "pixel_y");

            if (Lang13.Bool(end_pixel_y))
            {
                final_pixel_y = end_pixel_y;
            }
            direction = Map13.GetDistance(this, A);

            if ((direction & 1) != 0)
            {
                pixel_y_diff = 8;
            }
            else if ((direction & 2) != 0)
            {
                pixel_y_diff = -8;
            }

            if ((direction & 4) != 0)
            {
                pixel_x_diff = 8;
            }
            else if ((direction & 8) != 0)
            {
                pixel_x_diff = -8;
            }
            Icon13.Animate(new ByTable().Set(1, this).Set("pixel_x", this.pixel_x + pixel_x_diff).Set("pixel_y", this.pixel_y + pixel_y_diff).Set("time", 2));
            Icon13.Animate(new ByTable().Set("pixel_x", Lang13.Initial(this, "pixel_x")).Set("pixel_y", final_pixel_y).Set("time", 2));
            return;
        }
Example #16
0
        // Function from file: mines.dm
        public override void mineEffect(Ent_Dynamic victim = null)
        {
            dynamic old_color  = null;
            ByTable red_splash = null;
            ByTable pure_red   = null;
            Obj_Item_Weapon_Twohanded_Required_Chainsaw chainsaw = null;


            if (!Lang13.Bool(((dynamic)victim).client) || !(victim is Mob_Living_Carbon))
            {
                return;
            }
            ((dynamic)victim).WriteMsg("<span class='reallybig redtext'>KILL EM ALL</span>");
            old_color  = ((dynamic)victim).client.color;
            red_splash = new ByTable(new object [] { 1, 0, 0, 0.8, 0.2, 0, 0.8, 0, 0.2, 0.1, 0, 0 });
            pure_red   = new ByTable(new object [] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 });
            Task13.Schedule(0, (Task13.Closure)(() => {
                new Obj_Effect_Hallucination_Delusion(victim.loc, victim, "demon", this.duration, false);
                return;
            }));
            chainsaw        = new Obj_Item_Weapon_Twohanded_Required_Chainsaw(victim.loc);
            chainsaw.flags |= 2;
            ((Mob)victim).drop_r_hand();
            ((Mob)victim).drop_l_hand();
            ((dynamic)victim).put_in_hands(chainsaw);
            victim.reagents.add_reagent("adminordrazine", 25);
            ((dynamic)victim).client.color = pure_red;
            Icon13.Animate(new ByTable().Set(1, ((dynamic)victim).client).Set("color", red_splash).Set("time", 10).Set("easing", 129));
            Task13.Sleep(10);
            Icon13.Animate(new ByTable().Set(1, ((dynamic)victim).client).Set("color", old_color).Set("time", this.duration));
            Task13.Sleep(this.duration ?? 0);
            ((dynamic)victim).WriteMsg("<span class='notice'>You feel calm again.<span>");
            GlobalFuncs.qdel(chainsaw);
            GlobalFuncs.qdel(this);
            return;
        }
Example #17
0
        // Function from file: runes.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            Matrix oldtransform = null;


            if (!GlobalFuncs.iscultist(a))
            {
                a.WriteMsg("<span class='warning'>You aren't able to understand the words of " + this + ".</span>");
                return(null);
            }

            if (this.can_invoke(a))
            {
                this.invoke(a);
                oldtransform = this.transform;
                Icon13.Animate(new ByTable().Set(1, this).Set("transform", Num13.Matrix() * 2).Set("alpha", 0).Set("time", 5));
                Icon13.Animate(new ByTable().Set("transform", oldtransform).Set("alpha", 255).Set("time", 0));
            }
            else
            {
                this.fail_invoke(a);
            }
            return(null);
        }
        // Function from file: chronosuit.dm
        public void chronowalk(Obj_Effect_ChronosCam location = null)
        {
            Ent_Static user          = null;
            dynamic    from_turf     = null;
            dynamic    to_turf       = null;
            double     distance      = 0;
            double     phase_in_ds   = 0;
            ByTable    nonsafe_slots = null;
            dynamic    slot          = null;
            dynamic    slot_item     = null;

            user = this.loc;

            if (this.activated && !this.teleporting && user != null && user is Mob_Living_Carbon_Human && location != null && user.loc != null && location.loc != null && ((dynamic)user).wear_suit == this && Lang13.Bool(((dynamic)user).stat) == false)
            {
                this.teleporting = true;
                from_turf        = GlobalFuncs.get_turf(user);
                to_turf          = GlobalFuncs.get_turf(location);
                distance         = GlobalFuncs.cheap_hypotenuse(Convert.ToInt32(from_turf.x), Convert.ToInt32(from_turf.y), Convert.ToInt32(to_turf.x), Convert.ToInt32(to_turf.y));
                phase_in_ds      = distance * 2;

                if (this.camera != null)
                {
                    this.camera.remove_target_ui();
                }

                if (this.teleport_now.button != null)
                {
                    this.teleport_now.button.UpdateIcon();
                }
                nonsafe_slots = new ByTable(new object [] { 6, 1, 4, 5 });

                foreach (dynamic _a in Lang13.Enumerate(nonsafe_slots))
                {
                    slot = _a;

                    slot_item = ((Mob)user).get_item_by_slot(slot);

                    if (Lang13.Bool(slot_item) && !this.chronosafe_items.Contains(slot_item.type) && ((Mob)user).unEquip(slot_item))
                    {
                        ((dynamic)user).WriteMsg("<span class='notice'>Your " + slot_item.name + " got left behind.</span>");
                    }
                }
                ((dynamic)user).ExtinguishMob();

                if (Lang13.Bool(((dynamic)user).buckled))
                {
                    ((Ent_Dynamic)((dynamic)user).buckled).unbuckle_mob();
                }
                this.phase_underlay      = this.create_phase_underlay(user);
                this.hands_nodrop_states = 0;

                if (Lang13.Bool(((dynamic)user).l_hand))
                {
                    this.hands_nodrop_states     |= (Lang13.Bool(((dynamic)user).l_hand.flags & 2) ? true : false) ?1:0;
                    ((dynamic)user).l_hand.flags |= 2;
                }

                if (Lang13.Bool(((dynamic)user).r_hand))
                {
                    this.hands_nodrop_states     |= (Lang13.Bool(((dynamic)user).r_hand.flags & 2) ? 2 : 0);
                    ((dynamic)user).r_hand.flags |= 2;
                }
                ((dynamic)user).animate_movement = 0;
                ((dynamic)user).changeNext_move(phase_in_ds + 8);
                ((dynamic)user).notransform = 1;
                ((dynamic)user).anchored    = 1;
                ((dynamic)user).Stun(Double.PositiveInfinity);
                Icon13.Animate(new ByTable().Set(1, user).Set("color", "#00ccee").Set("time", 3));
                Task13.Schedule(3, (Task13.Closure)(() => {
                    if (this.teleporting && this.activated && user != null && this.phase_underlay != null && !Lang13.Bool(GlobalFuncs.qdeleted(this.phase_underlay)))
                    {
                        Icon13.Animate(new ByTable().Set(1, user).Set("alpha", 0).Set("time", 2));
                        Icon13.Animate(new ByTable().Set(1, this.phase_underlay).Set("alpha", 255).Set("time", 2));
                        Task13.Sleep(2);

                        if (this.teleporting && this.activated && user != null && this.phase_underlay != null && !Lang13.Bool(GlobalFuncs.qdeleted(this.phase_underlay)))
                        {
                            this.phase_underlay.loc = to_turf;
                            user.loc = to_turf;
                            Icon13.Animate(new ByTable().Set(1, user).Set("alpha", 255).Set("time", phase_in_ds));
                            Icon13.Animate(new ByTable().Set(1, this.phase_underlay).Set("alpha", 0).Set("time", phase_in_ds));
                            Task13.Sleep(((int)(phase_in_ds)));

                            if (this.teleporting && this.activated && this.phase_underlay != null && !Lang13.Bool(GlobalFuncs.qdeleted(this.phase_underlay)))
                            {
                                Icon13.Animate(new ByTable().Set(1, user).Set("color", "#ffffff").Set("time", 3));
                                Task13.Sleep(3);
                            }
                        }
                    }

                    if (this.teleporting && user != null && !Lang13.Bool(GlobalFuncs.qdeleted(user)))
                    {
                        user.loc = to_turf;
                        this.finish_chronowalk();
                    }
                    return;
                }));
            }
            return;
        }
        // Function from file: kitchen_spike.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            Obj_Structure_KitchenspikeFrame F = null;
            dynamic    G    = null;
            Ent_Static H    = null;
            dynamic    pos  = null;
            Matrix     m180 = null;


            if (A is Obj_Item_Weapon_Crowbar)
            {
                if (!Lang13.Bool(this.buckled_mob))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1);

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You pry the spikes out of the frame.</span>");
                        new Obj_Item_Stack_Rods(this.loc, 4);
                        F = new Obj_Structure_KitchenspikeFrame(this.loc);
                        this.transfer_fingerprints_to(F);
                        GlobalFuncs.qdel(this);
                    }
                }
                else
                {
                    user.WriteMsg("<span class='notice'>You can't do that while something's on the spike!</span>");
                }
                return(null);
            }

            if (A is Obj_Item_Weapon_Grab)
            {
                G = A;

                if (G.affecting is Mob_Living)
                {
                    if (!Lang13.Bool(this.buckled_mob))
                    {
                        if (GlobalFuncs.do_mob(user, this, 120))
                        {
                            if (Lang13.Bool(this.buckled_mob))
                            {
                                return(null);
                            }

                            if (G.affecting.buckled != null)
                            {
                                return(null);
                            }
                            H = G.affecting;
                            GlobalFuncs.playsound(this.loc, "sound/effects/splat.ogg", 25, 1);
                            H.visible_message("<span class='danger'>" + user + " slams " + G.affecting + " onto the meat spike!</span>", "<span class='userdanger'>" + user + " slams you onto the meat spike!</span>", "<span class='italics'>You hear a squishy wet noise.</span>");
                            H.loc = this.loc;
                            ((dynamic)H).emote("scream");

                            if (H is Mob_Living_Carbon_Human)
                            {
                                pos = GlobalFuncs.get_turf(H);
                                ((Ent_Static)pos).add_blood_floor(H);
                            }
                            ((dynamic)H).adjustBruteLoss(30);
                            ((dynamic)H).buckled = this;
                            H.dir            = 2;
                            this.buckled_mob = H;
                            m180             = Num13.Matrix(H.transform);
                            m180.Turn(180);
                            Icon13.Animate(new ByTable().Set(1, H).Set("transform", m180).Set("time", 3));
                            H.pixel_y = Convert.ToInt32(((dynamic)H).get_standard_pixel_y_offset(180));
                            GlobalFuncs.qdel(G);
                            return(null);
                        }
                    }
                }
                user.WriteMsg("<span class='danger'>You can't use that on the spike!</span>");
                return(null);
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            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;
		}
Example #21
0
 // Function from file: mines.dm
 public Obj_Effect_Mine_Pickup(dynamic loc = null) : base((object)(loc))
 {
     // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
     Icon13.Animate(new ByTable().Set(1, this).Set("pixel_y", 4).Set("time", 20).Set("loop", -1));
     return;
 }
Example #22
0
        // Function from file: monkeyrecycler.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 grabbed = null;
            Mob     target  = null;
            int     offset  = 0;


            if (this.default_deconstruction_screwdriver(user, "grinder_open", "grinder", A))
            {
                return(null);
            }

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

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

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

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

            if (A is Obj_Item_Weapon_Grab)
            {
                G = A;

                if (!((Ent_Static)user).Adjacent(G.affecting))
                {
                    return(null);
                }
                grabbed = G.affecting;

                if (grabbed is Mob_Living_Carbon_Monkey)
                {
                    target = grabbed;

                    if (target.stat == 0)
                    {
                        user.WriteMsg("<span class='warning'>The monkey is struggling far too much to put it in the recycler.</span>");
                        return(null);
                    }

                    if (target.buckled != null || Lang13.Bool(target.buckled_mob))
                    {
                        user.WriteMsg("<span class='warning'>The monkey is attached to something.</span>");
                        return(null);
                    }

                    if (!Lang13.Bool(user.drop_item()))
                    {
                        return(null);
                    }
                    GlobalFuncs.qdel(target);
                    user.WriteMsg("<span class='notice'>You stuff the monkey into the machine.</span>");
                    GlobalFuncs.playsound(this.loc, "sound/machines/juicer.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", 200));
                    this.f_use_power(500);
                    this.grinded++;
                    Task13.Sleep(50);
                    this.pixel_x = Convert.ToInt32(Lang13.Initial(this, "pixel_x"));
                    user.WriteMsg(new Txt("<span class='notice'>The machine now has ").item(this.grinded).str(" monkey").s().str(" worth of material stored.</span>").ToString());
                }
                else
                {
                    user.WriteMsg("<span class='danger'>The machine only accepts monkeys!</span>");
                }
            }
            return(null);
        }
Example #23
0
        // Function from file: gibber.dm
        public void startgibbing(dynamic user = null)
        {
            int        offset              = 0;
            dynamic    sourcename          = null;
            dynamic    sourcejob           = null;
            dynamic    gibee               = null;
            double     sourcenutriment     = 0;
            double?    sourcetotalreagents = null;
            Type       gibtype             = null;
            ByTable    allmeat             = null;
            dynamic    allskin             = null;
            dynamic    gibee2              = null;
            dynamic    C            = null;
            double     i            = 0;
            dynamic    newmeat      = null;
            dynamic    newskin      = null;
            double?    i2           = null;
            ByTable    nearby_turfs = null;
            Ent_Static meatslab     = null;
            dynamic    skin         = null;
            double     turfs        = 0;
            dynamic    gibturf      = null;


            if (this.operating)
            {
                return;
            }

            if (!Lang13.Bool(this.occupant))
            {
                this.visible_message("<span class='italics'>You hear a loud metallic grinding sound.</span>");
                return;
            }
            this.f_use_power(1000);
            this.visible_message("<span class='italics'>You hear a loud squelchy grinding sound.</span>");
            GlobalFuncs.playsound(this.loc, "sound/machines/juicer.ogg", 50, 1);
            this.operating = true;
            this.update_icon();
            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", 200));
            sourcename = this.occupant.real_name;

            if (this.occupant is Mob_Living_Carbon_Human)
            {
                gibee     = this.occupant;
                sourcejob = gibee.job;
            }
            sourcenutriment     = this.occupant.nutrition / 15;
            sourcetotalreagents = this.occupant.reagents.total_volume;
            gibtype             = typeof(Obj_Effect_Decal_Cleanable_Blood_Gibs);
            allmeat             = new ByTable(this.meat_produced);

            if (this.occupant is Mob_Living_Carbon_Human)
            {
                gibee2 = this.occupant;

                if (Lang13.Bool(gibee2.dna) && Lang13.Bool(gibee2.dna.species))
                {
                    this.typeofmeat = gibee2.dna.species.meat;
                    this.typeofskin = gibee2.dna.species.skinned_type;
                }
                else
                {
                    this.typeofmeat = typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks_Meat_Slab_Human);
                    this.typeofskin = typeof(Obj_Item_Stack_Sheet_Animalhide_Human);
                }
            }
            else if (this.occupant is Mob_Living_Carbon)
            {
                C = this.occupant;
                this.typeofmeat = C.type_of_meat;
                gibtype         = C.gib_type;
            }

            foreach (dynamic _a in Lang13.IterateRange(1, this.meat_produced))
            {
                i = _a;

                newmeat             = Lang13.Call(this.typeofmeat);
                newskin             = Lang13.Call(this.typeofskin);
                newmeat.name        = sourcename + newmeat.name;
                newmeat.subjectname = sourcename;

                if (Lang13.Bool(sourcejob))
                {
                    newmeat.subjectjob = sourcejob;
                }
                newmeat.reagents.add_reagent("nutriment", sourcenutriment / this.meat_produced);
                ((Reagents)this.occupant.reagents).trans_to(newmeat, Num13.Round((sourcetotalreagents ?? 0) / this.meat_produced, 1));
                allmeat[i] = newmeat;
                allskin    = newskin;
            }
            GlobalFuncs.add_logs(user, this.occupant, "gibbed");
            ((Mob)this.occupant).death(true);
            ((Mob)this.occupant).ghostize();
            GlobalFuncs.qdel(this.occupant);
            Task13.Schedule(((int)(this.gibtime)), (Task13.Closure)(() => {
                GlobalFuncs.playsound(this.loc, "sound/effects/splat.ogg", 50, 1);
                this.operating = false;

                foreach (dynamic _c in Lang13.IterateRange(1, this.meat_produced))
                {
                    i2 = _c;

                    nearby_turfs = Map13.FetchInRangeExcludeThis(GlobalFuncs.get_turf(this), 3);
                    meatslab     = allmeat[i2];
                    skin         = allskin;
                    meatslab.loc = this.loc;
                    skin.loc     = this.loc;
                    ((dynamic)meatslab).throw_at_fast(Rand13.PickFromTable(nearby_turfs), i2, 3);
                    ((Ent_Dynamic)skin).throw_at_fast(Rand13.PickFromTable(nearby_turfs), i2, 3);

                    foreach (dynamic _b in Lang13.IterateRange(1, this.meat_produced * 3))
                    {
                        turfs = _b;

                        gibturf = Rand13.PickFromTable(nearby_turfs);

                        if (Map13.FetchViewers(null, gibturf).Contains(!gibturf.density && this != null))
                        {
                            Lang13.Call(gibtype, gibturf, i2);
                        }
                    }
                }
                this.pixel_x   = Convert.ToInt32(Lang13.Initial(this, "pixel_x"));
                this.operating = false;
                this.update_icon();
                return;
            }));
            return;
        }
Example #24
0
        // Function from file: processor.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            double  total_time = 0;
            dynamic O          = null;
            dynamic P          = null;
            int     offset     = 0;
            dynamic O2         = null;
            dynamic P2         = null;


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

            if (this.processing)
            {
                a.WriteMsg("<span class='warning'>The processor is in the process of processing!</span>");
                return(1);
            }

            if (this.contents.len == 0)
            {
                a.WriteMsg("<span class='warning'>The processor is empty!</span>");
                return(1);
            }
            this.processing = true;
            ((Ent_Static)a).visible_message("" + a + " turns on " + this + ".", "<span class='notice'>You turn on " + this + ".</span>", "<span class='italics'>You hear a food processor.</span>");
            GlobalFuncs.playsound(this.loc, "sound/machines/blender.ogg", 50, 1);
            this.f_use_power(500);
            total_time = 0;

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

                P = this.select_recipe(O);

                if (!Lang13.Bool(P))
                {
                    GlobalFuncs.log_admin("DEBUG: " + O + " in processor havent suitable recipe. How do you put it in?");
                    continue;
                }
                total_time += Convert.ToDouble(P.time);
            }
            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", total_time / Convert.ToDouble(this.rating_speed) * 5));
            Task13.Sleep(((int)(total_time / Convert.ToDouble(this.rating_speed))));

            foreach (dynamic _b in Lang13.Enumerate(this.contents))
            {
                O2 = _b;

                P2 = this.select_recipe(O2);

                if (!Lang13.Bool(P2))
                {
                    GlobalFuncs.log_admin("DEBUG: " + O2 + " in processor havent suitable recipe. How do you put it in?");
                    continue;
                }
                ((FoodProcessorProcess)P2).process_food(this.loc, O2, this);
            }
            this.pixel_x    = Convert.ToInt32(Lang13.Initial(this, "pixel_x"));
            this.processing = false;
            this.visible_message(new Txt().the(this).item().str(" finishes processing.").ToString());
            return(null);
        }