The-Powder-Toy/The-Powder-Toy

Lua ChangeType disrupts FIGH

Pixelguru26 opened this issue · 2 comments

Attempting to add a ChangeType function to FIGH causes any newly-created fighters to appear with a blue head and legs distended toward strange locations, disappearing immediately after.
As far as I can tell, this is because assigning a Lua ChangeType callback removes the C++ callback which is used to set up new fighters in the simulation.
While this would normally just be a matter of replacing the necessary functionality, few (if any) of the affected variables are exposed to the Lua API, making this functionally impossible.
image

I don't consider this to be a problem.

There have always been portions of the simulation that weren't exposed to Lua for various reasons, the most common ones being:

  • they'd be difficult to hammer into a shape that is impervious to the nonsense that can be done on the Lua side, e.g. custom movement handling (can_move type 3)
  • they implement features that are too obscure to warrant exposing, e.g. extra portal storage and wifi activation data
  • the feature they help implement is considered complete (read: we don't want to work on it because it's too messy), e.g. stickmen's legs, for they're a stickman thing

Stickman leg control via Lua is some combination of these three. It's stickman code, so we don't really want to deal with it. It's the ChangeType callback of a built-in element, so there's a very real possibility of weird behaviour. It's also very obscure. Finally, the correct solution (something like the extra before-instead-after detail Lua Update functions have extended to ChangeType? not even sure) would involve a lot of code that we aren't prepared to develop, probably not even for a non-stickman feature.

Fair enough, figured I'd bring it up so at least it's documented.