public ObjectMoveChange(MovableObject mover, ContainerObject sourceEnv, IntPoint3 sourceLocation, ContainerObject destinationEnv, IntPoint3 destinationLocation) : base(mover) { this.Source = sourceEnv; this.SourceLocation = sourceLocation; this.Destination = destinationEnv; this.DestinationLocation = destinationLocation; }
public ObjectMoveLocationChange(MovableObject mover, IntVector3 sourceLocation, IntVector3 destinationLocation) : base(mover) { this.SourceLocation = sourceLocation; this.DestinationLocation = destinationLocation; }
internal void MoveChild(MovableObject ob, IntPoint3 srcLoc, IntPoint3 dstLoc) { OnChildMoved(ob, srcLoc, dstLoc); }
protected virtual void OnChildAdded(MovableObject child) { }
protected virtual void OnChildRemoved(MovableObject child) { }
public virtual bool OkToMoveChild(MovableObject ob, Direction dir, IntPoint3 dstLoc) { return true; }
protected virtual void OnChildMoved(MovableObject child, IntVector3 srcLoc, IntVector3 dstLoc) { }
protected override void OnChildMoved(MovableObject child, IntVector3 srcLoc, IntVector3 dstLoc) { if (srcLoc.Z == dstLoc.Z) return; var list = m_contentArray[srcLoc.Z]; Debug.Assert(list.Contains(child)); list.Remove(child); list = m_contentArray[dstLoc.Z]; Debug.Assert(!list.Contains(child)); list.Add(child); }
protected override void OnChildRemoved(MovableObject child) { var list = m_contentArray[child.Z]; Debug.Assert(list.Contains(child)); list.Remove(child); }
public override bool OkToMoveChild(MovableObject ob, Direction dir, IntVector3 dstLoc) { return EnvironmentExtensions.CanMoveFromTo(this, ob.Location, dir); }
public override bool OkToAddChild(MovableObject ob, IntVector3 p) { Debug.Assert(this.World.IsWritable); if (!this.Contains(p)) return false; return true; }
public override bool OkToMoveChild(MovableObject ob, Direction dir, IntVector3 dstLoc) { return(EnvironmentExtensions.CanMoveFromTo(this, ob.Location, dir)); }
internal void AddChild(MovableObject ob) { m_contents.Add(ob); OnChildAdded(ob); }
internal void RemoveChild(MovableObject ob) { OnChildRemoved(ob); m_contents.Remove(ob); }
protected virtual void OnChildMoved(MovableObject child, IntPoint3 srcLoc, IntPoint3 dstLoc) { }
public virtual bool OkToAddChild(MovableObject ob, IntPoint3 dstLoc) { return true; }
internal void AddChild(MovableObject ob) { m_children.Add(ob); OnChildAdded(ob); }
internal void MoveChild(MovableObject ob, IntVector3 srcLoc, IntVector3 dstLoc) { OnChildMoved(ob, srcLoc, dstLoc); }
internal void RemoveChild(MovableObject ob) { OnChildRemoved(ob); m_children.Remove(ob); }
public virtual bool OkToAddChild(MovableObject ob, IntVector3 dstLoc) { return(true); }
public override bool OkToAddChild(MovableObject ob, IntVector3 dstLoc) { if (this.ItemInfo.IsContainer == false) throw new Exception(); return true; }
public virtual bool OkToMoveChild(MovableObject ob, Direction dir, IntVector3 dstLoc) { return(true); }
public ObjectMoveLocationChange(MovableObject mover, IntPoint3 sourceLocation, IntPoint3 destinationLocation) : base(mover) { this.SourceLocation = sourceLocation; this.DestinationLocation = destinationLocation; }
bool CanSeeChange(Change change) { if (change is TurnStartChange) { // XXX Maybe this should be sent only if the player sees the Living return(true); } else if (change is TurnEndChange) { // XXX Maybe this should be sent only if the player sees the Living return(true); } else if (change is TickStartChange) { return(true); } else if (change is GameDateChange) { return(true); } else if (change is ObjectDestructedChange) { // XXX We should only send this if the player sees the object. // And the client should have a cleanup of some kind to remove old objects (which may or may not be destructed) return(true); } else if (change is ObjectCreatedChange) { return(false); } else if (change is ObjectMoveChange) { var c = (ObjectMoveChange)change; if (m_player.IsController(c.Object)) { return(true); } if (m_player.Sees(c.Source, c.SourceLocation)) { return(true); } if (m_player.Sees(c.Destination, c.DestinationLocation)) { return(true); } return(false); } else if (change is ObjectMoveLocationChange) { var c = (ObjectMoveLocationChange)change; if (m_player.IsController(c.Object)) { return(true); } // XXX var env = ((MovableObject)c.Object).Container; if (m_player.Sees(env, c.SourceLocation)) { return(true); } if (m_player.Sees(env, c.DestinationLocation)) { return(true); } return(false); } else if (change is MapChange) { var c = (MapChange)change; return(m_player.Sees(c.Environment, c.Location)); } else if (change is PropertyChange) { var c = (PropertyChange)change; // fast path for controllables if (m_player.IsController(c.Object)) { return(true); } if (c.PropertyID == PropertyID.IsEquipped) { // XXX special handling for IsEquipped for now // We see the prop change even if the item is inside a non-controllable var mo = (MovableObject)c.Object; for (MovableObject o = mo; o != null; o = o.Container as MovableObject) { var ov = m_player.GetObjectVisibility(o); if ((ov & ObjectVisibility.Public) != 0) { return(true); } } return(false); } else { var vis = PropertyVisibilities.GetPropertyVisibility(c.PropertyID); var ov = m_player.GetObjectVisibility(c.Object); return((ov & vis) != 0); } } else if (change is ActionStartedChange) { var c = (ActionStartedChange)change; return(m_player.IsController(c.Object)); } else if (change is ActionProgressChange) { var c = (ActionProgressChange)change; return(m_player.IsController(c.Object)); } else if (change is ActionDoneChange) { var c = (ActionDoneChange)change; return(m_player.IsController(c.Object)); } else if (change is ObjectChange) { var c = (ObjectChange)change; var vis = m_player.GetObjectVisibility(c.Object); return(vis != ObjectVisibility.None); } else { throw new Exception(); } }