Exemplo n.º 1
0
        static GLua()
        {
            RegisterMarshal(typeof(String[]), ArrayTypeMarshal <String> .Create());
            RegisterMarshal(typeof(CFunc), CFunctionTypeMarshal.Create());
            RegisterMarshal(typeof(Delegate), DelegateTypeMarshal.Create());
            RegisterMarshal(typeof(String), StringTypeMarshal.Create());
            RegisterMarshal(typeof(Boolean), BooleanTypeMarshal.Create());
            RegisterMarshal(typeof(Double), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(Single), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(Int64), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(UInt64), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(Int32), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(UInt32), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(Int16), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(UInt16), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(SByte), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(Byte), NumberTypeMarshal.Create());
            RegisterMarshal(typeof(Color), ColorTypeMarshal.Create());
            RegisterMarshal(typeof(Vector), VectorTypeMarshal.Create());
            RegisterMarshal(typeof(Angle), AngleTypeMarshal.Create());

            RegisterMarshal(typeof(Table), TableTypeMarshal.Create());
            RegisterMarshal(typeof(PhysCollide), GenericTableTypeMarshal.Create <PhysCollide>());
            RegisterMarshal(typeof(Entity), GenericTableTypeMarshal.Create <Entity>());
            RegisterMarshal(typeof(PhysObj), GenericTableTypeMarshal.Create <PhysObj>());
            RegisterMarshal(typeof(ISave), GenericTableTypeMarshal.Create <ISave>());
            RegisterMarshal(typeof(IRestore), GenericTableTypeMarshal.Create <IRestore>());
            RegisterMarshal(typeof(CTakeDamageInfo), GenericTableTypeMarshal.Create <CTakeDamageInfo>());
            RegisterMarshal(typeof(CEffectData), GenericTableTypeMarshal.Create <CEffectData>());
            RegisterMarshal(typeof(CMoveData), GenericTableTypeMarshal.Create <CMoveData>());
            RegisterMarshal(typeof(CRecipientFilter), GenericTableTypeMarshal.Create <CRecipientFilter>());
            RegisterMarshal(typeof(CUserCmd), GenericTableTypeMarshal.Create <CUserCmd>());
            RegisterMarshal(typeof(IMaterial), GenericTableTypeMarshal.Create <IMaterial>());
            RegisterMarshal(typeof(Panel), GenericTableTypeMarshal.Create <Panel>());
            RegisterMarshal(typeof(CLuaParticle), GenericTableTypeMarshal.Create <CLuaParticle>());
            RegisterMarshal(typeof(CLuaEmitter), GenericTableTypeMarshal.Create <CLuaEmitter>());
            RegisterMarshal(typeof(ITexture), GenericTableTypeMarshal.Create <ITexture>());
            RegisterMarshal(typeof(bf_read), GenericTableTypeMarshal.Create <bf_read>());
            RegisterMarshal(typeof(ConVar), GenericTableTypeMarshal.Create <ConVar>());
            RegisterMarshal(typeof(IMesh), GenericTableTypeMarshal.Create <IMesh>());
            RegisterMarshal(typeof(VMatrix), GenericTableTypeMarshal.Create <VMatrix>());
            RegisterMarshal(typeof(CSoundPatch), GenericTableTypeMarshal.Create <CSoundPatch>());
            RegisterMarshal(typeof(pixelvis_handle_t), GenericTableTypeMarshal.Create <pixelvis_handle_t>());
            RegisterMarshal(typeof(dlight_t), GenericTableTypeMarshal.Create <dlight_t>());
            RegisterMarshal(typeof(IVideoWriter), GenericTableTypeMarshal.Create <IVideoWriter>());
            RegisterMarshal(typeof(File), GenericTableTypeMarshal.Create <File>());
            RegisterMarshal(typeof(CLuaLocomotion), GenericTableTypeMarshal.Create <CLuaLocomotion>());
            RegisterMarshal(typeof(PathFollower), GenericTableTypeMarshal.Create <PathFollower>());
            RegisterMarshal(typeof(CNavArea), GenericTableTypeMarshal.Create <CNavArea>());
            RegisterMarshal(typeof(IGModAudioChannel), GenericTableTypeMarshal.Create <IGModAudioChannel>());
            RegisterMarshal(typeof(CNavLadder), GenericTableTypeMarshal.Create <CNavLadder>());
            RegisterMarshal(typeof(CNewParticleEffect), GenericTableTypeMarshal.Create <CNewParticleEffect>());
            RegisterMarshal(typeof(ProjectedTexture), GenericTableTypeMarshal.Create <ProjectedTexture>());

            RegisterMarshal(typeof(Player), GenericTableTypeMarshal.Create <Player>());
            InitJIT();
        }
Exemplo n.º 2
0
        public void WriteAngle(Angle Angle)
        {
            Boolean B = this.LuaHandle.Lock();

            this.LuaHandle.ReferencePush(this.Referance);
            this.LuaHandle.GetField(-1, "WriteAngle");
            this.LuaHandle.Insert(-2);
            AngleTypeMarshal.Create().Push(this.LuaHandle, Angle);
            this.LuaHandle.Call(2, 0);
            if (B)
            {
                this.LuaHandle.UnLock();
            }
        }
Exemplo n.º 3
0
        public Angle ReadAngle()
        {
            Boolean B = this.LuaHandle.Lock();

            this.LuaHandle.ReferencePush(this.Referance);
            this.LuaHandle.GetField(-1, "ReadAngle");
            this.LuaHandle.Insert(-2);
            this.LuaHandle.Call(1, 1);
            Angle Ret = AngleTypeMarshal.Create().GetT(this.LuaHandle);

            if (B)
            {
                this.LuaHandle.UnLock();
            }
            return(Ret);
        }
Exemplo n.º 4
0
        public PhysCollideTraceBoxReturn TraceBox(Vector Origin, Angle Angles, Vector RayStart, Vector RayEnd, Vector RayMins, Vector RayMaxs)
        {
            Boolean B = this.LuaHandle.Lock();

            this.LuaHandle.ReferencePush(this.Referance);
            this.LuaHandle.GetField(-1, "TraceBox");
            this.LuaHandle.Push(-2);

            // Going to keep this at the marshal level, in case of future gmod updates or if someone wants to log marshals
            VectorTypeMarshal Marshal  = VectorTypeMarshal.Create();
            AngleTypeMarshal  AMarshal = AngleTypeMarshal.Create();

            Marshal.Push(this.LuaHandle, Origin);
            AMarshal.Push(this.LuaHandle, Angles);
            Marshal.Push(this.LuaHandle, RayStart);
            Marshal.Push(this.LuaHandle, RayEnd);
            Marshal.Push(this.LuaHandle, RayMins);
            Marshal.Push(this.LuaHandle, RayMaxs);

            this.LuaHandle.Call(7, 3);
            PhysCollideTraceBoxReturn Ret = new PhysCollideTraceBoxReturn
            {
                HitPos        = Marshal.GetT(this.LuaHandle, -3),
                HitNormal     = Marshal.GetT(this.LuaHandle, -2),
                TraceFraction = this.LuaHandle.LuaBase.GetNumber(-1),
            };

            this.LuaHandle.Pop(4);

            if (B)
            {
                this.LuaHandle.UnLock();
            }

            return(Ret);
        }