thegrb93 / starfallex Goto Github PK
View Code? Open in Web Editor NEWStarfall, but with active development and more features. Write Garry's mod chips similar to E2, but in lua
Home Page: https://discord.gg/yFBU8PU
License: Other
Starfall, but with active development and more features. Write Garry's mod chips similar to E2, but in lua
Home Page: https://discord.gg/yFBU8PU
License: Other
hook.add("KeyPress", "TestKey", function(ply,key) print(key) end)
key does not print on arrow keys, or numpad.
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.
As the title describes. (When holding either SHIFT button)
Also, if the the tilde key is a modifier (e.g. Dutch layout, French layout, etc.) it's impossible to create '~' without copy&paste.
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
render.cursorPos() returns the position of the cursor on the chip, not on the screen.
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.
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)
As the title suggests, net.canSend() appears to be gone but there is still a burst limit present in the code. Also, owner() seems to be returning an invalid entity, or no entity at all.
Anticheats trigger
StarfallEx/lua/starfall/sflib.lua
Line 26 in e2d5056
See if its possible to make ace scripts transfer via http rather than net.
Already fixed in INPStarfall (INPStarfall/Starfall#344)
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.
the title basically explains itself. it would be very nice if right-clicking a chip (with the processor tool of course) checks if its code is already open in the editor. after a bit of changing little bits of code and checking it on a screen/HUD, the tabs start piling up.
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.
Same as render.drawText() just allowing to center text vertically, only minus of it is no \n support. It may also be bit faster(?).
Also yeah, I know we can center text with getTextSize(), it's just more comfy for simple labels without new lines.
If it wouldnt be a problem markup type would be also nice to have https://wiki.garrysmod.com/page/markup/Parse
Hey, what about adding the moonscript compiler? It's compiled to lua and so it would be possible to implement it.
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?
And to prevent accidental messups by newbies, users may need to include --@safe 0
preprocessor to enable above described features..
Huge additions
Quick additions
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!
Big loop every think for no reason is bad.
Hello,
Any chances of util.Decompress and util.Compress being added to Starfall? Along with that, what about net.WriteData and net.ReadData?
Thanks.
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
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.
Is there any specific reason for that?
Also, there should be some function to get the type of an input
EDIT: oh nvm
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.
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.
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
Call the render hook with the entity as a parameter so its possible to tell which to render to.
I noticed if you use Color() frequently, the garbage collector doesn't always clean it up when all the references are gone.
--@name mem_leak_test
--@author
--@client
if player() ~= owner() then return end
hook.add("think","mem_test",function()
for i=1, 3000 do
c = Color(0,0,0) -- {0,0,0}
end
end)
Here a made a demo, showing memory usage when using Color versus normal tables.
https://dl.dropboxusercontent.com/u/8081284/ShareX/2016/04/2016-04-24_12-58-48.mp4
I've included many files with
--@includedir ...
requiredir( ... )
and timed out and got send reliable stream overflow
in console.
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.
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.
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.
:getEyeTrace().Entity
returns an unwrapped entity.
Credits: Forsaken
#407 on INPStarfall/Starfall
Except it's on line 269 in sflib.lua on this fork.
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()
if SERVER then
print( type( entities.self():getColor() ) )
end
prints table
and not Color
.
Just as title says, it would be useful imo.
Tick is called every FPS instead of each game frame as Think hook does.
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
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.
The code
hook.add( "render", "cpuquota", function()
while true do end
end )
doesn't show any error.
https://github.com/thegrb93/StarfallEx/blob/master/lua/starfall/libs_cl/render.lua#L164
Centering just makes it harder to UV it properly, top-left would be much simpler.
Ps. I didnt look closer into it, but I didnt notice any url escape, so you can make exploit loading html code(like iframe) just by closing css tag. Sorry if there is some escaping, dont have time to check that now..
if CLIENT then
printTable(find.byModel("models/hunter/blocks/cube025x025x025.mdl"))
end
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/
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 thestop
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 withbass.loadURL
, however, I do presume so.
LUA:
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
?*'/'.
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.File Browser
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..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.