public LuaEventTestLogic(
        CommandService commandService,
        LuaEventService luaEventService,
        LuaValueMapper mapper)
    {
        this.luaEventService = luaEventService;

        mapper.DefineStructMapper <ExplicitStruct>(x => new LuaValue("Explicit!"));

        commandService.AddCommand("sendvector").Triggered     += SendLuaVector;
        commandService.AddCommand("sendvectorlist").Triggered += SendLuaVectorList;
        commandService.AddCommand("senddata").Triggered       += SendDataStruct;
        commandService.AddCommand("sendmapped").Triggered     += SendLuaMappable;
        commandService.AddCommand("sendexplicit").Triggered   += SendExplicitStruct;
    }
Example #2
0
    public ParachuteLogic(MtaServer server,
                          LuaEventService luaEventService,
                          ILogger logger,
                          IElementCollection elementCollection)
    {
        this.server            = server;
        this.luaEventService   = luaEventService;
        this.logger            = logger;
        this.elementCollection = elementCollection;
        server.PlayerJoined   += HandlePlayerJoin;

        luaEventService.AddEventHandler("requestAddParachute", HandleRequestAddParachute);
        luaEventService.AddEventHandler("requestRemoveParachute", HandleRequestRemoveParachute);

        this.resource = this.server.GetAdditionalResource <ParachuteResource>();
    }
Example #3
0
    public LuaControllerLogic(
        MtaServer server,
        LuaEventService luaEventService,
        IElementCollection elementCollection,
        LuaValueMapper luaValueMapper)
    {
        this.server            = server;
        this.luaEventService   = luaEventService;
        this.elementCollection = elementCollection;
        this.luaValueMapper    = luaValueMapper;

        this.handlers = new();
        this.implicitlyCastableTypes = new();

        IndexImplicitlyCastableTypes();
        IndexControllers();
    }