Exemplo n.º 1
0
        public static bool GoToBuilding(this HumanAI humanAI, uint citizenId, ref Citizen citizen, ushort buildingId, bool ignoreSameBuilding = false)
        {
            if (citizen.CanMove() && (citizen.GetBuilding() != buildingId || ignoreSameBuilding))
            {
                var currentBuildingId = citizen.GetBuilding();
                var moving            = humanAI.StartMoving(citizenId, ref citizen, currentBuildingId, buildingId);

                if (buildingId != citizen.WorkBuilding() && buildingId != citizen.HomeBuilding())
                {
                    citizen.SetVisitplace(citizenId, buildingId, 0U);
                }
                else
                {
                    citizen.SetVisitplace(citizenId, 0, 0U);
                }

                return(moving);
            }

            return(false);
        }