Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VScript API #1229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

VScript API #1229

wants to merge 1 commit into from

Conversation

rtldg
Copy link
Collaborator

@rtldg rtldg commented Mar 6, 2025

NOTE: completely untested (but it compiles!)

Requirements (which are very incompatible with 64-bit):

Before vscript, checkpoints only saved these because maps couldn't do much:

  • targetname
  • classname
  • events (from FireInput & whatever)

(note the lack of player_speedmod disabled-buttons in there! I still need to add that TODO!)

Since you can do a lot of funky stuff with vscript (and a mapper is already asking for vscript checkpoint support), these are the vscript/squirrel API I think should be enough.

And thank gosh I added StringMap cp_cache_t::customdata for this kind of thing a million years ago!

// Timer provided functions:
// - function Timer_SetCheckpointCustomData(player, key, value)
//   (only usable from Timer_OnCheckpointSave)
// - function Timer_GetCheckpointCustomData(player, key)
//   (only usable from Timer_OnCheckpointLoadPre & Timer_OnCheckpointLoadPost)

// Functions that maps can implement (with examples):
::Timer_OnCheckpointSave <- function(player)
{
    Timer_SetCheckpointCustomData(player, "mystate", "floating")
}
::Timer_OnCheckpointLoadPre <- function(player)
{
    local mystate = Timer_GetCheckpointCustomData(player, "mystate")
}
::Timer_OnCheckpointLoadPost <- function(player)
{
    local mystate = Timer_GetCheckpointCustomData(player, "mystate")
}

TODO:

  • Add a way to get the player's time... Timer_GetTime? lol
  • Add Timer_OnStart and Timer_OnEnd?
  • Indicate in OnCheckpointLoad if it's like a Segmented style checkpoint or like a kz checkpoint.
  • Figure out a good way to indicate that a checkpoint is actually from a bot or something idk...
    • Maybe let the mapper find it out in OnCheckpointLoad when parsing the custom data and finding it empty?

@rtldg rtldg changed the title VScript API for checkpoints VScript API Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant