/tg/ Station 13 - Modules - TypesVar Details - Proc Details

player_rank_controller

This datum is intended to be used as a method of abstraction for the different ways that each player rank handles adding and removing players from their global lists, as well as handling the legacy adding, removing, loading and saving of said lists.

Vars

legacy_file_headerThe header for the legacy file, if any. Leave as "" if you don't have one.
legacy_file_pathThe path to the legacy file holding all of the players that have this rank. Should be set in New(), since it has a non-constant compile-time value.
rank_titleThe name of the player rank in the database. This NEEDS to be set by subtypes, otherwise you WILL run into severe issues.

Procs

add_playerHandles adding this rank to a player by their ckey. This is only intended to be used for handling the in-game portion of adding this rank, and not to save this change anywhere. That should be handled by the caller.
add_player_legacyHandles adding this rank to a player using the legacy system, updating the legacy config file in the process.
clear_existing_rank_dataSimple proc for subtypes to override for their own handling of clearing any lists that need to be cleared before loading the player rank data.
get_ckeys_for_legacy_saveSimple proc for subtypes to override for their own handling of obtaining a list of ckeys to save during a legacy save.
get_ckeys_to_migrateHandles returning a list of all the legacy ckeys that should be migrated from the legacy system to the database one.
load_from_queryHandles loading the players that have this rank from an already-executed database query.
load_legacyHandles loading the players that have this rank from its legacy config file.
remove_playerHandles removing this rank from a player by their ckey. This is only intended to be used for handling the in-game portion of removing this rank, and not to save this change anywhere. That should be handled by the caller.
remove_player_legacyHandles removing this rank from a player using the legacy system, updating the legacy config file in the process.
save_legacyHandles saving the players that have this rank using its legacy config file.

Var Details

legacy_file_header

The header for the legacy file, if any. Leave as "" if you don't have one.

legacy_file_path

The path to the legacy file holding all of the players that have this rank. Should be set in New(), since it has a non-constant compile-time value.

rank_title

The name of the player rank in the database. This NEEDS to be set by subtypes, otherwise you WILL run into severe issues.

Proc Details

add_player

Handles adding this rank to a player by their ckey. This is only intended to be used for handling the in-game portion of adding this rank, and not to save this change anywhere. That should be handled by the caller.

DO NOT FORGET TO ADD A IsAdminAdvancedProcCall() CHECK SO THAT ADMINS CAN'T JUST USE THAT TO SKIP PERMISSION CHECKS!!!

add_player_legacy

Handles adding this rank to a player using the legacy system, updating the legacy config file in the process.

Don't override this, everything should be handled from add_player(), this is mostly just a helper for convenience.

Arguments:

clear_existing_rank_data

Simple proc for subtypes to override for their own handling of clearing any lists that need to be cleared before loading the player rank data.

DO NOT FORGET TO ADD A IsAdminAdvancedProcCall() CHECK SO THAT ADMINS CAN'T JUST ELEVATE PERMISSIONS TO CLEAR RANK DATA AND SCREW YOU OVER!!!

get_ckeys_for_legacy_save

Simple proc for subtypes to override for their own handling of obtaining a list of ckeys to save during a legacy save.

DO NOT FORGET TO ADD A IsAdminAdvancedProcCall() CHECK SO THAT ADMINS CAN'T JUST ELEVATE PERMISSIONS TO ADD THEMSELVES TO A LEGACY SAVE!!!

get_ckeys_to_migrate

Handles returning a list of all the legacy ckeys that should be migrated from the legacy system to the database one.

Returns a list of ckeys as strings.

load_from_query

Handles loading the players that have this rank from an already-executed database query.

Mostly just a helper to simplify the logic of the subsystem.

load_legacy

Handles loading the players that have this rank from its legacy config file.

Don't override this, use clear_existing_rank_data() to clear up anything that needs to be cleared/initialized before loading the rank, and add_player() for actually giving the rank to the ckey in-game.

remove_player

Handles removing this rank from a player by their ckey. This is only intended to be used for handling the in-game portion of removing this rank, and not to save this change anywhere. That should be handled by the caller.

DO NOT FORGET TO ADD A IsAdminAdvancedProcCall() CHECK SO THAT ADMINS CAN'T JUST USE THAT TO SKIP PERMISSION CHECKS!!!

remove_player_legacy

Handles removing this rank from a player using the legacy system, updating the legacy config file in the process.

Don't override this, everything should be handled from remove_player() and save_legacy(), this is mostly just a helper for convenience.

Arguments:

save_legacy

Handles saving the players that have this rank using its legacy config file.

Don't override this, use get_ckeys_for_legacy_save() if you need to filter the list of ckeys that will get saved.