Example #1
0
        public CharacterEntity(Region tregion, double maxhealth)
            : base(tregion)
        {
            CGroup = CollisionUtil.Character;
            DamageableEntityProperty dep = Damageable();

            dep.SetMaxHealth(maxhealth);
            dep.SetHealth(maxhealth);
        }
Example #2
0
        public BlockItemEntity(Region tregion, BlockInternal orig, Location pos)
            : base(tregion)
        {
            SetMass(20);
            CGroup   = CollisionUtil.Item;
            Original = orig;
            Shape    = BlockShapeRegistry.BSD[orig.BlockData].GetShape(orig.Damage, out Location offset, true);
            SetPosition(pos.GetBlockLocation() + offset);
            DamageableEntityProperty dep = Damageable();

            dep.SetMaxHealth(5);
            dep.SetHealth(5);
            dep.EffectiveDeathEvent.AddEvent((e) =>
            {
                RemoveMe();
            }, this, 0);
        }
Example #3
0
        // TODO: Heal with time?

        public MusicBlockEntity(Region tregion, ItemStack orig, Location pos)
            : base("mapobjects/customblocks/musicblock", tregion)
        {
            Original = orig;
            SetMass(0);
            SetPosition(pos.GetBlockLocation() + new Location(0.5));
            SetOrientation(BEPUutilities.Quaternion.Identity);
            DamageableEntityProperty dep = Damageable();

            dep.SetMaxHealth(5);
            dep.SetHealth(5);
            dep.EffectiveDeathEvent.AddEvent((e) =>
            {
                // TODO: Break into a grabbable item?
                RemoveMe();
            }, this, 0);
        }
Example #4
0
        public StaticBlockEntity(Region tregion, ItemStack orig, Location pos)
            : base(tregion)
        {
            SetMass(0);
            CGroup   = CollisionUtil.Item;
            Original = orig;
            Shape    = BlockShapeRegistry.BSD[0].GetShape(BlockDamage.NONE, out Location offset, false);
            SetPosition(pos.GetBlockLocation() + offset);
            SetOrientation(BEPUutilities.Quaternion.Identity);
            DamageableEntityProperty dep = Damageable();

            dep.SetMaxHealth(5);
            dep.SetHealth(5);
            dep.EffectiveDeathEvent.AddEvent((e) =>
            {
                // TODO: Break into a grabbable item?
                RemoveMe();
            }, this, 0);
        }