Пример #1
0
        public bool ShapeBaseShapeBaseThrow(coShapeBase thisobj, coItemData data, int amount = 1)
        {
            bool functionresult = false;

            if (ShapeBaseShapeBaseGetInventory(thisobj, data) > 0)
            {
                coSimObject objectid = data.call("onThrow", thisobj, amount.AsString());
                {
                    if (objectid != 0)
                    {
                        thisobj.call("throwObject", objectid);
                        AudioServerPlay3D("ThrowSnd", thisobj.getTransform());
                        functionresult = true;
                    }
                }
            }
            return(functionresult);
        }
Пример #2
0
        public bool ShapeBaseShapeBasePickup(coShapeBase thisobj, coItem obj, int amount)
        {
            coItemData data = obj.getDataBlock();

            if (amount == 0)
            {
                int maxamount = ShapeBaseShapeBaseMaxInventory(thisobj, data);

                int curamount = ShapeBaseShapeBaseGetInventory(thisobj, data);

                amount = (maxamount - curamount);
            }

            if (amount > 0)
            {
                return(data.call("onPickUp", obj, thisobj, amount.AsString()).AsBool());
            }

            return(false);
        }
Пример #3
0
        public bool ShapeBaseShapeBaseUse(coShapeBase thisobj, coItemData data)
        {
            coGameConnection client = thisobj.getControllingClient();

            if (client.isObject())
            {
                double defaultfov = client.getControlCameraDefaultFov();
                double fov        = client.getControlCameraFov();
                if (defaultfov != fov)
                {
                    return(false);
                }
            }



            if (ShapeBaseShapeBaseGetInventory(thisobj, data) > 0)
            {
                return(data.call("onUse", thisobj).AsBool());
            }

            return(false);
        }
Пример #4
0
        public int ShapeBaseShapeBaseSetInventory(coShapeBase thisobj, coItemData data, int value = 0)
        {
            if (thisobj == "")
            {
                return(0);
            }
            int max = 0;


            max = ShapeBaseShapeBaseMaxInventory(thisobj, data);
            if (value > max)
            {
                value = max;
            }

            int amount = thisobj["inv[" + data.getName() + "]"].AsInt();


            if (amount != value)
            {
                thisobj["inv[" + data.getName() + "]"] = value.AsString();


                if (console.isMethodInNamespace(data, "onInventory"))
                {
                    data.call("onInventory", thisobj, value.AsString());
                }

                //string datablock = console.getDatablock(thisobj).AsString();

                if (console.isObject((( coSimDataBlock)thisobj.getDataBlock())) && console.isMethodInNamespace((( coSimDataBlock)thisobj.getDataBlock()), "onInventory"))
                {
                    (( coSimDataBlock)thisobj.getDataBlock()).call("onInventory", data, value.AsString());
                }
            }
            return(value);
        }