Giter VIP home page Giter VIP logo

starfallex's People

Contributors

adamnejm avatar anormaltwig avatar awilliamson avatar cenius avatar cheatoid avatar colonelthirtytwo avatar cornerpin avatar damianu avatar daranable avatar diogo464 avatar divran avatar edgarasf123 avatar elemecca avatar jacbo1 avatar jazzelhawk avatar lightrobin avatar mitterdoo avatar neatro avatar omnisudo avatar suunr avatar szymski avatar thefreezebug avatar thegrb93 avatar vintprox avatar vurv78 avatar web-flow avatar x4fx77x4f avatar xandaros avatar zh-hristov avatar zzzowoey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starfallex's Issues

Manually marking co-routines for garbage collection (nillifying) results in the exact opposite.

EDIT
The actual issue seemed to be me attempting to manually dispose of a coroutine by doing thread = nil (I am new to coroutines and was not aware that this is not required), however, this seems to do the exact opposite.

I presume this prevents the behind-the-scenes checking of coroutines to mark the coroutine for garbage collection, as there is nothing to mark, because it is nil.

if SERVER then return end

local status = coroutine.status
function coroutine_yielded(c)return(status(c)~="running" and status(c)~="dead")end

local sound = {}

local co = coroutine.create( function()
        for i=1,4096 do
            bass.loadFile( "sound/synth/sine_440.wav", "3d noblock noplay", function( chan )
                if not chan then return end

                chan:play()
                chan:setVolume( 0 )
                sound[#sound+1] = chan
            end )

            if quotaUsed()*2 > quotaMax() then coroutine.yield() end
        end

        return true
end)

hook.add("think", "co-keepalive", function()
    if coroutine_yielded( co ) and quotaUsed()*2.10 < quotaMax() then
        local r = coroutine.resume( co )
        if r then co = nil end
    end
end)

EDIT: The above code seems to not accurately recreate the issue, I'm looking in to the reason.

NOTE: The above seems to only happen from time-to-time inside of coroutines; but recreating this result reliably proves to be difficult.

EDIT: Actual issue found, title changed, old content available below:

I have discovered that loading many streams using bass.loadFile (as I do in my midi parser) then deleting/refreshing the chip doesn't always call the stop method on the bass classes and dispose of them properly.

I don't have the exact code to replicate such thing but

local sound = {}
for i=1,256 do
    bass.loadFile( "sounds/synth/sine_440.wav", "3d noblock noplay", function( chan )
        chan:play()
        chan:setVolume( 0 )
        sound[i] = chan
    end )
end

should suffice to recreate the issue.
I'm not sure whether this is also the case with bass.loadURL, however, I do presume so.

Lua error after rendering for ~3 seconds

The code

if CLIENT then
    local id = render.getTextureID("icon16/arrow_refresh.png")
    hook.add( "render", "draw", function()
        render.clear( Color( 0, 0, 0 ) )
        render.setTexture( id )
        render.drawTexturedRect( 0, 0, 512, 512 )
    end )
end

gives after ~3 seconds the error:

addons/starfallex-master/lua/starfall/libs_cl/render.lua:172: attempt to index local 'mat' (a number value)

Several Issues

LUA:

  • When client StarFall errors, it displays glua error:
    cl_init.lua:71: attempt to index field 'instance' (a nil value)
SF:test/demo.txt:4: attempt to perform arithmetic on global 'derp' (a nil value)
SF:test/demo.txt:4: attempt to perform arithmetic on global 'derp' (a nil value)
stack traceback:
    SF:test/demo.txt:4: in function 'func'
    addons/starfallex/lua/starfall/instance.lua:38: in function <addons/starfallex/lua/starfall/instance.lua:37>
    [C]: in function 'xpcall'
    addons/starfallex/lua/starfall/instance.lua:71: in function 'runWithOps'
    addons/starfallex/lua/starfall/instance.lua:133: in function 'initialize'
    addons/starfallex/lua/entities/starfall_processor/cl_init.lua:68: in function 'CodeSent'
    addons/starfallex/lua/entities/starfall_processor/cl_init.lua:92: in function 'func'
    lua/includes/extensions/net.lua:32: in function <lua/includes/extensions/net.lua:17>

[ERROR] addons/starfallex/lua/entities/starfall_processor/cl_init.lua:71: attempt to index field 'instance' (a nil value)
  1. CodeSent - addons/starfallex/lua/entities/starfall_processor/cl_init.lua:71
   2. func - addons/starfallex/lua/entities/starfall_processor/cl_init.lua:92
    3. unknown - lua/includes/extensions/net.lua:32
  • Hard to reproduce, but sometimes clientside starfall throws errors with weird symbols like ?*'/'. or something similar. And when you do get it, its hard to fix it. Also when you right click on the errored chip, it opens additional file with those weird symbols as the name and inside the file itself(~8 characters long). I suspect it only appears when you're working with additional files.
    I know some people have experienced same errors too, I would appreciate if someone would add more details.
  • The tooltip(which shows cpu quota) doesn't always appear.

File Browser

  • Missing reload/update button in file browser (in q-menu).
  • Missing "delete folder" feature
  • Renaming files inside folders, moves renamed files to root directory.

Single entity to filter from trace not working

The description of the trace.trace() function says that the filter argument permits both a single entity and an array of entities to filter, but using a single entity does not seem to work.

Hook inputPressed bug

It's called few times instead of only once.

hook.add("inputPressed","test",function(key) if key == 15 then print ("bugs bugs bugs") end end)

It prints bugs bugs bugs few times..

Hook inputPressed and inputReleased doesn't work

Despite the input hook working fine for me, I can't seem to get any response from inputPressed or inputReleased.

Example code:

if SERVER then

    wire.adjustInputs({"Input"}, {"normal"})

    hook.add("inputPressed", "Trigger", function(name)
        print("Pressed")
    end)

end

entites.applyDamage not restricted

I am not familiar with how the permission system works, but it looks like entites.applyDamage is not restricted in the same way as other permissions, allowing anyone to damage anyone else.

Defined here:
https://github.com/thegrb93/StarfallEx/blob/master/lua/starfall/libs_sv/entities.lua#L26

But not listed alongside the other functions here:
https://github.com/thegrb93/StarfallEx/blob/master/lua/starfall/permissions/providers_sv/CPPI.lua

(Also looks like entities.setColor is attached to cantool, but not used anywhere)

Maybe a solution to avoid this issue in the future would be to allow adding to cantool/canphysgun directly in the register function or having a special wrapper like P.registerPrivilegeCanTool as generic PP privileges can be useful for many things.

util.Decompress util.Compress

Hello,

Any chances of util.Decompress and util.Compress being added to Starfall? Along with that, what about net.WriteData and net.ReadData?

Thanks.

Variables (specifically, tables) don't get cleared from memory when your chip errors

So imagine you're me: You decided to make your raytracer camera take pictures in two (three, really, but the third isn't too relevant) stages.

