Skip to content
Snippets Groups Projects

Expose render splitscreen to lua

Merged haya_underscore requested to merge haya_/RingRacers:expose-splitscreen into master

Simply exposes the variable r_splitscreen, the variable keeping track of the amount of display players on screen at any point, not just on regular splitscreen/replay splitscreen views, to the lua interface.

As of currently, there is no general good way of getting the amount of display players on the screen without atleast exposing this. I've tried numerous solutions, including:

  • Checking for splitscreen (only works with local player splitscreen, and not for replay splitscreen)
  • Iterating through displayplayers via displayplayers.iterate (causes a notorious freeze with displayplayers being filled with copies of display player 1)
  • Iterating through displayplayers via normal for-loop (prevents the freeze, but will return 4 due to the copies of display player 1)
  • Saving the biggest value of c.pnum (You can switch the view numbers at any time, so this will stay at 4 even if you switch to 2 views after having 4 views previously...)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • haya_underscore changed title from Expose render splitscreen to Expose render splitscreen to lua

    changed title from Expose render splitscreen to Expose render splitscreen to lua

  • Sal added Lua label

    added Lua label

  • I will only accept this as a variable to the drawer object in HUD hooks. (splitscreen and displayplayers are both extremely problematic too, and should never have been added as they were in the first place, and now it's going to be a mess to figure out what we should do with them...)

    A problem with SRB2 / SRB2Kart's Lua extensions over time has been disregarding the UI code split. The original idea behind that restriction is that scripters should not be given any tools to causes desyncs in online games -- a consistent "Resyncing" message should always be a problem to report to us, instead of having to deduce which scripter didn't test their code online.

    The idea is, in the future, we want to properly enforce a split between UI and game code. No exploits such as being able to smuggle UI variables into a global variable for the rest of your script to use. Instead have customizable network commands to deliver client-sided information to everyone's gamestate in a way that can never cause a desync.

  • Sal mentioned in merge request !41 (merged)

    mentioned in merge request !41 (merged)

  • Author Contributor

    Understandable. So something like a splitscreen variable for the drawer (e.g. v.splitscreen) will do?

  • Yup, that'll be fine.

  • added 1 commit

    • 411e3b38 - r_splitscreen -> v.splitscreen

    Compare with previous version

  • Sal mentioned in commit 22f49fdf

    mentioned in commit 22f49fdf

  • merged

Please register or sign in to reply
Loading