/* Thor Server 2.0 Project - Codenamed "Stockholm" Copyright 2008 - 2009 Joe Hegarty This file is part of The Thor Server 2.0 Project - Codenamed "Stockholm". The Thor Server 2.0 Project - Codenamed "Stockholm" is free software: you can redistribute it and/or modify it under the terms of the Microsoft Public License The Thor Server Project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Microsoft Public License for more details. You should have received a copy of the Microsoft Public License along with The Thor Server Project. If not, see http://www.opensource.org/licenses/ms-pl.html */ using System; using System.Collections.Generic; using StockholmLibrary.Game.Flats; using StockholmLibrary.Game.Sessions; using StockholmLibrary.Game.Packets.Client; using StockholmLibrary.Game.Packets.Server; using StockholmLibrary.Net; using StockholmLibrary.Util; namespace StockholmLibrary.Game.Entities.Components { //------------------------------------ public class ECCreatureStatus : EntityComponentRoomChild { bool _dirty = false; List _extraStatuses = new List(); //********************************************** public void AddExtraStatus(CreatureStatus.ExtraStatus status) { _extraStatuses.Add(status); _dirty = true; } //********************************************** public void MarkAsDirty() { _dirty = true; } //********************************************** public CreatureStatus GetNextStatus(bool force) { if (_dirty == false && force == false) return null; _dirty = false; CreatureStatus creatureStatus = new CreatureStatus(); ECCreature ecCreature = null; if (GetParentEntity().GetEC(ref ecCreature)) { creatureStatus.CreatureID = ecCreature.ID; } ECPhysics ecPhysics = null; if (GetParentEntity().GetEC(ref ecPhysics)) { creatureStatus.Position.Copy(ecPhysics.Position); creatureStatus.Orientation = ecPhysics.Orientation; } creatureStatus.ExtraStatuses.AddRange(_extraStatuses); _extraStatuses.Clear(); return creatureStatus; } } }