Stage 1: trace
Stage 2: render

So you store all your trace data for all your pixels inside a big 'ol table. You only start rendering once the entire scene has been traced, so you need to keep all that information at hand. You like taking 512x512 pictures of course, because they're pretty.

But you're sadly not a particularly amazing coder, so you run into some errors during the process of taking a picture. Mostly CPU Quota related, but errors of all kinds are relevant. Now, your trace stage was already 75% done, and now your starfall chip has crashed. Oh well, tweak code and try again. Errors again, whoops. Errors again! Oh well.

Ah, but all this time, Garry's Mod's memory usage has been piling up, because those big tables full of trace data are all stuck in memory limbo, rather than being cleared out every time the chip errors.

hl2.exe has stopped responding! All the memory available to our poor 32 bit source engine has been used up! Goodbye Garry's Mod!

I've tried solving it using try() to clear out all those tables every time an error occurs, but CPU Quota exceeded errors seem to bypass all that.

Sorry for writing such a silly story, but I thought this should make the problem I'm encountering clear. Thanks for reading!

Add Tick hook

Tick is called every FPS instead of each game frame as Think hook does.

Matrix doesnt work on HUD

I dont know if its not gmod issue, but you cant use matrixes on hud.

         local  mat = Matrix()
        mat:setAngles(Angle(50,0,0))
        mat:setTranslation(Vector(256,256,0))

        render.pushMatrix(mat)
            render.setColor(Color(256,256,242))
            render.drawRect(0,0,512,512)
        render.popMatrix()

