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

SpawnObject Override Overhaul #1342

Merged

Conversation

Areloch
Copy link
Contributor

@Areloch Areloch commented Dec 21, 2024

Core now spawns a ControlObject directly, with callbacks allowing overriding of values to control what spawns (and what occurs afterwards) to tie several tracking variables to a given client connection.

By default this list of variables would be:
%this.spawnClass = "Camera";
%this.spawnDBType = "CameraData";
%this.spawnDataBlock = "Observer";
%this.playerSpawnGroups = "PlayerSpawnPoints PlayerDropPoints"; %this.spawnPoint = "";
%this.spawnLocation = "0 0 0";

Also adds several callbacks so that these values can be overridden by modules and gamemodes, kicked off from the %client.spawnControlObject(); command : callOnModules("setSpawnObjectType", "Game", %this); callGamemodeFunction("setSpawnObjectType", %this);

callOnModules("setSpawnPoint", "Game", %this);
callGamemodeFunction("setSpawnPoint", %this);

callOnModules("onPostSpawn", "Game", %this);
callGamemodeFunction("onPostSpawn", %this);

This is to ensure that a game mode can supersede modules, but even modules can dictate spawn behaviors for minimalist implementations and drop-in interop support

…rriding of values to control what spawns (and what occurs afterwards) to tie several tracking variables to a given client connection.

By default this list of variables would be:
%this.spawnClass = "Camera";
%this.spawnDBType = "CameraData";
%this.spawnDataBlock = "Observer";
%this.playerSpawnGroups = "PlayerSpawnPoints PlayerDropPoints";
%this.spawnPoint = "";
%this.spawnLocation = "0 0 0";

Also adds several callbacks so that these values can be overridden by modules and gamemodes, kicked off from the %client.spawnControlObject(); command :
callOnModules("setSpawnObjectType", "Game", %this);
callGamemodeFunction("setSpawnObjectType", %this);

callOnModules("setSpawnPoint", "Game", %this);
callGamemodeFunction("setSpawnPoint", %this);

callOnModules("onPostSpawn", "Game", %this);
callGamemodeFunction("onPostSpawn", %this);

This is to ensure that a game mode can supersede modules, but even modules can dictate spawn behaviors for minimalist implementations and drop-in interop support
…ocess/sort them in priority order

Added logic to ModuleManager's findModules method to allow priority sorting as well as pre-filtering by a given module group
Adjusts the %isFine argument for the onMapLoadFailed callback events to %canContinueOnFail for a bit more clarity on what the arg conveys
Shifts the setSpawnObjectType, setSpawnPoint and onPostSpawn call stack to utilize an event manager to allow the setup process for spawners and gamemode prepwork to run in it's own time, if needbe. Such as if a gamemode has to generate a map and there's no guarantees on when it'll b e done for one client vs another
Added getModulesAndGameModesList, callOnObjectList and getNumCanCallOnObjectList utility functions
@Azaezel Azaezel merged commit 8274bbb into TorqueGameEngines:development Jan 3, 2025
2 of 3 checks passed
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.

2 participants