Example #1
0
    public override void Started()
    {
        base.Started();

        // TODO: "safe random" for chems. Right now this includes admin chemicals.
        var allReagents = PrototypeManager.EnumeratePrototypes <ReagentPrototype>()
                          .Where(x => !x.Abstract)
                          .Select(x => x.ID).ToList();

        // This is gross, but not much can be done until event refactor, which needs Dynamic.
        var sound = new SoundPathSpecifier("/Audio/Effects/extinguish.ogg");

        foreach (var(_, transform) in EntityManager.EntityQuery <GasVentPumpComponent, TransformComponent>())
        {
            var solution = new Solution();

            if (!RobustRandom.Prob(0.33f))
            {
                continue;
            }

            if (RobustRandom.Prob(0.05f))
            {
                solution.AddReagent(RobustRandom.Pick(allReagents), 100);
            }
            else
            {
                solution.AddReagent(RobustRandom.Pick(SafeishVentChemicals), 100);
            }

            FoamAreaReactionEffect.SpawnFoam("Foam", transform.Coordinates, solution, RobustRandom.Next(2, 6), 20, 1,
                                             1, sound, EntityManager);
        }
    }