CalcView hook not passed arguments

Related code

The code should probably look like
hook.Add("CalcView", hook_name, function(...) return ent:DoCalcView(...) end)
In the current state DoCalcView doesn't receive any of the params and thus they aren't passed on to the hook.

Stealing code is very easy

You can steal every starfall code with this client side lua PrintTable(LocalPlayer():GetEyeTrace().Entity.files).
A way would be to delete the code after loading it directly, or obfuscating it.

Stuff to add

  • Npc functions.
  • Team functions.
  • Hologram setAngles
  • Attachment pos/ang
  • MaterialFromScreen
  • Url texture load callback
  • getScreenInfo
  • link functions
  • net.WriteData
  • multiple links
  • Select component model
  • Client/Server only preproc
  • Fix runRemote
  • getFFT
  • Clipboard errors
  • isTyping
  • getScreenResolution
  • color __mul
  • vector __mul improvements
  • bass deinitialization
  • hologram setColor setMaterial
  • Show examples in docs and helper
  • Trails
  • Von fixes
  • Increase screen resolution
  • Check compile status before sending to client.
  • Color __add and __sub
  • enumerate files.
  • add getWiredTo
  • add getWiredToName

Security issue

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
:getEyeTrace().Entity returns an unwrapped entity.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

Credits: Forsaken

render.setResolution(w,h)

I know it can be pretty hard to make, but I think it would give awesome abilities.
Especially changing aspect ratio(for different props) with that function would allow us to make screens look way better. Designing 1x1 is much harder(imo) than widescreens where you can make 2 colums not looking crowded etc, you can already achieve it using EGP emitter(without screen model tho).
So yeah, I think it would be awesome thing to have in starfall.

[Github] Starfall related stuf

Hi, my idea is to create something like Wiki page containing links to starfall based repos(Scripts, Libraries) etc. I think it would be usefull for people looking for resources, and also can be "examples" in helper alternative.

Ply:keyDown(...) checks for wrong key

if CLIENT then return end

hook.add("think","",function()
    print(entities.owner():keyDown(KEY.E))
end)

returns false if I press E, but true if I press W

Owner's Client-Side State Features

These features would be only be available on owner's clientside LUA state.

A way to modify quota, such as function or processor.

And a way to access global lua table (_G) like defining _GMOD global variable in the sandbox environment. Essentially this would allow players to gain full control of LUA in their own state. Also it would be disabled if sv_allowcslua is set to 0.

Possible applications?

  • Midi keyboard: Basically load gmcl_midi module, send data to serverside chip using SF net library. And then broadcast data to all players. Now you're able to play keyboard directly to the server.
  • Controller Support: Be able control your vehicles using controllers such as steering wheel.
  • Adding console commands: execute commands on the chip without needing to use chat.

And to prevent accidental messups by newbies, users may need to include --@safe 0 preprocessor to enable above described features..

Net library does not "regenerate" bursts

As the title says.

EDIT: The problem seems to lie within this line:

instance.data.net.burst = math.min( burst_limit:GetFloat()*1000, instance.data.net.burst + ( CurTime() - instance.data.net.last_send ) / burst_interval:GetFloat() * 1000 )

I'm off to fix it right now, and make a pull request.

EDIT: The overall bursting code is somewhat awkward, to be honest; I'm trying my best to make this work.

Optimize rendering

You can draw every 2. tick and it looks like you would draw normally.
Example:

--@client
-- The screen will stay red and not blink
local i = 0
hook.add("render", "", function()
    i = i + 1
    if i % 2 ~= 0 then return end
    render.setColor(Color(255, 0, 0))
    render.drawRect(0, 0, 512, 512)
end)

This could be implemented maybe for every render hook and achieve better performance.

Permission problem

You can set in multiplayer the props of everyone the material and the color, also of players. Things like setNoDraw also work, which are very abusive.

ClientSide Holograms

http://wiki.garrysmod.com/page/Global/ClientsideModel
http://wiki.garrysmod.com/page/ents/CreateClientProp

