public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.DisassociateEntity: UnEquipEntity((Entity)list[0]); break; case ComponentMessageType.EquipItemToPart: //Equip an entity straight up. EquipEntityToPart((EquipmentSlot)list[0], (Entity)list[1]); break; case ComponentMessageType.EquipItem: EquipEntity((Entity)list[0]); break; case ComponentMessageType.EquipItemInHand: //Move an entity from a hand to an equipment slot EquipEntityInHand(); break; case ComponentMessageType.UnEquipItemToFloor: //remove an entity from a slot and drop it on the floor UnEquipEntity((Entity)list[0]); break; case ComponentMessageType.UnEquipItemToHand: //remove an entity from a slot and put it in the current hand slot. if (!Owner.HasComponent(ComponentFamily.Hands)) { break; //TODO REAL ERROR MESSAGE OR SOME F**K SHIT } UnEquipEntityToHand((Entity)list[0]); break; case ComponentMessageType.UnEquipItemToSpecifiedHand: //remove an entity from a slot and put it in the current hand slot. if (!Owner.HasComponent(ComponentFamily.Hands)) { break; //TODO REAL ERROR MESSAGE OR SOME F**K SHIT } UnEquipEntityToHand((Entity)list[0], (Hand)list[1]); break; case ComponentMessageType.GetHasInternals: if (HasInternals()) { reply = new ComponentReplyMessage(ComponentMessageType.GetHasInternals, true); } break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.GetCurrentLocationHealth: var location = (BodyPart) list[0]; if (DamageZones.Exists(x => x.Location == location)) { DamageLocation dmgLoc = DamageZones.First(x => x.Location == location); reply = new ComponentReplyMessage(ComponentMessageType.CurrentLocationHealth, location, dmgLoc.UpdateTotalHealth(), dmgLoc.MaxHealth); } break; case ComponentMessageType.GetCurrentHealth: reply = new ComponentReplyMessage(ComponentMessageType.CurrentHealth, GetHealth(), GetMaxHealth()); break; } return reply; }
public override ComponentReplyMessage ReceiveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.ReceiveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.ContextAdd: AddEntry((ContextMenuEntry)list[0]); break; case ComponentMessageType.ContextRemove: RemoveEntryByName((string)list[0]); break; case ComponentMessageType.ContextGetEntries: reply = new ComponentReplyMessage(ComponentMessageType.ContextGetEntries, _entries); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.Damage: ApplyDamage((Entity)list[0], (int)list[1], (DamageType)list[2]); break; case ComponentMessageType.GetCurrentHealth: var reply2 = new ComponentReplyMessage(ComponentMessageType.CurrentHealth, GetHealth(), GetMaxHealth()); reply = reply2; break; } return(reply); }
/// <summary> /// Message handler -- /// SpriteChanged means the spritecomponent changed the current sprite. /// </summary> /// <param name="sender"></param> /// <param name="type"></param> /// <param name="reply"></param> /// <param name="list"></param> public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.SpriteChanged: if (collisionEnabled) { GetAABB(); var cm = IoCManager.Resolve <ICollisionManager>(); cm.UpdateCollidable(this); } break; case ComponentMessageType.DisableCollision: DisableCollision(); break; case ComponentMessageType.EnableCollision: EnableCollision(); break; } return(reply); }
/// <summary> /// Allows components to send messages /// </summary> /// <param name="sender">the component doing the sending</param> /// <param name="type">the type of message</param> /// <param name="args">message parameters</param> public void SendMessage(object sender, ComponentMessageType type, List <ComponentReplyMessage> replies, params object[] args) { //LogComponentMessage(sender, type, args); foreach (Component component in GetComponents()) { //Check to see if the component is still a part of this entity --- collection may change in process. if (_components.ContainsValue(component)) { if (replies != null) { ComponentReplyMessage reply = component.RecieveMessage(sender, type, args); if (reply.MessageType != ComponentMessageType.Empty) { replies.Add(reply); } } else { component.RecieveMessage(sender, type, args); } } } }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.SetSpriteByKey: if (Owner != null) _currentSpriteKey = (string) list[0]; break; case ComponentMessageType.SetBaseName: if (Owner != null) _currentBaseName = (string) list[0]; break; case ComponentMessageType.SetVisible: Visible = (bool) list[0]; break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.ItemEquipped: IsCurrentlyWorn = true; IsCurrentlyCarried = false; break; case ComponentMessageType.ItemUnEquipped: IsCurrentlyWorn = false; break; case ComponentMessageType.Dropped: IsCurrentlyCarried = false; break; case ComponentMessageType.PickedUp: IsCurrentlyCarried = true; break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.GetCurrentLocationHealth: var location = (BodyPart)list[0]; if (DamageZones.Exists(x => x.Location == location)) { DamageLocation dmgLoc = DamageZones.First(x => x.Location == location); reply = new ComponentReplyMessage(ComponentMessageType.CurrentLocationHealth, location, dmgLoc.UpdateTotalHealth(), dmgLoc.MaxHealth); } break; case ComponentMessageType.GetCurrentHealth: reply = new ComponentReplyMessage(ComponentMessageType.CurrentHealth, GetHealth(), GetMaxHealth()); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { // TODO refactor me - GUI should reference component directly rather than doing this message shit case ComponentMessageType.GetCurrentLocationHealth: var location = (BodyPart)list[0]; if (DamageZones.Exists(x => x.Location == location)) { DamageLocation dmgLoc = DamageZones.First(x => x.Location == location); reply = new ComponentReplyMessage(ComponentMessageType.CurrentLocationHealth, location, dmgLoc.UpdateTotalHealth(), dmgLoc.MaxHealth); } break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.ContextAdd: AddEntry((ContextMenuEntry) list[0]); break; case ComponentMessageType.ContextRemove: RemoveEntryByName((string) list[0]); break; case ComponentMessageType.ContextGetEntries: reply = new ComponentReplyMessage(ComponentMessageType.ContextGetEntries, _entries); break; } return reply; }
/// <summary> /// Logs a component message to the messaging profiler /// </summary> /// <param name="sender"></param> /// <param name="type"></param> /// <param name="args"></param> private void LogComponentMessage(object sender, ComponentMessageType type, params object[] args) { if (!_messageProfiling) { return; } var senderfamily = ComponentFamily.Generic; var uid = 0; var sendertype = ""; //if (sender.GetType().IsAssignableFrom(typeof(Component))) if (typeof(Component).IsAssignableFrom(sender.GetType())) { var realsender = (Component)sender; senderfamily = realsender.Family; uid = realsender.Owner.Uid; sendertype = realsender.GetType().ToString(); } else { sendertype = sender.GetType().ToString(); } //Log the message IMessageLogger logger = IoCManager.Resolve <IMessageLogger>(); logger.LogComponentMessage(uid, senderfamily, sendertype, type); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.DisassociateEntity: RemoveFromInventory((IEntity)list[0]); break; case ComponentMessageType.InventoryAdd: // TODO Refactor craftingmanager to access this component directly, not using a message AddToInventory((IEntity)list[0]); break; case ComponentMessageType.InventorySetSize: maxSlots = (int)list[0]; break; } return(reply); }
public static int ConvertComponentMessageTypeToClickType(ComponentMessageType type) { int result = 0; switch (type) { case ComponentMessageType.LeftClick: result = MouseClickType.Left; break; case ComponentMessageType.RightClick: result = MouseClickType.Right; break; case ComponentMessageType.AltLeftClick: result = MouseClickType.LeftAlt; break; case ComponentMessageType.AltRightClick: result = MouseClickType.RightAlt; break; case ComponentMessageType.ShiftLeftClick: result = MouseClickType.LeftShift; break; case ComponentMessageType.ShiftRightClick: result = MouseClickType.RightShift; break; case ComponentMessageType.CtrlLeftClick: result = MouseClickType.LeftCtrl; break; case ComponentMessageType.CtrlRightClick: result = MouseClickType.RightCtrl; break; } return result; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.GetItemInEquipmentSlot: reply = !IsEmpty((EquipmentSlot) list[0]) ? new ComponentReplyMessage(ComponentMessageType.ReturnItemInEquipmentSlot, EquippedEntities[(EquipmentSlot) list[0]]) : new ComponentReplyMessage(ComponentMessageType.ItemSlotEmpty); break; case ComponentMessageType.Die: foreach (Entity entity in EquippedEntities.Values) { entity.SendMessage(this, ComponentMessageType.WearerIsDead); } break; case ComponentMessageType.Live: foreach (Entity entity in EquippedEntities.Values) { entity.SendMessage(this, ComponentMessageType.WearerIsAlive); } break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.DisassociateEntity: RemoveFromInventory((Entity) list[0]); break; case ComponentMessageType.InventoryAdd: // TODO Refactor craftingmanager to access this component directly, not using a message AddToInventory((Entity) list[0]); break; case ComponentMessageType.InventorySetSize: maxSlots = (int) list[0]; break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.InventoryInformation: Owner.SendComponentNetworkMessage(this, NetDeliveryMethod.ReliableUnordered, ComponentMessageType.InventoryInformation); break; case ComponentMessageType.InventoryAdd: SendInventoryAdd((Entity)list[0]); break; case ComponentMessageType.InventoryRemove: SendInventoryRemove((Entity)list[0]); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.DisassociateEntity: RemoveFromInventory((Entity) list[0]); break; case ComponentMessageType.InventoryAdd: AddToInventory((Entity) list[0]); break; case ComponentMessageType.InventoryRemove: RemoveFromInventory((Entity) list[0]); break; case ComponentMessageType.InventoryInformation: reply = new ComponentReplyMessage(ComponentMessageType.InventoryInformation, maxSlots, containedEntities); break; case ComponentMessageType.InventorySetSize: maxSlots = (int) list[0]; break; } return reply; }
public override ComponentReplyMessage ReceiveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.ReceiveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.GetSprite: reply = new ComponentReplyMessage(ComponentMessageType.CurrentSprite, GetBaseSprite()); break; case ComponentMessageType.SetSpriteByKey: SetSpriteByKey((string)list[0]); break; case ComponentMessageType.SlaveAttach: SetMaster(Owner.EntityManager.GetEntity((int)list[0])); break; case ComponentMessageType.ItemUnEquipped: case ComponentMessageType.Dropped: UnsetMaster(); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.WallMountTile: //Attach to a specific tile. var toAttach = (Vector2)list[0]; AttachToTile(toAttach); break; case ComponentMessageType.WallMountSearch: //Look for the best tile to attach to based on owning entity's direction. FindTile(); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.ItemEquipped: IsCurrentlyWorn = true; IsCurrentlyCarried = false; break; case ComponentMessageType.ItemUnEquipped: IsCurrentlyWorn = false; break; case ComponentMessageType.Dropped: IsCurrentlyCarried = false; break; case ComponentMessageType.PickedUp: IsCurrentlyCarried = true; break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.GetActorConnection: reply = new ComponentReplyMessage(ComponentMessageType.ReturnActorConnection, playerSession.ConnectedClient); break; case ComponentMessageType.GetActorSession: reply = new ComponentReplyMessage(ComponentMessageType.ReturnActorSession, playerSession); break; case ComponentMessageType.Die: playerSession.AddPostProcessingEffect(PostProcessingEffectType.Death, -1); IoCManager.Resolve <IRoundManager>().CurrentGameMode.PlayerDied(playerSession); // Tell the current game mode a player just died break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.ItemEquipped: HandleEquipped((Entity)list[0]); break; case ComponentMessageType.ItemUnEquipped: HandleUnEquipped(); break; case ComponentMessageType.GetWearLoc: reply = new ComponentReplyMessage(ComponentMessageType.ReturnWearLoc, wearloc); break; } return(reply); }
public override ComponentReplyMessage ReceiveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.ReceiveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.SetSpriteByKey: if (Owner != null) { _currentSpriteKey = (string)list[0]; } break; case ComponentMessageType.SetBaseName: if (Owner != null) { _currentBaseName = (string)list[0]; } break; case ComponentMessageType.SetVisible: Visible = (bool)list[0]; break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.GetActorConnection: reply = new ComponentReplyMessage(ComponentMessageType.ReturnActorConnection, playerSession.ConnectedClient); break; case ComponentMessageType.GetActorSession: reply = new ComponentReplyMessage(ComponentMessageType.ReturnActorSession, playerSession); break; case ComponentMessageType.Die: playerSession.AddPostProcessingEffect(PostProcessingEffectType.Death, -1); IoCManager.Resolve<IRoundManager>().CurrentGameMode.PlayerDied(playerSession); // Tell the current game mode a player just died break; } return reply; }
public BaseComponentMessageRp(string key, string value, ComponentMessageType type) { ComponentMessageId = Guid.NewGuid(); ComponentMessageType = type; Version = 1; Key = key; Value = value; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = ComponentReplyMessage.Empty; if (type != ComponentMessageType.Damage) { reply = base.RecieveMessage(sender, type, list); } if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.GetCurrentLocationHealth: var location = (BodyPart)list[0]; if (damageZones.Exists(x => x.location == location)) { DamageLocation dmgLoc = damageZones.First(x => x.location == location); var reply1 = new ComponentReplyMessage(ComponentMessageType.CurrentLocationHealth, location, dmgLoc.UpdateTotalHealth(), dmgLoc.maxHealth); reply = reply1; } break; case ComponentMessageType.GetCurrentHealth: var reply2 = new ComponentReplyMessage(ComponentMessageType.CurrentHealth, GetHealth(), GetMaxHealth()); reply = reply2; break; case ComponentMessageType.Damage: if (list.Count() > 3) //We also have a target location { ApplyDamage((Entity)list[0], (int)list[1], (DamageType)list[2], (BodyPart)list[3]); } else //We dont have a target location { ApplyDamage((Entity)list[0], (int)list[1], (DamageType)list[2]); } break; case ComponentMessageType.Heal: if (list.Count() > 3) // We also have a target location { ApplyHeal((Entity)list[0], (int)list[1], (DamageType)list[2], (BodyPart)list[3]); } break; } return(reply); }
/// <inheritdoc /> public virtual ComponentReplyMessage ReceiveMessage(object sender, ComponentMessageType type, params object[] list) { var reply = ComponentReplyMessage.Empty; if (sender == this) //Don't listen to our own messages! { return(reply); } return(reply); }
public void SendMessage(object sender, ComponentMessageType type, params object[] args) { foreach (IComponent component in GetComponents()) { if (_components.Contains(component)) { //Check to see if the component is still a part of this entity --- collection may change in process. component.ReceiveMessage(sender, type, args); } } }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { switch (type) { case ComponentMessageType.GetArmorValues: var dmgType = (DamageType)list[0]; return(new ComponentReplyMessage(ComponentMessageType.ReturnArmorValues, GetArmorValue(dmgType))); default: return(base.RecieveMessage(sender, type, list)); } }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { switch (type) { case ComponentMessageType.GetArmorValues: var dmgType = (DamageType) list[0]; return new ComponentReplyMessage(ComponentMessageType.ReturnArmorValues, GetArmorValue(dmgType)); default: return base.RecieveMessage(sender, type, list); } }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { } return reply; }
public void LogComponentMessage(int uid, ComponentFamily senderfamily, string sendertype, ComponentMessageType type) { if (!_logging) return; try { _loggerServiceClient.LogServerComponentMessage(uid, (int) senderfamily, sendertype, (int) type); } catch (CommunicationException e) { } }
/// <summary> /// Recieve a message from another component within the owner entity /// </summary> /// <param name="sender">the component that sent the message</param> /// <param name="type">the message type in CGO.MessageType</param> /// <param name="list">parameters list</param> public virtual ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = ComponentReplyMessage.Empty; if (sender == this) //Don't listen to our own messages! { return(reply); } // Leaving this gap here in case anybody wants to add something later. return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); // Console.WriteLine("Script trigger! {0}", type.ToString()); if (sender == this) return ComponentReplyMessage.Empty; string funcName = type.ToString(); // Console.WriteLine("Script trigger! {0}", funcName); if (lua[funcName] != null) // Does this function exist? CallLuaFunction(funcName, list); return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(ComponentReplyMessage.Empty); } switch (type) { } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.SendPositionUpdate: SendPositionUpdate(true); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.SlaveAttach: Attach((int) list[0]); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.PhysicsMove: Translate((float) list[0], (float) list[1]); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return reply; switch (type) { case ComponentMessageType.ClickedInHand: DispatchInHandClick((int) list[0]); break; } return reply; }
public void LogComponentMessage(int uid, ComponentFamily senderfamily, string sendertype, ComponentMessageType type) { if (!_logging) { return; } try { _loggerServiceClient.LogClientComponentMessage(uid, (int)senderfamily, sendertype, (int)type); } catch (CommunicationException e) { } }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.DisassociateEntity: UnEquipEntity((Entity) list[0]); break; case ComponentMessageType.EquipItemToPart: //Equip an entity straight up. EquipEntityToPart((EquipmentSlot) list[0], (Entity) list[1]); break; case ComponentMessageType.EquipItem: EquipEntity((Entity) list[0]); break; case ComponentMessageType.EquipItemInHand: //Move an entity from a hand to an equipment slot EquipEntityInHand(); break; case ComponentMessageType.UnEquipItemToFloor: //remove an entity from a slot and drop it on the floor UnEquipEntity((Entity) list[0]); break; case ComponentMessageType.UnEquipItemToHand: //remove an entity from a slot and put it in the current hand slot. if (!Owner.HasComponent(ComponentFamily.Hands)) break; //TODO REAL ERROR MESSAGE OR SOME F**K SHIT UnEquipEntityToHand((Entity) list[0]); break; case ComponentMessageType.UnEquipItemToSpecifiedHand: //remove an entity from a slot and put it in the current hand slot. if (!Owner.HasComponent(ComponentFamily.Hands)) break; //TODO REAL ERROR MESSAGE OR SOME F**K SHIT UnEquipEntityToHand((Entity) list[0], (Hand) list[1]); break; case ComponentMessageType.GetHasInternals: if (HasInternals()) { reply = new ComponentReplyMessage(ComponentMessageType.GetHasInternals, true); } break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return reply; switch (type) { case ComponentMessageType.Activate: HandleClickedInHand(); break; } return reply; }
public override ComponentReplyMessage ReceiveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.ReceiveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! { return(reply); } if (type == ComponentMessageType.Initialize) { SendComponentInstantiationMessage(); } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.CheckCollision: reply = list.Any() ? CheckCollision((bool) list[0]) : CheckCollision(); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.GetWearLoc: reply = new ComponentReplyMessage(ComponentMessageType.ReturnWearLoc, wearloc); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.Damage: ApplyDamage((Entity) list[0], (int) list[1], (DamageType) list[2]); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.GetCurrentHealth: reply = new ComponentReplyMessage(ComponentMessageType.CurrentHealth, GetHealth(), GetMaxHealth()); break; } return reply; }
/// <inheritdoc /> public override ComponentReplyMessage ReceiveMessage(object sender, ComponentMessageType type, params object[] list) { //Don't listen to our own messages! if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.BoundKeyChange: HandleKeyChange(); break; } return(base.ReceiveMessage(sender, type, list)); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.DisassociateEntity: UnEquipEntity((Entity) list[0]); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.Bumped: OnBump(sender, list); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.SlaveAttach: Attach((int)list[0]); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) //Don't listen to our own messages! return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.GetCurrentHealth: reply = new ComponentReplyMessage(ComponentMessageType.CurrentHealth, IsDead ? 0 : 1, 1); //HANDLE THIS CORRECTLY break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.SendPositionUpdate: SendPositionUpdate(true); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return reply; switch (type) { case ComponentMessageType.MoveDirection: var movedir = (Direction) list[0]; LightMoveDir(movedir); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) { return(ComponentReplyMessage.Empty); } switch (type) { case ComponentMessageType.PhysicsMove: Translate((float)list[0], (float)list[1]); break; } return(reply); }
//Notes: The server doesn't actually care about whether the client can't find a particle system when we tell it to add it. // The server is literally just a list of stuff we want the clients to use - if they can't then tough luck. // It's not the most elegant Solution but short of passing around a whole bunch of messages to verify that everything worked // there's not much else i can do. And quite frankly - it doesn't matter if the client cant find a particle system - it just wont show up - no error. // --- years later --- // You're retarded. An error is an error. TODO fix this. public override ComponentReplyMessage ReceiveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.ReceiveMessage(sender, type, list); if (sender == this) { return(reply); } switch (type) { case ComponentMessageType.Activate: HandleClickedInHand(); break; } return(reply); }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.DisableCollision: _collisionEnabled = false; break; case ComponentMessageType.EnableCollision: _collisionEnabled = true; break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.ReceiveEmptyHandToLargeObjectInteraction: HandleEmptyHandToLargeObjectInteraction((Entity) list[0]); break; case ComponentMessageType.ReceiveItemToLargeObjectInteraction: HandleItemToLargeObjectInteraction((Entity) list[0]); break; } return reply; }
public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type, params object[] list) { ComponentReplyMessage reply = base.RecieveMessage(sender, type, list); if (sender == this) return ComponentReplyMessage.Empty; switch (type) { case ComponentMessageType.WallMountTile: //Attach to a specific tile. var toAttach = (Vector2) list[0]; AttachToTile(toAttach); break; case ComponentMessageType.WallMountSearch: //Look for the best tile to attach to based on owning entity's direction. FindTile(); break; } return reply; }