Make several Lua global variables writable.
Gives Lua write access to some of its global variables
Includes:
-
emeralds
-
token
-
gravity
-
displayplayer
Suggestions welcome.
Merge request reports
Activity
Well, I think this merge would solve #315 (closed)
I don't have any suggestions on my mind though..
Didn't even know that issue existed
Gonna update description now...
Edited by Goldenoutside the scope of the mr; i guess maybe it shouldn't close #315 (closed) in that case.
Let's see here...
stoppedclock
for stopping all player's timers manuallybluescore
andredscore
for modifying a team's score in custom gametypestimelimit
andscorelimit
are modifiable via Cvars, which makes me wonder why they're even global variables to begin with???There are also a whole bunch of global variables that are modifiable mid-game via a Maincfg SOC, such as
skincolor_redteam
,underwatertics
, andspstage_start
, so it'd make sense to expose those to Lua too. Not gonna list of them since there are so many, but there's no reason not to expose them.leveltime
would be something that'd be extremely useful to have exposed. It'd allow you to bypass or modify certain hardcoded behaviors, such as the Race/Competition countdown. I honestly don't see why you wouldn't exposeleveltime
. Most of the problems that could arise from modifying something like this would be entirely on the modder, much like other things Lua scripts can do, like modify the savable camera Cvars.I'm also checking the source code, and it seems there are screen-fading and tutorial text box global variables? But those would probably be best turned into functions, which is outside the scope of this merge.
redscore
andbluescore
are already exposed and writable.timelimit
andscorelimit
will be settable once 2.2.9 is out due to !1205 (merged).However,
leveltime
is the only ticker Lua scripters have available for any time-based algorithm: 99% of scripts are reliant on its constance. Letting it be writable is giving anyone easy leeway to break everyone else's scripts.Addendum: yes, anyone can make their own ticker by shoving a random counter in a ThinkFrame - exposing
leveltime
would still be a huge compatibility breaker.Edited by TatsuruI haven't looked into the other variables in detail, but they sound fine to me at a glance.
However, I wholly and utterly agree that allowing any script to arbitrarily edit the variable that is most universally relied on as a reliable global timer by basically every script in existence, would be a major backward compatibility breaker and a disaster for our modding ecosystem.
@SMS_Alfredo use
player.realtime
lmaoo