Add a bunch more classes to null safety.
This commit is contained in:
committed by
Abnormal
parent
e9915e52fa
commit
647ce880e1
@@ -4,6 +4,7 @@ import json2object.Position;
|
||||
import json2object.Position.Line;
|
||||
import json2object.Error;
|
||||
|
||||
@:nullSafety
|
||||
class DataError
|
||||
{
|
||||
public static function printError(error:Error):Void
|
||||
|
||||
@@ -12,6 +12,7 @@ import haxe.ds.Either;
|
||||
*
|
||||
* NOTE: Result must include quotation marks if the value is a string! json2object will not add them for you!
|
||||
*/
|
||||
@:nullSafety
|
||||
class DataWrite
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import funkin.play.cutscene.dialogue.ScriptedConversation;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class ConversationRegistry extends BaseRegistry<Conversation, ConversationData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import funkin.play.cutscene.dialogue.ScriptedDialogueBox;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class DialogueBoxRegistry extends BaseRegistry<DialogueBox, DialogueBoxData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import funkin.play.cutscene.dialogue.ScriptedSpeaker;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class SpeakerRegistry extends BaseRegistry<Speaker, SpeakerData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import funkin.ui.freeplay.ScriptedAlbum;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class AlbumRegistry extends BaseRegistry<Album, AlbumData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ import funkin.save.Save;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class PlayerRegistry extends BaseRegistry<PlayableCharacter, PlayerData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import funkin.ui.freeplay.ScriptedFreeplayStyle;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class FreeplayStyleRegistry extends BaseRegistry<FreeplayStyle, FreeplayStyleData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import funkin.play.stage.ScriptedStage;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class StageRegistry extends BaseRegistry<Stage, StageData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import funkin.ui.story.ScriptedLevel;
|
||||
import funkin.util.tools.ISingleton;
|
||||
import funkin.data.DefaultRegistryImpl;
|
||||
|
||||
@:nullSafety
|
||||
class LevelRegistry extends BaseRegistry<Level, LevelData> implements ISingleton implements DefaultRegistryImpl
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ import funkin.input.Controls.Action;
|
||||
*
|
||||
* Example: Pressing Ctrl+Z will undo, while holding Ctrl+Z will start to undo repeatedly.
|
||||
*/
|
||||
@:nullSafety
|
||||
class TurboActionHandler extends FlxBasic
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ import flixel.FlxBasic;
|
||||
*
|
||||
* Example: Pressing Ctrl+Z will undo, while holding Ctrl+Z will start to undo repeatedly.
|
||||
*/
|
||||
@:nullSafety
|
||||
class TurboButtonHandler extends FlxBasic
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ import flixel.FlxBasic;
|
||||
*
|
||||
* Example: Pressing Ctrl+Z will undo, while holding Ctrl+Z will start to undo repeatedly.
|
||||
*/
|
||||
@:nullSafety
|
||||
class TurboKeyHandler extends FlxBasic
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ package funkin.modding;
|
||||
|
||||
import polymod.Polymod;
|
||||
|
||||
@:nullSafety
|
||||
class PolymodErrorHandler
|
||||
{
|
||||
/**
|
||||
@@ -47,7 +48,7 @@ class PolymodErrorHandler
|
||||
logError(error.message);
|
||||
|
||||
// Last word is the class name.
|
||||
var className:String = error.message.split(' ').pop();
|
||||
var className:Null<String> = error.message.split(' ').pop();
|
||||
var msg:String = 'Import error in ${error.origin}';
|
||||
msg += '\nCould not import unknown class ${className}';
|
||||
msg += '\nCheck to ensure the class exists and is spelled correctly.';
|
||||
|
||||
@@ -25,6 +25,7 @@ import polymod.Polymod;
|
||||
/**
|
||||
* A class for interacting with Polymod, the atomic modding framework for Haxe.
|
||||
*/
|
||||
@:nullSafety
|
||||
class PolymodHandler
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -3,11 +3,13 @@ package funkin.modding.base;
|
||||
/**
|
||||
* An empty base class meant to be extended by scripts.
|
||||
*/
|
||||
|
||||
class Object {
|
||||
@:nullSafety
|
||||
class Object
|
||||
{
|
||||
public function new() {}
|
||||
|
||||
public function toString():String {
|
||||
public function toString():String
|
||||
{
|
||||
return "(Object)";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import openfl.events.KeyboardEvent;
|
||||
* This is a base class for all events that are issued to scripted classes.
|
||||
* It can be used to identify the type of event called, store data, and cancel event propagation.
|
||||
*/
|
||||
@:nullSafety
|
||||
class ScriptEvent
|
||||
{
|
||||
/**
|
||||
@@ -255,7 +256,8 @@ class HoldNoteScriptEvent extends NoteScriptEvent
|
||||
*/
|
||||
public var doesNotesplash:Bool = false;
|
||||
|
||||
public function new(type:ScriptEventType, holdNote:SustainTrail, healthChange:Float, score:Int, isComboBreak:Bool, comboCount:Int = 0, cancelable:Bool = false):Void
|
||||
public function new(type:ScriptEventType, holdNote:SustainTrail, healthChange:Float, score:Int, isComboBreak:Bool, comboCount:Int = 0,
|
||||
cancelable:Bool = false):Void
|
||||
{
|
||||
super(type, null, healthChange, comboCount, true);
|
||||
this.holdNote = holdNote;
|
||||
|
||||
@@ -6,6 +6,7 @@ import funkin.modding.IScriptedClass;
|
||||
/**
|
||||
* Utility functions to assist with handling scripted classes.
|
||||
*/
|
||||
@:nullSafety
|
||||
class ScriptEventDispatcher
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.modding.events;
|
||||
|
||||
@:nullSafety
|
||||
enum abstract ScriptEventType(String) from String to String
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import funkin.modding.events.ScriptEvent;
|
||||
* A module is a scripted class which receives all events without requiring a specific context.
|
||||
* You may have the module active at all times, or only when another script enables it.
|
||||
*/
|
||||
@:nullSafety
|
||||
class Module implements IPlayStateScriptedClass implements IStateChangingScriptedClass
|
||||
{
|
||||
/**
|
||||
@@ -28,7 +29,7 @@ class Module implements IPlayStateScriptedClass implements IStateChangingScripte
|
||||
*
|
||||
* Priority 1 is processed before Priority 1000, etc.
|
||||
*/
|
||||
public var priority(default, set):Int;
|
||||
public var priority(default, set):Int = 1000;
|
||||
|
||||
function set_priority(value:Int):Int
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ import funkin.modding.module.ScriptedModule;
|
||||
/**
|
||||
* Utility functions for loading and manipulating active modules.
|
||||
*/
|
||||
@:nullSafety
|
||||
class ModuleHandler
|
||||
{
|
||||
static final moduleCache:Map<String, Module> = new Map<String, Module>();
|
||||
@@ -74,11 +75,15 @@ class ModuleHandler
|
||||
* Given two module IDs, sort them by priority.
|
||||
* @return 1 or -1 depending on which module has a higher priority.
|
||||
*/
|
||||
static function sortByPriority(a:String, b:String)
|
||||
static function sortByPriority(a:String, b:String):Int
|
||||
{
|
||||
var aModule:Module = moduleCache.get(a);
|
||||
var bModule:Module = moduleCache.get(b);
|
||||
var aModule:Null<Module> = getModule(a);
|
||||
var bModule:Null<Module> = getModule(b);
|
||||
|
||||
if (aModule == null || bModule == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (aModule.priority != bModule.priority)
|
||||
{
|
||||
return aModule.priority - bModule.priority;
|
||||
@@ -89,14 +94,14 @@ class ModuleHandler
|
||||
}
|
||||
}
|
||||
|
||||
public static function getModule(moduleId:String):Module
|
||||
public static function getModule(moduleId:String):Null<Module>
|
||||
{
|
||||
return moduleCache.get(moduleId);
|
||||
}
|
||||
|
||||
public static function activateModule(moduleId:String):Void
|
||||
{
|
||||
var module:Module = getModule(moduleId);
|
||||
var module:Null<Module> = getModule(moduleId);
|
||||
if (module != null)
|
||||
{
|
||||
module.active = true;
|
||||
@@ -105,7 +110,7 @@ class ModuleHandler
|
||||
|
||||
public static function deactivateModule(moduleId:String):Void
|
||||
{
|
||||
var module:Module = getModule(moduleId);
|
||||
var module:Null<Module> = getModule(moduleId);
|
||||
if (module != null)
|
||||
{
|
||||
module.active = false;
|
||||
@@ -136,7 +141,7 @@ class ModuleHandler
|
||||
{
|
||||
for (moduleId in modulePriorityOrder)
|
||||
{
|
||||
var module:Module = moduleCache.get(moduleId);
|
||||
var module:Null<Module> = moduleCache.get(moduleId);
|
||||
// The module needs to be active to receive events.
|
||||
if (module != null && module.active)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user