Example #1
0
        // Flammable objects have a chance to get set on fire. Fire also produces light.
        private void ProcessFire(MapHandler map)
        {
            if (map.TryGetDoor(Loc, out Door door))
            {
                // TODO: create an actor burning implementation
                // Q: do doors behave like items or actors when burned?
                MaterialProperty material = door.Parameters.Material.ToProperty();
                if (Game.Random.NextDouble() < material.Flammability.ToIgniteChance())
                {
                    door.Open();
                }
            }

            map.GetStack(Loc).MatchSome(stack =>
            {
                stack.SetFire();
                map.RemoveStackIfEmpty(Loc);
            });

            map.ComputeFov(Loc, Constants.LIGHT_DECAY, false);
        }