Skip to content

Commit

Permalink
refactor: rename HooksMod to MH
Browse files Browse the repository at this point in the history
  • Loading branch information
LordMidas committed Apr 12, 2024
1 parent 86a241b commit de55d30
Show file tree
Hide file tree
Showing 37 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions msu/hooks/ai/tactical/agent.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ai/tactical/agent", function(q) {
::MSU.MH.hook("scripts/ai/tactical/agent", function(q) {
q.m.MSU_BehaviorStacks <- {};
q.m.MSU_BehaviorToRemove <- null;

Expand Down Expand Up @@ -30,7 +30,7 @@
});

::MSU.QueueBucket.VeryLate.push(function() {
::MSU.HooksMod.hook("scripts/ai/tactical/agent", function(q) {
::MSU.MH.hook("scripts/ai/tactical/agent", function(q) {
q.execute = @(__original) function( _entity )
{
local ret = __original(_entity);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/ai/tactical/behaviors/ai_switchto_melee.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ai/tactical/behaviors/ai_switchto_melee", function(q) {
::MSU.MH.hook("scripts/ai/tactical/behaviors/ai_switchto_melee", function(q) {
q.onExecute = @(__original) function( _entity )
{
local itemsBefore = array(::Const.ItemSlot.COUNT);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/ai/tactical/behaviors/ai_switchto_ranged.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ai/tactical/behaviors/ai_switchto_ranged", function(q) {
::MSU.MH.hook("scripts/ai/tactical/behaviors/ai_switchto_ranged", function(q) {
q.onExecute = @(__original) function( _entity )
{
local itemsBefore = array(::Const.ItemSlot.COUNT);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/ai/tactical/behaviors/ai_throw_bomb.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ai/tactical/behaviors/ai_throw_bomb", function(q) {
::MSU.MH.hook("scripts/ai/tactical/behaviors/ai_throw_bomb", function(q) {
q.onExecute = @(__original) function( _entity )
{
local itemsBefore = array(::Const.ItemSlot.COUNT);
Expand Down
4 changes: 2 additions & 2 deletions msu/hooks/entity/tactical/actor.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/entity/tactical/actor", function(q) {
::MSU.MH.hook("scripts/entity/tactical/actor", function(q) {
q.onMovementStart = @(__original) function ( _tile, _numTiles )
{
__original(_tile, _numTiles);
Expand Down Expand Up @@ -103,7 +103,7 @@
});

::MSU.QueueBucket.VeryLate.push(function() {
::MSU.HooksMod.hookTree("scripts/entity/tactical/actor", function(q) {
::MSU.MH.hookTree("scripts/entity/tactical/actor", function(q) {
q.onDeath = @(__original) function( _killer, _skill, _tile, _fatalityType )
{
local deathTile = this.isPlacedOnMap() ? this.getTile() : null;
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/entity/tactical/player.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/entity/tactical/player", function(q) {
::MSU.MH.hook("scripts/entity/tactical/player", function(q) {
q.m.LevelUpsSpent <- 0;

q.getMovementSpeedMult <- function()
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/entity/tactical/tactical_entity_manager.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/entity/tactical/tactical_entity_manager", function(q) {
::MSU.MH.hook("scripts/entity/tactical/tactical_entity_manager", function(q) {
q.getActorsByFunction <- function( _function )
{
local ret = [];
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/entity/world/combat_manager.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/entity/world/combat_manager", function(q) {
::MSU.MH.hook("scripts/entity/world/combat_manager", function(q) {
/* Compatibility for mods that add factions. At least two areas need to get changed,
combat_manager and getLocalCombatProperties of world_state. The problem is that the
Factions array is initialised with fixed size 32, which is not large enough once
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/entity/world/party.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/entity/world/party", function(q) {
::MSU.MH.hook("scripts/entity/world/party", function(q) {
// The final movement speed mult that is applied to the default value of 100
q.m.MovementSpeedMult <- 1.0;
q.m.MovementSpeedMultFunctions <- {};
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/entity/world/player_party.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/entity/world/player_party", function(q) {
::MSU.MH.hook("scripts/entity/world/player_party", function(q) {
q.create = @(__original) function()
{
__original();
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/entity/world/settlement.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/entity/world/settlement", function(q) {
::MSU.MH.hook("scripts/entity/world/settlement", function(q) {
q.onEnter = @(__original) function()
{
local ret = __original();
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/items/item.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/items/item", function(q) {
::MSU.MH.hook("scripts/items/item", function(q) {
q.isItemType = @() function( _t, _any = true, _only = false )
{
if (_any)
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/items/item_container.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/items/item_container", function(q) {
::MSU.MH.hook("scripts/items/item_container", function(q) {
q.m.ActionSkill <- null;
q.m.MSU_IsIgnoringItemAction <- false;

Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/items/tools/faction_banner.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/items/tools/faction_banner", function(q) {
::MSU.MH.hook("scripts/items/tools/faction_banner", function(q) {
q.create = @(__original) function() {
__original();
this.setWeaponType(::Const.Items.WeaponType.Polearm);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/items/weapons/barbarians/drum_item.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/items/weapons/barbarians/drum_item", function(q) {
::MSU.MH.hook("scripts/items/weapons/barbarians/drum_item", function(q) {
q.create = @(__original) function() {
__original()
this.addWeaponType(::Const.Items.WeaponType.Musical, false);
Expand Down
4 changes: 2 additions & 2 deletions msu/hooks/items/weapons/weapon.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hookTree("scripts/items/weapons/weapon", function(q) {
::MSU.MH.hookTree("scripts/items/weapons/weapon", function(q) {
q.create = @(__original) function()
{
__original();
Expand All @@ -16,7 +16,7 @@
}
});

::MSU.HooksMod.hook("scripts/items/weapons/weapon", function(q) {
::MSU.MH.hook("scripts/items/weapons/weapon", function(q) {
q.m.WeaponType <- ::Const.Items.WeaponType.None;

q.setCategories <- function( _s, _setupWeaponType = true )
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/retinue/followers/follower.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/retinue/follower", function(q) {
::MSU.MH.hook("scripts/retinue/follower", function(q) {
q.getMovementSpeedMult <- function()
{
return 1.0;
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/retinue/followers/scout_follower.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/retinue/followers/scout_follower", function(q) {
::MSU.MH.hook("scripts/retinue/followers/scout_follower", function(q) {
q.getMovementSpeedMult <- function()
{
return ::World.Assets.getTerrainTypeSpeedMult(::World.State.getPlayer().getTile().Type);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/root_state.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/root_state", function(q) {
::MSU.MH.hook("scripts/root_state", function(q) {
q.onInit = @(__original) function()
{
__original();
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/scenarios/world/rangers_scenario.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/scenarios/world/rangers_scenario", function(q) {
::MSU.MH.hook("scripts/scenarios/world/rangers_scenario", function(q) {
q.onInit = @(__original) function()
{
__original();
Expand Down
4 changes: 2 additions & 2 deletions msu/hooks/scenarios/world/starting_scenario.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/scenarios/world/starting_scenario", function(q) {
::MSU.MH.hook("scripts/scenarios/world/starting_scenario", function(q) {
q.onNewDay <- function()
{
}
Expand All @@ -14,7 +14,7 @@
});

::MSU.QueueBucket.VeryLate.push(function() {
::MSU.HooksMod.hookTree("scripts/scenarios/world/starting_scenario", function(q) {
::MSU.MH.hookTree("scripts/scenarios/world/starting_scenario", function(q) {
q.onUpdateLevel = @(__original) function( _bro )
{
__original(_bro);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/skills/items/generic_item.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/skills/items/generic_item", function(q) {
::MSU.MH.hook("scripts/skills/items/generic_item", function(q) {
q.onAfterUpdate <- function( _properties )
{
if (!::MSU.isNull(this.m.Item) && !::MSU.isNull(this.m.Item.getContainer()))
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/skills/perks/perk_quick_hands.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/skills/perks/perk_quick_hands", function(q) {
::MSU.MH.hook("scripts/skills/perks/perk_quick_hands", function(q) {
q.m.IsSpent <- false;

q.create = @(__original) function()
Expand Down
6 changes: 3 additions & 3 deletions msu/hooks/skills/skill.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hookTree("scripts/skills/skill", function(q) {
::MSU.MH.hookTree("scripts/skills/skill", function(q) {
if (!q.contains("create"))
return;

Expand Down Expand Up @@ -52,7 +52,7 @@
}
});

::MSU.HooksMod.hook("scripts/skills/skill", function(q) {
::MSU.MH.hook("scripts/skills/skill", function(q) {
q.m.AIBehaviorID <- null;
q.m.DamageType <- null;
q.m.ItemActionOrder <- ::Const.ItemActionOrder.Any;
Expand Down Expand Up @@ -483,7 +483,7 @@
});

::MSU.QueueBucket.VeryLate.push(function() {
::MSU.HooksMod.hook("scripts/skills/skill", function(q) {
::MSU.MH.hook("scripts/skills/skill", function(q) {
foreach (func in ::MSU.Skills.PreviewApplicableFunctions)
{
q[func] = @(__original) function()
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/skills/skill_container.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/skills/skill_container", function(q) {
::MSU.MH.hook("scripts/skills/skill_container", function(q) {
q.m.ScheduledChangesSkills <- [];
q.m.IsPreviewing <- false;
q.m.PreviewProperty <- {};
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/states/main_menu_state.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/states/main_menu_state", function(q) {
::MSU.MH.hook("scripts/states/main_menu_state", function(q) {
q.m.ModSettingsShown <- false;
q.m.TempSettings <- null;

Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/states/state.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hookTree("scripts/states/state", function(q) {
::MSU.MH.hookTree("scripts/states/state", function(q) {
q.onInit = @(__original) function()
{
::MSU.Utils.States[this.ClassName] <- ::WeakTableRef(this);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/states/tactical_state.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/states/tactical_state", function(q) {
::MSU.MH.hook("scripts/states/tactical_state", function(q) {
q.executeEntityTravel = @(__original) function( _activeEntity, _mouseEvent )
{
_activeEntity.getSkills().m.IsPreviewing = false;
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/states/world/asset_manager.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/states/world/asset_manager", function(q) {
::MSU.MH.hook("scripts/states/world/asset_manager", function(q) {
q.m.LastDayMorningEventCalled <- 0;
q.update = @(__original) function( _worldState )
{
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/states/world_state.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/states/world_state", function(q) {
::MSU.MH.hook("scripts/states/world_state", function(q) {
q.onInitUI = @(__original) function()
{
__original();
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/ui/screens/menu/main_menu_screen.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ui/screens/menu/main_menu_screen", function(q) {
::MSU.MH.hook("scripts/ui/screens/menu/main_menu_screen", function(q) {
q.showMainMenuModule <- function()
{
this.m.JSHandle.asyncCall("showMainMenuModule", null);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/ui/screens/menu/modules/main_menu_module.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ui/screens/menu/modules/main_menu_module", function(q) {
::MSU.MH.hook("scripts/ui/screens/menu/modules/main_menu_module", function(q) {
q.m.OnModOptionsPressedListener <- null;

q.setOnModOptionsPressedListener <- function( _listener )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar", function(q) {
::MSU.MH.hook("scripts/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar", function(q) {
q.isActiveEntity <- function( _entity )
{
local activeEntity = this.getActiveEntity();
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/ui/screens/tooltip/modules/tooltip.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ui/screens/tooltip/modules/tooltip", function(q) {
::MSU.MH.hook("scripts/ui/screens/tooltip/modules/tooltip", function(q) {
q.onQueryMSUTooltipData <- function(_data)
{
return ::TooltipScreen.m.TooltipEvents.onQueryMSUTooltipData(_data);
Expand Down
2 changes: 1 addition & 1 deletion msu/hooks/ui/screens/tooltip/tooltip_events.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::MSU.HooksMod.hook("scripts/ui/screens/tooltip/tooltip_events", function(q) {
::MSU.MH.hook("scripts/ui/screens/tooltip/tooltip_events", function(q) {
q.tactical_queryTileTooltipData = @(__original) function()
{
local ret = __original();
Expand Down
4 changes: 2 additions & 2 deletions msu/utils/skills.nut
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

function addEvent( _name, _function = null, _update = true, _aliveOnly = false )
{
::MSU.HooksMod.hook("scripts/skills/skill", function(q) {
::MSU.MH.hook("scripts/skills/skill", function(q) {
q[_name] <- _function == null ? function() {} : _function;
});

::MSU.HooksMod.hook("scripts/skills/skill_container", function(q) {
::MSU.MH.hook("scripts/skills/skill_container", function(q) {
if (_function == null || _function.getinfos().parameters.len() == 1) // for parameterless functions it should be a len 1 array containing "this"
{
q[_name] <- @() this.callSkillsFunction(_name, null, _update, _aliveOnly);
Expand Down
14 changes: 7 additions & 7 deletions scripts/!mods_preload/msu.nut
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
::MSU.HooksMod <- ::Hooks.register(::MSU.ID, ::MSU.Version, ::MSU.Name);
::MSU.HooksMod.require("vanilla" + " >= 1.5.0-13");
::MSU.HooksMod.conflictWith("mod_legends < 16.0.0");
::MSU.MH <- ::Hooks.register(::MSU.ID, ::MSU.Version, ::MSU.Name);
::MSU.MH.require("vanilla" + " >= 1.5.0-13");
::MSU.MH.conflictWith("mod_legends < 16.0.0");

::MSU.HooksMod.queue(function() {
::MSU.MH.queue(function() {
::include("msu/load.nut");
});

::MSU.HooksMod.queue(function() {
::MSU.MH.queue(function() {
foreach (func in ::MSU.QueueBucket.VeryLate)
{
func();
}
::MSU.QueueBucket.VeryLate.clear();
}, ::Hooks.QueueBucket.VeryLate);

::MSU.HooksMod.queue(function() {
::MSU.MH.queue(function() {
foreach (func in ::MSU.QueueBucket.AfterHooks)
{
func();
}
::MSU.QueueBucket.AfterHooks.clear();
}, ::Hooks.QueueBucket.AfterHooks);

::MSU.HooksMod.queue(function() {
::MSU.MH.queue(function() {
foreach (func in ::MSU.QueueBucket.FirstWorldInit)
{
func();
Expand Down

0 comments on commit de55d30

Please sign in to comment.