Skip to content

Porting Mods and Scripts from pre Beat 22 to Beta 22 or older

Robosturm edited this page Jan 31, 2022 · 4 revisions

Step 1

Search and replace all js/jsm files for example with notepad++. Replace the left side with the right side:

  • "createAnimation(" --> "createAnimation(map, "
  • "createBattleAnimation(" --> "createBattleAnimation(map, "
  • "createGameAnimationDialog(" --> "createGameAnimationDialog(map, "
  • "createWalkingAnimation(" --> "createWalkingAnimation(map, "
  • "createGameAnimationCapture(" --> "createGameAnimationCapture(map, "
  • "map !== 'undefined'" --> "map !== null"
  • "map !== "undefined"" --> ""map !== null"

Step 2

Next you can search and replace for the following script types:

Gamescripts

  • "actionDone = function(action)" --> "actionDone = function(action, map)"
  • "victory = function(team)" --> "victory = function(team, map)"
  • "turnStart = function(turn, player)" --> "turnStart = function(turn, player, map)"
  • "gameStart = function()" --> "gameStart = function(map)"

For CO's

  • "gameStart = function()" --> "gameStart = function(map)"
  • "createExplosionAnimation = function(x, y, unit)" --> "this.createExplosionAnimation = function(x, y, unit, map)"
  • "doWalkingAnimation = function(action)" --> "this.doWalkingAnimation = function(action, map)"
  • "doWalkingAnimation(action)" --> "doWalkingAnimation(action, map)"
  • "perform = function(action)" --> "perform = function(action, map)"
  • "activatePower = function(co)" --> "activatePower = function(co, map)"
  • "activateSuperpower = function(co, powerMode)" --> "activateSuperpower = function(co, powerMode, map)"
  • "getCOUnitRange = function(co)" --> "this.getCOUnitRange = function(co, map)"
  • "loadCOMusic = function(co)" --> "this.loadCOMusic = function(co, map)"
  • "defender, defPosX, defPosY, isDefender, action)" --> "defender, defPosX, defPosY, isDefender, action, luckmode, map)"
  • "defender, defPosX, defPosY, isDefender, action, luckmode)" --> "defender, defPosX, defPosY, isDefender, action, luckmode, map)"
  • "defender, defPosX, defPosY, isAttacker, action)" --> "defender, defPosX, defPosY, isAttacker, action, luckmode, map)"
  • "defender, defPosX, defPosY, isAttacker, action, luckmode)" --> "defender, defPosX, defPosY, isAttacker, action, luckmode, map)"
  • "startOfTurn = function(co)" --> "startOfTurn = function(co, map)"
  • "postBattleActions = function(co, attacker, atkDamage, defender, gotAttacked, weapon, action)" --> "postBattleActions = function(co, attacker, atkDamage, defender, gotAttacked, weapon, action, map)"
  • "getMovementpointModifier = function(co, unit, posX, posY)" --> "getMovementpointModifier = function(co, unit, posX, posY, map)"
  • "getAiCoUnitBonus = function(co, unit)" --> "getAiCoUnitBonus = function(co, unit, map)"
  • "init = function(co)" --> "init = function(co, map)"
  • "gainPowerstar = function(co, fundsDamage, x, y, hpDamage, defender, counterAttack)" --> "gainPowerstar = function(co, fundsDamage, x, y, * hpDamage, defender, counterAttack, map)"
  • "getCOUnits = function(co, building)" --> "getCOUnits = function(co, building, map)"
  • "getMovementFuelCostModifier = function(co, unit, fuelCost)" --> "getMovementFuelCostModifier = function(co, unit, fuelCost, map)"
  • "getMovementcostModifier = function(co, unit, posX, posY)" --> "getMovementcostModifier = function(co, unit, posX, posY, map)"
  • "getIncomeReduction = function(co, building, income)" --> "getIncomeReduction = function(co, building, income, map)"
  • "getCaptureBonus = function(co, unit, posX, posY)" --> "getCaptureBonus = function(co, unit, posX, posY, map)"
  • "getRepairBonus = function(co, unit, posX, posY)" --> "getRepairBonus = function(co, unit, posX, posY, map)"
  • "getCostModifier = function(co, id, baseCost, posX, posY)" --> "getCostModifier = function(co, id, baseCost, posX, posY, map)"
  • "getTerrainDefenseModifier = function(co, unit, posX, posY)" --> "getTerrainDefenseModifier = function(co, unit, posX, posY, map)"
  • "getVisionrangeModifier = function(co, unit, posX, posY)" --> "getVisionrangeModifier = function(co, unit, posX, posY, map)"
  • "getFirerangeModifier = function(co, unit, posX, posY)" --> "getFirerangeModifier = function(co, unit, posX, posY, map)"
  • "defender, defPosX, defPosY, isAttacker, action, luckMode)" --> "defender, defPosX, defPosY, isAttacker, action, luckMode, map)"
  • "postAction = function(co, action)" --> "postAction = function(co, action, map)"
  • "getBonusLuck = function(co, unit, posX, posY)" --> "getBonusLuck = function(co, unit, posX, posY, map)"
  • "getBonusMisfortune = function(co, unit, posX, posY)" --> "getBonusMisfortune = function(co, unit, posX, posY, map)"
  • "postAnimationDamage = function(postAnimation)" --> "postAnimationDamage = function(postAnimation, map)"
  • "getFuelCostModifier = function(co, unit, costs)" --> "getFuelCostModifier = function(co, unit, costs, map)"
  • "getHpHidden = function(co, unit, posX, posY)" --> "getHpHidden = function(co, unit, posX, posY, map)"
  • "getAiCoBuildRatioModifier = function(co)" --> "getAiCoBuildRatioModifier = function(co, map)"
  • "getAdditionalBuildingActions = function(co, building)" --> "getAdditionalBuildingActions = function(co, building, map)"
  • "getFirstStrike = function(co, unit, posX, posY, attacker, isDefender)" --> "getFirstStrike = function(co, unit, posX, posY, attacker, isDefender, map)"
  • "getPerfectVision = function(co)" --> "getPerfectVision = function(co, map)"
  • "canBeRepaired = function(co, unit, posX, posY)" --> "canBeRepaired = function(co, unit, posX, posY, map)"
  • "defender, defPosX, defPosY, isDefender, luckMode)" --> "defender, defPosX, defPosY, isDefender, luckMode, map)"
  • "getAttackHpBonus = function(co, unit, posX, posY)" --> "getAttackHpBonus = function(co, unit, posX, posY, map)"
  • "getWeatherImmune = function(co)" --> "getWeatherImmune = function(co, map)"
  • "buildedUnit = function(co, unit)" --> "buildedUnit = function(co, unit, map)"
  • "getBonusIncome = function(co, building, income)" --> "getBonusIncome = function(co, building, income, map)"
  • "getActionModifierList = function(co, unit)" --> "getActionModifierList = function(co, unit, map)"
  • "getEnemyTerrainDefenseModifier = function(co, unit, posX, posY)" --> "getEnemyTerrainDefenseModifier = function(co, unit, posX, posY, map)"
  • "getPerfectHpView = function(co, unit, posX, posY)" --> "getPerfectHpView = function(co, unit, posX, posY, map)"

