AddGameEvent() public static method

public static AddGameEvent ( EnvironmentObject env, IntVector3 location, string format ) : void
env EnvironmentObject
location IntVector3
format string
return void
Esempio n. 1
0
        void IJobObserver.OnObservableJobStatusChanged(IJob job, JobStatus status)
        {
            var j = (StoreToStockpileJob)job;

            switch (status)
            {
            case JobStatus.Done:
                j.Item.StockpiledBy = this;
                break;

            case JobStatus.Abort:
            case JobStatus.Fail:
                Events.AddGameEvent(j.Item, "failed to store item to stockpile");
                break;

            default:
                throw new Exception();
            }

            Debug.Assert(j.Item.ReservedBy == this);
            j.Item.ReservedBy = null;

            m_jobs.Remove(j);

            this.Environment.World.Jobs.Remove(j);
        }
Esempio n. 2
0
        void HandleReport(MoveActionReport report)
        {
            var living = m_world.FindObject <LivingObject>(report.LivingObjectID);

            if (report.Success == false && living.IsControllable)
            {
                Events.AddGameEvent(living, "{0} failed to move {1}: {2}", living, report.Direction, report.FailReason);
            }
            //else
            //	Events.AddGameEvent(living, "{0} moved {1}", living, report.Direction);
        }
Esempio n. 3
0
        void HandleReport(HaulActionReport report)
        {
            var living   = m_world.FindObject <LivingObject>(report.LivingObjectID);
            var itemName = GetPrintableItemName(report.ItemObjectID);

            if (report.Success == false)
            {
                Events.AddGameEvent(living, "{0} failed to haul {1} to {2}: {3}", living, itemName, report.Direction, report.FailReason);
            }
            //else
            //	Events.AddGameEvent(living, "{0} hauled {1} to {2}", living, itemName, report.Direction);
        }
Esempio n. 4
0
        void HandleReport(SleepActionReport report)
        {
            var living = m_world.FindObject <LivingObject>(report.LivingObjectID);

            if (report.Success == false)
            {
                Events.AddGameEvent(living, "{0} fails to sleep: {1}", living, report.FailReason);
            }
            else if (m_verboseReports)
            {
                Events.AddGameEvent(living, "{0} wakes up", living);
            }
        }
Esempio n. 5
0
        void HandleReport(FellTreeActionReport report)
        {
            var living = m_world.FindObject <LivingObject>(report.LivingObjectID);

            if (report.Success)
            {
                Events.AddGameEvent(living, "{0} fells {1} {2}", living, report.MaterialID, report.TileID);
            }
            else
            {
                Events.AddGameEvent(living, "{0} fails to fell tree: {1}", living, report.FailReason);
            }
        }
Esempio n. 6
0
        void HandleReport(ConstructActionReport report)
        {
            var living = m_world.FindObject <LivingObject>(report.LivingObjectID);

            if (report.Success)
            {
                Events.AddGameEvent(living, "{0} constructs {1}", living, report.Mode);
            }
            else
            {
                Events.AddGameEvent(living, "{0} fails to construct {1}: {2}", living, report.Mode, report.FailReason);
            }
        }
Esempio n. 7
0
		IJobGroup CreateJob(BuildOrder order)
		{
			var ok = FindMaterials(order);

			if (!ok)
			{
				Events.AddGameEvent(this.Workbench, "Failed to find materials for {0}.", this.CurrentBuildOrder.BuildableItemID);
				return null;
			}

			var job = new Jobs.JobGroups.BuildItemJob(this, this.Workbench, order.BuildableItem.Key, order.SourceItems);
			this.Environment.World.Jobs.Add(job);
			return job;
		}
Esempio n. 8
0
        void HandleReport(BuildItemActionReport report)
        {
            var living = m_world.FindObject <LivingObject>(report.LivingObjectID);
            var item   = m_world.FindObject <ItemObject>(report.ItemObjectID);

            if (report.Success)
            {
                Events.AddGameEvent(living, "{0} builds item {1}", living, item);
            }
            else
            {
                Events.AddGameEvent(living, "{0} fails to build item {1}: {2}", living, report.BuildableItemKey, report.FailReason);
            }
        }
Esempio n. 9
0
        void HandleItemActionReport(ItemActionReport report, string verb1, string verb2, bool verboseReportMode = false)
        {
            var living   = m_world.FindObject <LivingObject>(report.LivingObjectID);
            var itemName = GetPrintableItemName(report.ItemObjectID);

            if (report.Success == false)
            {
                Events.AddGameEvent(living, "{0} failed to {1} {2}: {3}", living, verb2, itemName, report.FailReason);
            }
            else if (verboseReportMode == false || m_verboseReports)
            {
                Events.AddGameEvent(living, "{0} {1} {2}", living, verb1, itemName);
            }
        }
Esempio n. 10
0
        void HandleReport(MineActionReport report)
        {
            var living = m_world.FindObject <LivingObject>(report.LivingObjectID);

            if (report.Success)
            {
                switch (report.MineActionType)
                {
                case MineActionType.Mine:
                    Events.AddGameEvent(living, "{0} mines {1} ({2})", living, report.Location, report.Direction);
                    break;

                case MineActionType.Stairs:
                    Events.AddGameEvent(living, "{0} creates stairs {1} ({2})", living, report.Location, report.Direction);
                    break;
                }
            }
            else
            {
                Events.AddGameEvent(living, "{0} fails to mine {1} ({2}): {3}", living, report.Location, report.Direction, report.FailReason);
            }
        }
Esempio n. 11
0
        void HandleReport(AttackActionReport report)
        {
            var    attacker = m_world.FindObject <LivingObject>(report.LivingObjectID);
            string aname    = attacker != null?attacker.ToString() : "somebody";

            string tname = GetPrintableLivingName(report.TargetObjectID);

            if (!report.Success)
            {
                Events.AddGameEvent(attacker, "{0} fails to attack {1}: {2}", aname, tname, report.FailReason);
                return;
            }

            string msg;

            if (report.IsHit)
            {
                switch (report.DamageCategory)
                {
                case DamageCategory.None:
                    msg = String.Format("{0} hits {1}, dealing {2} damage", aname, tname, report.Damage);
                    break;

                case DamageCategory.Melee:
                    msg = String.Format("{0} hits {1}, dealing {2} damage", aname, tname, report.Damage);
                    break;

                default:
                    throw new Exception();
                }
            }
            else
            {
                msg = String.Format("{0} misses {1}", aname, tname);
            }

            Events.AddGameEvent(attacker, msg);
        }
Esempio n. 12
0
        void HandleReport(DeathReport report)
        {
            var target = m_world.FindObject <LivingObject>(report.LivingObjectID);

            Events.AddGameEvent(target, "{0} dies", target);
        }