Beispiel #1
0
        public void ShapeBaseDamage(coShapeBase shapebase, coShapeBase sourceobject, Point3F position, float damage, string damagetype)
        {
            // All damage applied by one object to another should go through this method.
            // This function is provided to allow objects some chance of overriding or
            // processing damage values and types.  As opposed to having weapons call
            // ShapeBase::applyDamage directly. Damage is redirected to the datablock,
            // this is standard procedure for many built in callbacks.


            if (shapebase.isObject())
            {
                coShapeBaseData datablock = shapebase.getDataBlock();
                datablock.call("damage", shapebase, position.AsString(), sourceobject, damage.AsString(), damagetype);
            }
        }
Beispiel #2
0
        public string ShapeBaseTossPatch(coShapeBase thisobj)
        {
            if (!thisobj.isObject())
            {
                return(string.Empty);
            }

            coItem item = console.Call_Classname("ItemData", "CreateItem", new[] { "HealthKitPatch" });

            item["istemp"] = true.AsString();

            item["sourceObject"] = thisobj;
            item["static"]       = false.AsString();

            (( coSimSet)"MissionCleanup").pushToBack(item);

            Random r = new Random();

            Point3F vec = new Point3F(-1 + (float)r.NextDouble() * 2, -1 * (float)r.NextDouble() * 2, (float)r.NextDouble());

            vec = vec.vecotrScale(10);
            Point3F eye = thisobj.getEyeVector();
            float   dot = new Point3F("0 0 1 ").vectorDot(eye);

            if (dot < 0)
            {
                dot = -dot;
            }

            vec = vec + new Point3F("0 0 8").vecotrScale(1 - dot);
            vec = vec + thisobj.getVelocity();

            TransformF pos = new TransformF(thisobj.getWorldBox().minExtents);

            item.setTransform(pos);
            item.applyImpulse(pos.MPosition, vec);
            item.setCollisionTimeout(thisobj);

            item.call("schedulePop");

            return(item);
        }
Beispiel #3
0
 public int ShapeBaseShapeBaseGetInventory(coShapeBase thisobj, coItemData data)
 {
     return(thisobj.isObject() ? thisobj["inv[" + data.getName() + "]"].AsInt() : 0);
 }