Actions

  • "getActionText = function()" --> "getActionText = function(map)"
  • "getIcon = function()" --> "getIcon = function(map)"
  • "canBePerformed = function(action)" --> "canBePerformed = function(action, map)"
  • "isFinalStep = function(action)" --> "isFinalStep = function(action, map)"
  • "getStepInputType = function(action)" --> "getStepInputType = function(action, map)"
  • "getStepCursor = function(action, cursorData)" --> "getStepCursor = function(action, cursorData, map)"
  • "performPostAnimation = function(postAnimation)" --> "performPostAnimation = function(postAnimation, map)"

Random Map Generators

  • "Placeable : function(x, y)" --> "Placeable : function(x, y, map)"
  • "getBuildingBaseTerrain(x, y)" --> "getBuildingBaseTerrain(x, y, map)"
  • "getBuildingBaseTerrain : function(x, y)" --> "getBuildingBaseTerrain : function(x, y, map)"

Buildings

  • "getVision = function(building)" --> "getVision = function(building)"
  • "onDestroyed = function(building)" --> "onDestroyed = function(building, map)"
  • "startOfTurn = function(building)" --> "startOfTurn = function(building, map)"

Movementtables

  • "getMovementpoints = function(terrain, unit, currentTerrain, trapChecking)", "getMovementpoints = function(terrain, unit, currentTerrain, trapChecking, map)"

Terrain

  • "getTerrainAnimationBase = function(unit, terrain)" --> "getTerrainAnimationBase = function(unit, terrain, defender, map)"
  • "getTerrainAnimationBase = function(unit, terrain, defender)" --> "getTerrainAnimationBase = function(unit, terrain, defender, map)"
  • "getWeatherModifier()" --> "getWeatherModifier(map)"
  • "getTerrainAnimationForeground = function(unit, terrain)" --> "getTerrainAnimationForeground = function(unit, terrain, defender, map)"
  • "getTerrainAnimationForeground = function(unit, terrain, defender)" --> "getTerrainAnimationForeground = function(unit, terrain, defender, map)"
  • "getTerrainAnimationBackground = function(unit, terrain)" --> "getTerrainAnimationBackground = function(unit, terrain, defender, map)"
  • "getTerrainAnimationBackground = function(unit, terrain, defender)" --> "getTerrainAnimationBackground = function(unit, terrain, defender, map)"
  • "onDestroyed = function(terrain)" --> "onDestroyed = function(terrain, map)"
  • "loadBaseSprite = function(terrain)" --> "loadBaseSprite = function(terrain, map)"
  • "loadOverlaySprite = function(terrain)" --> "loadOverlaySprite = function(terrain, map)"

Weather

  • "activate = function(weather)" --> "activate = function(weather, map)"

Units

  • "transporterRefilling(unit)" --> "transporterRefilling(unit, map)"
  • "repairUnit(unit, 1)" --> "repairUnit(unit, 1, map)"
  • "repairUnit(unit, 2)" --> "repairUnit(unit, 2, map)"

Step 3

Finally you can search for map and see if the function gets called with map as an argument. If a function using map without getting called with map as an argument you need to refactor that function manually.

Clone this wiki locally