private void OnExamined(EntityUid uid, PerishableComponent component, ExaminedEvent args)
 {
     if (component.Rotting)
     {
         args.PushMarkup(Loc.GetString("miasma-rotting"));
     }
 }
 private void OnMobStateChanged(EntityUid uid, PerishableComponent component, MobStateChangedEvent args)
 {
     if (args.Component.IsDead())
     {
         EnsureComp <RottingComponent>(uid);
     }
 }
        private void OnGibbed(EntityUid uid, PerishableComponent component, BeingGibbedEvent args)
        {
            if (!TryComp <PhysicsComponent>(uid, out var physics))
            {
                return;
            }

            if (!component.Rotting)
            {
                return;
            }

            var molsToDump = (component.MolsPerSecondPerUnitMass * physics.FixturesMass) * component.DeathAccumulator;
            var transform  = Transform(uid);
            var indices    = _transformSystem.GetGridOrMapTilePosition(uid, transform);
            var tileMix    = _atmosphereSystem.GetTileMixture(transform.GridUid, null, indices, true);

            tileMix?.AdjustMoles(Gas.Miasma, molsToDump);

            // Waste of entities to let these through
            foreach (var part in args.GibbedParts)
            {
                EntityManager.DeleteEntity(part);
            }
        }
Esempio n. 4
0
        private void OnGibbed(EntityUid uid, PerishableComponent component, BeingGibbedEvent args)
        {
            if (!TryComp <PhysicsComponent>(uid, out var physics))
            {
                return;
            }

            if (!component.Rotting)
            {
                return;
            }

            var molsToDump = (component.MolsPerSecondPerUnitMass * physics.FixturesMass) * component.DeathAccumulator;
            var tileMix    = _atmosphereSystem.GetTileMixture(Transform(uid).Coordinates);

            if (tileMix != null)
            {
                tileMix.AdjustMoles(Gas.Miasma, molsToDump);
            }

            // Waste of entities to let these through
            foreach (var part in args.GibbedParts)
            {
                EntityManager.DeleteEntity(part);
            }
        }