Esempio n. 1
0
 public Bleeding(uint _uid, Entity _affected, uint duration = 0, params object[] arguments)
     : base(_uid, _affected, duration, arguments)
 {
     isDebuff = true;
     isUnique = true;
     family = StatusEffectFamily.Damage;
 }
Esempio n. 2
0
 public ExampleEffect(uint _uid, Entity _affected, uint duration = 0, params object[] arguments)
     //Do not add more parameters to the constructors or bad things happen.
     : base(_uid, _affected, duration, arguments)
 {
     isDebuff = false;
     isUnique = false;
     family = StatusEffectFamily.None;
 }
Esempio n. 3
0
 public override void OnUse(Entity targetEnt)
 {
     if (targetEnt.HasComponent(ComponentFamily.StatusEffects)) //Use component messages instead.
     {
         var statComp = (StatusEffectComp) targetEnt.GetComponent(ComponentFamily.StatusEffects);
         statComp.AddEffect("Bleeding", 10);
         parent.StartCooldown(this);
     }
 }
Esempio n. 4
0
 public bool RemoveEntity(Entity user, Entity toRemove)
 {
     if (containedEntities.Contains(toRemove))
     {
         containedEntities.Remove(toRemove);
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 5
0
 public bool AddEntity(Entity user, Entity toAdd)
 {
     if (containedEntities.Contains(toAdd))
     {
         return false;
     }
     else
     {
         containedEntities.Add(toAdd);
         return true;
     }
 }
Esempio n. 6
0
        protected override void RecieveItemInteraction(Entity actor, Entity item,
                                                       Lookup<ItemCapabilityType, ItemCapabilityVerb> verbs)
        {
            base.RecieveItemInteraction(actor, item, verbs);

            if (verbs[ItemCapabilityType.Tool].Contains(ItemCapabilityVerb.Pry))
            {
                ToggleDoor(true);
            }
            else if (verbs[ItemCapabilityType.Tool].Contains(ItemCapabilityVerb.Hit))
            {
                var cm = IoCManager.Resolve<IChatManager>();
                cm.SendChatMessage(ChatChannel.Default,
                                   actor.Name + " hit the " + Owner.Name + " with a " + item.Name + ".", null, item.Uid);
            }
            else if (verbs[ItemCapabilityType.Tool].Contains(ItemCapabilityVerb.Emag))
            {
                OpenDoor();
                disabled = true;
            }
        }
        /// <summary>
        /// Entry point for interactions between an item and this object
        /// Basically, the actor uses an item on this object
        /// </summary>
        /// <param name="actor">the actor entity</param>
        protected void HandleItemToLargeObjectInteraction(Entity actor)
        {
            //Get the item
            ComponentReplyMessage reply = actor.SendMessage(this, ComponentFamily.Hands,
                                                            ComponentMessageType.GetActiveHandItem);

            if (reply.MessageType != ComponentMessageType.ReturnActiveHandItem)
                return; // No item in actor's active hand. This shouldn't happen.

            var item = (Entity) reply.ParamsList[0];

            reply = item.SendMessage(this, ComponentFamily.Item, ComponentMessageType.ItemGetCapabilityVerbPairs);
            if (reply.MessageType == ComponentMessageType.ItemReturnCapabilityVerbPairs)
            {
                var verbs = (Lookup<ItemCapabilityType, ItemCapabilityVerb>) reply.ParamsList[0];
                if (verbs.Count == 0 || verbs == null)
                    RecieveItemInteraction(actor, item);
                else
                    RecieveItemInteraction(actor, item, verbs);
            }
        }
Esempio n. 8
0
 private void UnEquipEntityToHand(Entity e, Hand h)
 {
     var hands = (HumanHandsComponent) Owner.GetComponent(ComponentFamily.Hands);
     ComponentReplyMessage reply = Owner.SendMessage(this, ComponentFamily.Hands,
                                                     ComponentMessageType.IsHandEmpty, h);
     if (reply.MessageType == ComponentMessageType.IsHandEmptyReply && (bool) reply.ParamsList[0])
     {
         UnEquipEntity(e);
         Owner.SendMessage(this, ComponentMessageType.PickUpItemToHand, e, h);
     }
 }
Esempio n. 9
0
 // Unequips entity e 
 private void UnEquipEntity(Entity e)
 {
     EquipmentSlot key;
     foreach (var kvp in equippedEntities)
     {
         if (kvp.Value == e)
         {
             key = kvp.Key;
             UnEquipEntity(key);
             break;
         }
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Entry point for interactions between an empty hand and this object
 /// Basically, actor "uses" this object
 /// </summary>
 /// <param name="actor">The actor entity</param>
 protected override void HandleEmptyHandToLargeObjectInteraction(Entity actor)
 {
     ToggleDoor();
 }
Esempio n. 11
0
 private void UnEquipEntityToHand(Entity e)
 {
     UnEquipEntity(e);
     //HumanHandsComponent hh = (HumanHandsComponent)Owner.GetComponent(ComponentFamily.Hands);
     Owner.SendMessage(this, ComponentMessageType.PickUpItem, e);
 }
Esempio n. 12
0
        public bool AddEntity(Entity user, Entity toAdd)
        {
            if (equippedEntities.Any(x => x.Value == toAdd))
                return false;
            else
            {
                EquippableComponent eqCompo = toAdd.GetComponent<EquippableComponent>(ComponentFamily.Equippable);
                if (eqCompo != null)
                {
                    if (activeSlots.Contains(eqCompo.wearloc) && !equippedEntities.ContainsKey(eqCompo.wearloc))
                    {
                        equippedEntities.Add(eqCompo.wearloc, toAdd);
                        eqCompo.currentWearer = this.Owner;

                        return true;
                    }
                    else
                        return false;
                }
                else
                    return false;
            }
        }
Esempio n. 13
0
        public void SetMaster(Entity m)
        {
            if (!m.HasComponent(ComponentFamily.Renderable))
                return;
            var mastercompo = m.GetComponent<IRenderableComponent>(ComponentFamily.Renderable);
            //If there's no sprite component, then F**K IT
            if (mastercompo == null)
                return;

            mastercompo.AddSlave(this);
            master = mastercompo;
        }
Esempio n. 14
0
 public bool AddEntity(Entity actor, Entity toAdd, InventoryLocation location = InventoryLocation.Any)
 {
     if (containedEntities.Contains(toAdd))
     {
         return false;
     }
     else
     {
         containedEntities.Add(toAdd);
         return true;
     }
 }
Esempio n. 15
0
        private bool CanEquip(Entity e)
        {
            if (!e.HasComponent(ComponentFamily.Equippable))
                return false;

            ComponentReplyMessage reply = e.SendMessage(this, ComponentFamily.Equippable,
                                                        ComponentMessageType.GetWearLoc);
            if (reply.MessageType == ComponentMessageType.ReturnWearLoc)
            {
                if (IsItem(e) && IsEmpty((EquipmentSlot) reply.ParamsList[0]) && e != null &&
                    activeSlots.Contains((EquipmentSlot) reply.ParamsList[0]))
                {
                    return true;
                }
            }

            return false;
        }
Esempio n. 16
0
 private void HandleRemoved(Entity entity)
 {
     entity.SendMessage(this, ComponentMessageType.Dropped);
     entity.SendMessage(this, ComponentMessageType.SetVisible, true);
 }
Esempio n. 17
0
 public bool RemoveEntity(Entity actor, Entity toRemove, InventoryLocation location = InventoryLocation.Any)
 {
     if (containedEntities.Contains(toRemove))
     {
         containedEntities.Remove(toRemove);
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 18
0
 private void HandleAdded(Entity entity)
 {
     entity.SendMessage(this, ComponentMessageType.PickedUp, Owner, Hand.None);
     entity.SendMessage(this, ComponentMessageType.SetVisible, false);
 }
Esempio n. 19
0
 //Removes item from inventory and dispatches unhide message to sprite compo.
 public bool RemoveFromInventory(Entity entity)
 {
     if (containedEntities.Contains(entity))
     {
         containedEntities.Remove(entity);
     }
     HandleRemoved(entity);
     Owner.SendDirectedComponentNetworkMessage(this, NetDeliveryMethod.ReliableOrdered, null,
                                               ComponentMessageType.InventoryUpdateRequired);
     return true;
 }
Esempio n. 20
0
        //Adds item to inventory and dispatches hide message to sprite compo.
        private void AddToInventory(Entity entity)
        {
            if (!containedEntities.Contains(entity) && containedEntities.Count < maxSlots)
            {
                Entity holder = null;
                if (entity.HasComponent(ComponentFamily.Item))
                    holder = ((BasicItemComponent) entity.GetComponent(ComponentFamily.Item)).CurrentHolder;
                if (holder == null && entity.HasComponent(ComponentFamily.Equippable))
                    holder = ((EquippableComponent) entity.GetComponent(ComponentFamily.Equippable)).currentWearer;
                if (holder != null) holder.SendMessage(this, ComponentMessageType.DisassociateEntity, entity);
                else Owner.SendMessage(this, ComponentMessageType.DisassociateEntity, entity);

                containedEntities.Add(entity);

                HandleAdded(entity);
                Owner.SendDirectedComponentNetworkMessage(this, NetDeliveryMethod.ReliableOrdered, null,
                                                          ComponentMessageType.InventoryUpdateRequired);
            }
        }
Esempio n. 21
0
 private bool IsItem(Entity e)
 {
     if (e.HasComponent(ComponentFamily.Item)) //We can only equip items derp
         return true;
     return false;
 }
 /// <summary>
 /// Recieve an item interaction. woop. NO VERBS D:
 /// </summary>
 /// <param name="item"></param>
 protected virtual void RecieveItemInteraction(Entity actor, Entity item)
 {
 }
Esempio n. 23
0
 private void RemoveFromOtherComps(Entity entity)
 {
     Entity holder = null;
     if (entity.HasComponent(ComponentFamily.Item))
         holder = ((BasicItemComponent) entity.GetComponent(ComponentFamily.Item)).CurrentHolder;
     if (holder == null && entity.HasComponent(ComponentFamily.Equippable))
         holder = ((EquippableComponent) entity.GetComponent(ComponentFamily.Equippable)).currentWearer;
     if (holder != null) holder.SendMessage(this, ComponentMessageType.DisassociateEntity, entity);
     else Owner.SendMessage(this, ComponentMessageType.DisassociateEntity, entity);
 }
 /// <summary>
 /// Entry point for interactions between an empty hand and this object
 /// Basically, actor "uses" this object
 /// </summary>
 /// <param name="actor">The actor entity</param>
 protected virtual void HandleEmptyHandToLargeObjectInteraction(Entity actor)
 {
     //Apply actions
 }
Esempio n. 25
0
        public bool RemoveEntity(Entity user, Entity toRemove)
        {
            if (equippedEntities.Any(x => x.Value == toRemove))
            {
                EquippableComponent eqCompo = toRemove.GetComponent<EquippableComponent>(ComponentFamily.Equippable);

                if (eqCompo != null)
                    eqCompo.currentWearer = null;

                equippedEntities[equippedEntities.First(x => x.Value == toRemove).Key] = null;
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 26
0
        // Equips Entity e to Part part
        private void EquipEntityToPart(EquipmentSlot part, Entity e)
        {
            if (equippedEntities.ContainsValue(e)) //Its already equipped? Unequip first. This shouldnt happen.
                UnEquipEntity(e);

            if (CanEquip(e)) //If the part is empty, the part exists on this mob, and the entity specified is not null
            {
                RemoveFromOtherComps(e);

                equippedEntities.Add(part, e);
                e.SendMessage(this, ComponentMessageType.ItemEquipped, Owner);
                //Owner.SendDirectedComponentNetworkMessage(this, NetDeliveryMethod.ReliableOrdered, null,
                //                                          EquipmentComponentNetMessage.ItemEquipped, part, e.Uid);
            }
        }
Esempio n. 27
0
 protected override void ApplyDamage(Entity damager, int damageamount, DamageType damType)
 {
     base.ApplyDamage(damager, damageamount, damType);
     SendHealthUpdate();
 }
Esempio n. 28
0
        // Equips Entity e and automatically finds the appropriate part
        private void EquipEntity(Entity e)
        {
            if (equippedEntities.ContainsValue(e)) //Its already equipped? Unequip first. This shouldnt happen.
                UnEquipEntity(e);

            if (CanEquip(e))
            {
                ComponentReplyMessage reply = e.SendMessage(this, ComponentFamily.Equippable,
                                                            ComponentMessageType.GetWearLoc);
                if (reply.MessageType == ComponentMessageType.ReturnWearLoc)
                {
                    RemoveFromOtherComps(e);
                    EquipEntityToPart((EquipmentSlot) reply.ParamsList[0], e);
                }
            }
        }
Esempio n. 29
0
 public bool containsEntity(Entity entity)
 {
     if (containedEntities.Contains(entity)) return true;
     else return false;
 }
Esempio n. 30
0
 public override void OnAdd(Entity owner)
 {
     base.OnAdd(owner);
     Owner.GetComponent<TransformComponent>(ComponentFamily.Transform).OnMove += OnMove;
 }