INPStarfall / Starfall

Starfall Processor for Garry's Mod + Wiremod
http://www.wiremod.com/forum/developers-showcase/22739-starfall-processor.html
Other
17 stars 15 forks source link

Entity SetTrigger/StartTouch/EndTouch/Touch #340

Open awilliamson opened 9 years ago

awilliamson commented 9 years ago

See: http://wiki.garrysmod.com/page/Entity/SetTrigger

Problem is GM-code would look for those functions on the GM(underlying) entity. We can't pre-modify 'all' entities with those functions. We would have to have some method for creating those functions on entities adhoc, which bind to the SF-layer. SF has GM as underlying, so we've have to go backwards, make SF code generate GM code on-the-fly and still be sandboxed and safe.

I have a rough idea of how to achieve this. All the work would be in the library function for setting up these 'trigger' GM callbacks, but the user-provided callback would be vetted and checked. The interface functions under those 'trigger' GM callbacks would 'force' SF to parse the user-provided callback in SF-space.

Am I making any sense? Any suggestions/Ideas? I think these functions would be damn cool for users, as they'd able to hook into the physics system on entities ( including holograms! ), perhaps even able to get velocity and physics information for simulations?

@Xandaros, @Jazzelhawk, @EpicG Thoughts?

davidsonbr commented 9 years ago

I had to deal with this in my panel library that I have yet to finish. Gimme a sec to find it.

davidsonbr commented 9 years ago

Here is what I did.

We could modify the __newindex to make it so that if the user changes "startTouch", "touch" or "endTouch" keys the actual functions will set the instance, run the function and reset the instance.