public void Paintsplat(Vector3Int worldPosInt, Vector3Int localPosInt, ReagentMix reagents)
    {
        switch (ChemistryUtils.GetMixStateDescription(reagents))
        {
        case "powder":
        {
            EffectsFactory.PowderSplat(worldPosInt, reagents.MixColor, reagents);
            break;
        }

        case "liquid":
        {
            //TODO: Work out if reagent is "slippery" according to its viscocity (not modeled yet)
            EffectsFactory.ChemSplat(worldPosInt, reagents.MixColor, reagents);
            break;
        }

        case "gas":
            //TODO: Make gas reagents release into the atmos.
            break;

        default:
        {
            EffectsFactory.ChemSplat(worldPosInt, reagents.MixColor, reagents);
            break;
        }
        }
    }
Exemple #2
0
    /// <summary>
    /// Release reagents at provided coordinates, making them react with world
    /// </summary>
    public void ReagentReact(Dictionary <string, float> reagents, Vector3Int worldPosInt, Vector3Int localPosInt)
    {
        if (MatrixManager.IsTotallyImpassable(worldPosInt, true))
        {
            return;
        }

        bool didSplat = false;

        foreach (KeyValuePair <string, float> reagent in reagents)
        {
            if (reagent.Value < 1)
            {
                continue;
            }
            if (reagent.Key == "water")
            {
                matrix.ReactionManager.ExtinguishHotspot(localPosInt);

                foreach (var livingHealthBehaviour in matrix.Get <LivingHealthBehaviour>(localPosInt, true))
                {
                    livingHealthBehaviour.Extinguish();
                }

                Clean(worldPosInt, localPosInt, true);
            }
            else if (reagent.Key == "cleaner")
            {
                Clean(worldPosInt, localPosInt, false);
            }
            else if (reagent.Key == "welding_fuel")
            {
                //temporary: converting spilled fuel to plasma
                Get(localPosInt).GasMix.AddGas(Gas.Plasma, reagent.Value);
            }
            else if (reagent.Key == "lube")
            {             //( ͡° ͜ʖ ͡°)
                if (!Get(localPosInt).IsSlippery)
                {
                    EffectsFactory.WaterSplat(worldPosInt);
                    MakeSlipperyAt(localPosInt, false);
                }
            }
            else
            {             //for all other things leave a chem splat
                if (!didSplat)
                {
                    EffectsFactory.ChemSplat(worldPosInt);
                    didSplat = true;
                }
            }
        }
    }
    /// <summary>
    /// Release reagents at provided coordinates, making them react with world
    /// </summary>
    public void ReagentReact(ReagentMix reagents, Vector3Int worldPosInt, Vector3Int localPosInt)
    {
        if (MatrixManager.IsTotallyImpassable(worldPosInt, true))
        {
            return;
        }

        bool didSplat = false;

        foreach (var reagent in reagents)
        {
            if (reagent.Value < 1)
            {
                continue;
            }

            switch (reagent.Key.name)
            {
            case "Water":
            {
                matrix.ReactionManager.ExtinguishHotspot(localPosInt);

                foreach (var livingHealthBehaviour in matrix.Get <LivingHealthBehaviour>(localPosInt, true))
                {
                    livingHealthBehaviour.Extinguish();
                }

                Clean(worldPosInt, localPosInt, true);
                break;
            }

            case "SpaceCleaner":
                Clean(worldPosInt, localPosInt, false);
                break;

            case "WeldingFuel":
                //temporary: converting spilled fuel to plasma
                Get(localPosInt).GasMix.AddGas(Gas.Plasma, reagent.Value);
                break;

            case "SpaceLube":
            {
                //( ͡° ͜ʖ ͡°)
                if (!Get(localPosInt).IsSlippery)
                {
                    EffectsFactory.WaterSplat(worldPosInt);
                    MakeSlipperyAt(localPosInt, false);
                }

                break;
            }

            default:
            {
                //for all other things leave a chem splat
                if (!didSplat)
                {
                    EffectsFactory.ChemSplat(worldPosInt, reagents.MixColor);
                    didSplat = true;
                }

                break;
            }
            }
        }
    }