likeafox / python-for-rimworld Goto Github PK
View Code? Open in Web Editor NEWPython developer tools for mod makers and hackers of RimWorld!
Python developer tools for mod makers and hackers of RimWorld!
Add console scroll bar
Allow multiple consoles to be open/Add button on console to open another console. Change console button behaviour such that it shows/hides all consoles, (or opens a single new console if every console has been closed). The window positions and sizes of all the consoles shall persist.
The continuation prompt in the console ("...") should not be repeated indefinitely while inputting blank lines. The incomplete code should fail if multiple sequential blank lines are submitted (unless in a multiline string I guess).
At least there should be a key combo to end the input like ctrl+D
(what you see in linux cli)
Preloaded extension methods are now working for /Python/ mods (commit 74bbf7f), but attempts to enable them for the console have continued to fail. Not only are they unable to be preloaded through the DLR interface, but clr.ImportExtensions
doesn't appear to work within the console either; both silently fail. Though the actual point of failure could be anywhere between the actual import, and the name binding that happens after(/during?) code compilation.
So far I have investigated ModuleContexts being elusive, since that was the difficulty with enabling it for /Python/ mods.
A few things I have found that may be potentially interesting in an attempt to understand the lifecycle of CodeContext and ModuleContext, and how to manipulate them:
Builtin.GetExecEvalScope
PythonDynamicStackFrame
PythonOps.PublishModule / RemoveModule
PythonOps.CreateLocalContext
PythonOps.GetParentContextFromFunction
PythonOps.GetVariable
PythonOps.RawGetGlobal
PythonOps.RawGetLocal
ModuleTryGetMember //maybe proof of what Modules contain
\sCodeContext(/\*!\*/)?\s+\w+.*;
PythonScriptCode
RunnableScriptCode.GetContextForScope
PythonScopeExtensions
EnsureScopeExtension
Relationships I have come to understand:
Precise relationship between ModuleContext and CodeContext is still unclear. They may be codependent.
I wrote a tracer in the debug class to give tracebacks every time ModuleContext constructor is run. Further investigation of this might reveal why the ModuleContext is changing between setting the console's extensions and using the console, if that is indeed the problem at all.
The problem may well be something else entirely, such as to do with the usage of code.InteractiveInterpreter
.
Creating another Python.Console object from the console breaks console output. This is a bug.
Fix console font rendering
Console "Inspect" feature, using same debug/developer menu Inspect feature functionality, to target game entities on the screen. Targeting entities from the console gives you a super easily reference them in the console via scripting.
make console button optional, such that the Python assemblies don't always have to be loaded right away. (make it a mod setting)
Improve exception readouts generated by Python code.
Make python scripting interface to Harmony, to allow harmony patches using python functions.
Add home/end console functionality. For the text editor to go to start/end of input
Console input editor occasionally doesn't show wrapped input editor text. Could possibly be due to bug in counting number of lines in the console.
Make that feature where you can browse loaded Python mods, and open a console in the scope of one. The console title shall indicate which mod it's targeting.
Inject into RimWorld's mod loader:
A feature to: immediately after loading a mod, search the mod directory for a Python/ directory; if found, create a new scope and load a found file named main.py (probably) and execute it in the new scope.
The scope/python mod shall be globally registered such that:
The scope initially contains:
clr
Verse
Python
PyHarmony
Verse.ModContentPack content
Also, Python/ directory is added to sys.path for the script
Add button on top of console to "fold" console for temporary hiding
add visible text cursor to console. Requires resolving issue #2 , fixing font rendering.
Have a toggle button to switch console view to a full blown text editor for the input buffer.
Figure out what's going on with CodeContext in the console output retrieval code. There was not enough understanding in its usage, and so it might unknowingly be causing unintended behaviours. Start by figuring out exactly what a CodeContext is.
Stop console input from being passed to the game, when the console window has focus. ESPECIALLY stop the enter key from closing the Log window
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.