Basically these allows you to create clientside holograms(entities). They're faster, and less resource intensive.

I'm currently making a minecraft-like terrain generation. And I would like to introduce multiplayer feature. The problem is, creating terrain for multiple players would increase entity count drastically. If clientside holograms existed, I would give each player few invisible props, and leave the terrain rendering on clientside code(which would be local to each player).

Here's a current version of my game.
http://googledrive.com/host/0B11uwRQw_I-kVndMdC1tVnlIcm8/

StarfallEx Server compatibility?

I recently put up a dedicated server to use StarfallEx on, and have tried over the past two days to get it working. I have reinstalled numerous times when all else seemed to fail, but for whatever reason, StarfallEx will not work. Currently running a clean install with Wiremod and StarfallEx both cloned from github: Wiremod works, but starfall does not, there are no starfall tools, nor any starfall concommands, which lead to my assumption that starfallEx simply isn't being mounted, but it is, so I'm at a loss.

I assume this branch is compatible with dedicated servers (I see no reason why it wouldn't be, that is.) So my question is if you have any idea what the issue might be?

Thank you

Clientside Permissions

I think that starfall should have some way of allowing or disallowing things just by clicking on chip.
Like now we have sf_allowclientsidehttp but it's just not as dynamic.
I am talking about something like
--@permissions ChatPrint Holograms Music and then some hook when someone grants those permissions(by clicking on chip and seeing some window with needed permissions, like android does it). It would definitly make starfall seem more safe and less exploitable, also user-friendly.
Ps. It's more like an invitation to discussion rather than actual suggestion.

bass.loadURL with '3d' flag returns nil channel

local sound = nil
bass.loadURL( "-snip-.ogg", "noblock noplay 3d", function( chan )
    sound = chan
    sound:play()
end )

causes

SF:Super Starfall.txt:44: attempt to index upvalue 'sound' (a nil value)
stack traceback:
    SF:Super Starfall.txt:44: in function 'func'
    addons/starfallex/lua/starfall/instance.lua:38: in function <addons/starfallex/lua/starfall/instance.lua:37>
    [C]: in function 'xpcall'
    addons/starfallex/lua/starfall/instance.lua:71: in function 'runWithOps'
    addons/starfallex/lua/starfall/instance.lua:251: in function 'runFunction'
    addons/starfallex/lua/starfall/libs_cl/bass.lua:89: in function <addons/starfallex/lua/starfall/libs_cl/bass.lua:87>

EDIT: Adding an isValid( chan ) check as described in the Garry's Mod Wiki prevents the error, but the channel is invalid/nil nonetheless.

Render.clear()

The render library is lacking Render.clear(); a method I find vital in to fully taking control of my objectives when it comes to Starfall. At least 30% of the time, I don't clear my renderTarget before each draw. I see no reason to take this control away from the user, and would appreciate its integration into StarfallEx.

Thank you

Stuff to add 2

Huge additions

  • Bone class
  • Legacy editor. Or just a better editor
  • Catch quota exceeded
  • Refactor lua file networking to prevent reliable channel overflow and send to clients regardless of pvs.
  • Add way to set adminonly restrictions on permissions using console commands. (Currently only way is with mysql) (or rework permissions)
  • Clientside permissions against sounds/holograms/http/quota, etc.
  • Reduce net traffic of permissions. (Why the fuck are serverside permissions networked anyway?)
  • Stencil functions and Cam3D functions for Screen/HUD

Quick additions

  • wire array i/o
  • Chip tool ghost
  • Fix processor custom model renderbounds
  • Constraint typechecks
  • Color clamping
  • Fix render.cursorpos
  • timer.getTimersLeft
  • Entity.getSkin
  • Remove prop limit?
  • Allow parent to player
  • setName()
  • writeCell return value
  • Allow props to not be cleaned after chip is removed.
  • setClipBoardText
  • setX,Y,Z,etc.
  • Allow clients to send errors to chip owner
  • cursorpos with hud
  • filter function for trace
  • clientside console commands
  • physproperties
  • Roboto font
  • Improve addcollisioncallback.
  • ignite and extinguish

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.