Comments (75)
- Legacy editor. Or just a better editor
Working on it!
EDIT: Leave your features requests & ideas for the editor here!
from starfallex.
@thegrb93 I am writing an editor from scratch, implementing SF highlighting should be as easy as changing the generate_builtin
property in the currently existing GLua 'Highlighter' from _G
to SF.<table_with_functions_and_function_tables>
.
EDIT: Early version of the format;
{
"package_type": "highlighter",
"package_name": "gLUA syntax-highlighting for Rocket",
"package_author": "Arena",
"package_version": "1.0.0",
"tokenizer": {
"def_modifiers": false,
"allow_tinker": true,
"generate_builtin": "_G",
"patterns": {
"[%d+%.*%d*]+": "=digit",
"[!~=%+%-%*/|&%%%^<>]+": "=operator",
},
"tokens": {
"function": "=def_start",
"(": "=par_start =args_start =def_end >)",
")": "=par_end =args_end",
"local": "=keyword",
"if": "=keyword >then",
"for": "=keyword >in",
"while": "=keyword >do",
"in": "=keyword >do",
"then": "=keyword >end",
"do": "=keyword >end",
"else": "=keyword |end",
"elseif": "=keyword |then",
"end": "=keyword",
"[[": "=multiline_start >]]",
"]]": "=multiline_end =comment_end",
"--[[": "=comment_start >]]",
"--": "=comment_line",
"TODO": "=comment-todo"
"not": "=operator",
"and": "=operator",
"[": "=indexer_start >]",
"]": "=indexer_end",
"{": "=collector_start >}",
"}": "=collector_end",
"\"": "=string_start =string_end >\"",
"false": "=boolean",
"true": "=boolean",
},
"split": {
" ": 1,
",": 1,
"(": 2,
")": 2
}
}
}
Where =
assigns a word to a token, =*_start
defines the start of a token area, =*_end
defines the end of a token area, =*_line
defines a token that takes up the remainder of the line and =*-...
defines a token subclass (highlight overwrite can occur).
Furthermore, >
, <
and |
respectively mean: "Scope up and wait for token X"
, "Scope down and wait for token X"
and "Stay on this scope, but wait for token X"
.
This can be used for error-prevention, say "("
its scope was never closed by ")"
, the editor will notify the user (ideally with a small warning sign in the gutter that can be clicked).
There are currently no guidelines as to what token names to use, but I will set up some defaults as I get this working, so that single themes can work across multiple language packages.
EDIT: Progress! This is the tokenizer/colorizer almost done; just need some more polishing, bugfixing and stricter rules.
from starfallex.
Request Feature
halt(reason)
function. It should stop the processor on client and server and print the reason. It would be a way better method to stop the chip instead of using error()
. error()
prints an ugly and long stacktrace, which isn't necessary.
Defining methods for built-in types, e.g.:
function Vector:setX(x)
self.x = x
end
from starfallex.
Finally got some free time. I'll do all of the small tasks tonight. Going to play doom for a while first.
from starfallex.
I fixed it. Finally got around to finishing some of the tasks too. I had been working on redoing the pony mod which is now in another repository of mine.
from starfallex.
Looks like the chip won't send code to clients until they enter the same pvs as the chip; will fix. Seems like the code is sent after the client enter's the pvs though. I need to refactor the networking anyway. Will fix the reliable channel overflow and this at the same time.
from starfallex.
e2 doesn't have prop limit. Why does starfall have one?
from starfallex.
Can't setParent holograms to player anymore
from starfallex.
e2 does, but it defaults to -1. I can change starfall's default. Dunno if stuff should be allowed to parent to players. Maybe I can allow parenting to the owner. I know stuff in e2 can be parented to anyone but you see the typical uses of that. I'll go ahead and change it.
from starfallex.
You can do everything what you do with setParent without it too
from starfallex.
Except parenting stays active after the chip is deleted.
from starfallex.
Don't always wrap an entity if you access it with wire.ports
(takes up very much cpu).
from starfallex.
I always use the input hook. Accessing wire.ports is infact slower. In order to speed it up, it needs to cache what you access and recache when the input is changed.
from starfallex.
I use input hook too, but it would be really simplier and faster if wire library would cache already by itself
from starfallex.
Even if it did, it would still be slower than using the input hook and storing the result alone.
from starfallex.
Going to be working on school stuff for another week. Might take a vacation afterwards but idk. Will still fix any immediately needed things.
from starfallex.
setName()
function and let the writecell
return something. zcpu checks for the return value of ENT:WriteCell and if it's false it thinks that it wrote to unavailable memory.
from starfallex.
bit.tohex()
's second parameter isn't optional (in docs it says Optional.).
from starfallex.
No idea why they did wrapper functions for bit library. I'll take a look at just importing the glua bit functions.
Done.
from starfallex.
Clientside http configuration (sf_http_interval
, sf_http_max_active
concommands)
from starfallex.
Would probably be better just to only allow the owner of sf to make the http requests. What do you think?
from starfallex.
Yeah, that would be really good too. Running on http requests on others can be pretty abused (also on server)
from starfallex.
Tested and pushed update.
from starfallex.
setName sets the name of the chip right?
from starfallex.
Yes
from starfallex.
Don't remove the props spawned by the starfall if you remove the chip
from starfallex.
Done
from starfallex.
net.readTable and net.writeTable could be just serialized to von and then compressed
from starfallex.
Yeah. Users can easily do that themselves so I guess there's no need for read/write table. It's better practice to avoid read/write table anyway.
from starfallex.
file.write
always returns true
from starfallex.
How about an equivalent of EA2's noFrameRefresh( boolean onOff )?
This basically doesn't clear the Screen RT every frame; or is am I overlooking something in the render functions?
from starfallex.
Screen no longer uses an RT so it gets cleared anyway by the game itself. If you need it to not be cleared, you have to create an RT and use the RT.
I'll take a look at file.write
from starfallex.
Implement IGModAudioChannel:SetTime
and IGModAudioChannel:GetTime
?
EDIT: I meant Time
, the naming is quite confusing as BASS itself uses BASS_ChannelSetPosition
and BASS_Set3DPosition
.
from starfallex.
Added that. When should file.write return false btw?
from starfallex.
When should file.write return false btw?
According to this lua file, file.Write doesn't return anything by default, you could consider checking whether the file.write succeeded, e.g. return file.Exists( file, path )
.
Or derive your own function from the code in there and have something like:
local f = file.Open( filename, "wb", "DATA" )
if not f then return false end
f:Write( contents )
f:Close()
return true
from starfallex.
Alright, thanks.
from starfallex.
getClipboardText()
setClipboardText(string)
Only should work on owner's chip since it is very abusable.
from starfallex.
I can't find those.
from starfallex.
3rd party plugin maybe?
from starfallex.
http://wiki.garrysmod.com/page/Global/SetClipboardText
Well, thought there is some GetClipboardText, but there isnt.
from starfallex.
Oh thought you were reporting it as a bug. I suppose I can add it.
from starfallex.
If possible, could you add custom fold regions in the editor such as in C#?
Example:
--#region Helper functions
local function num2hex( n ) local h="0123456789abcdef" local s="" while n>0 do local m=math.fmod(n,16) s=string.sub(h,m+1,m+1)..s n=math.floor(n/16) end if s=="" then return"0" end return s end
local function perf( pct ) return ( quotaUsed() < (quotaMax()/95)*pct ) end
--#endregion
The entire region here would be fold-able within the editor
This greatly improves code readability, especially considering most people write their SF chips all in one file.
from starfallex.
This is how I do it.
local foo, foo2, foo3, foo4, foo5
do --Helper functions
function foo()
end
etc...
end
from starfallex.
I just looked at the ace homepage and saw in the features:
Fully customizable key bindings including vim and Emacs modes
Can we have vim mode? 😮
from starfallex.
Done I think. Let me know if it works, I have no idea how to use vim or emacs.
from starfallex.
Feature request
Add setCode(starfallEntitiy, string)
.
It should set the code of a starfall chip and resets everything of it (hooks, holograms, props, sounds, ...).
from starfallex.
Feature request
E2-like extension system. Easily enable and disable libraries without touching any lua.
Also E2-like Chip tracker. It should list all Starfalls placed and show their cpu (server, client) and their owner. It's important for admins since starfall chips are more dangerous than e2s.
from starfallex.
I can add some optional parameters to error() to allow changes to its behavior. Also, shouldn't setX return the vector?
@ThatOneCheetah, are you writing an editor from scratch or basing it off another? I'd like to adapt one of gmod's already existing editors to sf, but if you're really up to such a huge task of making one from scratch then that's fine too. I can't help until next Wednesday when school is finally over.
from starfallex.
Ye, it should return a vector, but it's only an example
from starfallex.
I can add some optional parameters to error() to allow changes to its behavior.
Would be nice
Changing keybinding in editor does nothing.
@ThatOneCheetah , i suggest making a new issue for the editor where you can post the progress.
from starfallex.
The vim mode kinda works after i reconnected a server. But i can't insert or delete anything, i can only navigate.
from starfallex.
Feature request
Instead of Vector:set(vector2)
, implement Vector:clone()
. Same with Angle
.
from starfallex.
setX,Y,Z,etc.
SetX was just an example. I mean defining any method for built in types.
from starfallex.
--@client
print(Color(0, 0, 0))
produces the following error:
addons/starfallex/lua/starfall/libs_sh/color.lua:64: attempt to concatenate field 'a' (a nil value)
stack traceback:
addons/starfallex/lua/starfall/libs_sh/color.lua:64: in function 'tostring'
addons/starfallex/lua/starfall/libs_sh/builtins.lua:243: in function 'print'
SF:main: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:134: in function 'initialize'
addons/starfallex/lua/entities/starfall_processor/cl_init.lua:72: 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>
from starfallex.
@its-suun Fixed
from starfallex.
Feature request
enableErrorSending(bool)
function on serverside. If you call it with true, every client which errored will send a net message to the server with the error. It can't be done in user apps yet, cause you would need to do try(...)
everything, which isn't everywhere possible (e.g. hooks).
Example:
--@shared
if SERVER then
enableErrorSending(true)
hook.add("net", "", function(name, len, ply)
if name == "ClientError" then
print(ply:getName() " errored:" .. net.readString())
end
end)
else
...
end
from starfallex.
Feature request
The --@include
command shouldn't throw an error when the file isn't found. Instead it should throw an error when you require()
it. This can be used to react when a library isn't found and then download it for example.
from starfallex.
@its-suun this is expected behaviour, to circumvent this you can:
--@include <include>
try( function()
require( "<include>" )
end, function() --[[ download stuff ]] end )
from starfallex.
--@include is what's throwing the error so that wouldn't work. I can change this behavior.
from starfallex.
render.cursorPos
doesn't work with a HUD.
from starfallex.
Feature request
Entity:setPhysProp(s)
, it should work like the Physical Properties
tool.
Example:
chip():setPhysProp("Super Ice")
from starfallex.
Bug
There aren't any methods on color types.
Example:
Color(1, 2, 3, 4):hsvToRGB() -- error
from starfallex.
-- error
@its-suun A stacktrace would help, as this is unexpected behaviour, as the color methods should just be working.
from starfallex.
Very useful stacktrace for a missing function
`SF:main:4: attempt to call method 'hsvToRGB' (a nil value)
stack traceback:
SF:main: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:134: in function 'initialize'
addons/starfallex/lua/entities/starfall_processor/cl_init.lua:72: 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>
from starfallex.
setFPS(xx) on screen would be nice, so you can keep stable FPS on multiple clients.
from starfallex.
Ahh, also "Roboto" at render.CreateFont is missing(Or I am just blind, which I probbably am)
from starfallex.
Probably is. I can add it.
from starfallex.
Wrong hook name at
StarfallEx/lua/starfall/libs_sh/input.lua
Line 131 in 4dfe825
from starfallex.
http://i.imgur.com/x2j8T4F.png Those 2 functions are in helper, but after compiling it says they dont exist.
from starfallex.
Yeah.. I need to update the docs. I have lots of free time today so I can get some things done.
from starfallex.
For setCode, can't you use globaltables or remote hook run with loadstring() so have that chip run whatever code?
from starfallex.
Does anyone know how array IO works? I've been putting that one off forever since I don't know how exactly to do it. I'm thinking maybe just an SF.Sanatize
from starfallex.
Bug
Entity:setParent(x)
doesn't check for nil.
Throws addons/starfallex/lua/starfall/permissions/providers_sv/cppi.lua:48: attempt to index local 'target' (a nil value)
when x is nil
from starfallex.
Feature request
A way to ignite props
from starfallex.
Finished adding ignite, extinguish, setphysmaterial, and filter function for traces.
Moving to new issue thread.
from starfallex.
Related Issues (20)
- Use new ents iterators for find library
- PlayerSay/PlayerChat restrictions not functional? HOT 1
- Spamming `starfall_hologram` error HOT 2
- New client error after latest commits
- Rather spammy clientside error
- Make sure clientside SF.EntityTable is cleaning HOT 1
- SV Binding for the gameevent player_say HOT 1
- parse.markup making lua error if font is not valid HOT 3
- Starfall breaks PlayerButtonDown/PlayerButtonUp prediction in singleplayer HOT 2
- Make owner() error if called with superuser
- Any way the PlayerChat hook could access all the chat messages? HOT 1
- CL permissions check error HOT 1
- render.traceSurfaceColor() returns an invalid color HOT 1
- acf.createWeapon giving an error when trying to create weapon HOT 4
- Use Set/GetColor4Part and add SF function for it
- Severe SV error spam
- Reduce __index in entity libs
- Removing a custom prop does not free the max vertices limit HOT 1
- SF Serverside error HOT 2
- 3D rendering is broken for screen components HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from starfallex.