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

Add 350 teleport range limit #5856

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions engine/Core/Blueprints/UnitBlueprint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@
--- how much direct fire, indirect fire, and bombing capability it has.
--- Different AI's can interpret this value differently.
---@field SurfaceThreatLevel number
--- The maximum range of the unit's teleporter.
---@field TeleportMaxRadius? number

---@class UnitBlueprintDefenseShield
--- If this shield only blocks weapons marked with `ArtilleryShieldBlocks`.
Expand Down
2 changes: 2 additions & 0 deletions engine/Core/Categories.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ categories = {
OVERLAYOMNI = categoryValue,
OVERLAYRADAR = categoryValue,
OVERLAYSONAR = categoryValue,
OVERLAYTELEPORT = categoryValue
PATROLHELPER = categoryValue,
PERSONALSHIELD = categoryValue,
POD = categoryValue,
Expand Down Expand Up @@ -375,6 +376,7 @@ categories = {
---| "OVERLAYOMNI"
---| "OVERLAYRADAR"
---| "OVERLAYSONAR"
---| "OVERLAYTELEPORT"
---| "PATROLHELPER"
---| "PERSONALSHIELD"
---| "POD"
Expand Down
5 changes: 5 additions & 0 deletions loc/US/strings_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5025,6 +5025,7 @@ range_0010="Counter Intelligence"
range_0011="Combine Military"
range_0012="Assist range"
range_0013="Combine Intel"
range_0014="Teleport Range"
restricted_units_data_0000="No Tech 1"
restricted_units_data_0001="No Tech 2"
restricted_units_data_0002="No Tech 3"
Expand Down Expand Up @@ -5944,6 +5945,10 @@ tooltipui0751 = "Select attached factory"
tooltipui0752 = "Select base unit"
tooltipui0753 = "Right click to automatically deploy constructed units"

tooltipui0754 = "Teleport Destination too far!"
tooltipui0755 = "Teleport Range"
tooltipui0756 = "Toggle the range overlays of your teleporters"

trans_log_0000="Transmission Log"
uaa0101_desc="Air Scout"
uaa0101_help="Air Scout"
Expand Down
9 changes: 9 additions & 0 deletions lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4627,6 +4627,15 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent) {
return
end

local maxRadius = self.Blueprint.Defense.TeleportMaxRadius
if maxRadius then
local x, _, z = self:GetPositionXYZ()
if VDist2(location[1], location[3], x, z) > self.Blueprint.Defense.TeleportMaxRadius then
FloatingEntityText(self.EntityId, LOC("<LOC tooltipui0754>Teleport Destination too far!"))
return
end
end

if self.TeleportDrain then
RemoveEconomyEvent(self, self.TeleportDrain)
self.TeleportDrain = nil
Expand Down
1 change: 1 addition & 0 deletions lua/skins/skins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ skins = {
RULEUCC_Sacrifice = {'/textures/ui/common/game/cursors/sacrifice-.dds', 15, 15, 13, 12},
RULEUCC_Transport = {'/textures/ui/common/game/cursors/unload-.dds', 15, 3, 14, 12},
RULEUCC_Teleport = {'/textures/ui/common/game/cursors/transport.dds', 15, 15},
RULEUCC_TeleportDisabled = {'/textures/ui/common/game/cursors/transport-invalid.dds', 15, 15},
RULEUCC_Script = {'/textures/ui/common/game/cursors/attack.dds', 15, 15},
RULEUCC_Invalid = {'/textures/ui/common/game/cursors/attack-invalid.dds', 15, 15},
COORDINATED_ATTACK = {'/textures/ui/common/game/cursors/attack_coordinated.dds', 15, 15},
Expand Down
24 changes: 20 additions & 4 deletions lua/ui/controls/worldview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ local Prefs = import("/lua/user/prefs.lua")
local OverchargeCanKill = import("/lua/ui/game/unitview.lua").OverchargeCanKill
local CommandMode = import("/lua/ui/game/commandmode.lua")

-- upvalued for performance
local GetSelectedUnits = GetSelectedUnits



WorldViewParams = {
Expand Down Expand Up @@ -613,11 +616,24 @@ WorldView = ClassUI(moho.UIWorldView, Control) {
---@param changed boolean
OnCursorTeleport = function(self, identifier, enabled, changed, commandData)
if enabled then
if changed then
local cursor = self.Cursor
cursor[1], cursor[2], cursor[3], cursor[4], cursor[5] = UIUtil.GetCursor(identifier)
self:ApplyCursor()
local mouseX, _, mouseZ = unpack(GetMouseWorldPos())
local selection = GetSelectedUnits()

local reference = identifier
for i, unit in selection do
local maxRadius = unit:GetBlueprint().Defense.TeleportMaxRadius
if maxRadius then
local unitX, _, unitZ = unpack(unit:GetPosition())
if VDist2(mouseX, mouseZ, unitX, unitZ) > maxRadius then
reference = reference .. "Disabled"
break
end
end
end
local cursor = self.Cursor
cursor[1], cursor[2], cursor[3], cursor[4], cursor[5] = UIUtil.GetCursor(reference)

self:ApplyCursor()
end
end,

Expand Down
16 changes: 14 additions & 2 deletions lua/ui/game/rangeoverlayparams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ local glowIntelOver = '10'
---@field NormalColor Color
---@field SelectColor Color
---@field RolloverColor Color
---@field Inner number[]
---@field Outer number[]
---@field Inner number[] # Thickness of minimum range line (zoomed in, zoomed out)
---@field Outer number[] # Thickness of maximum range line (zoomed in, zoomed out)
---@field Type number
---@field Combo? boolean
---@field Tooltip string
Expand Down Expand Up @@ -135,6 +135,18 @@ RangeOverlayParams = {
Type = 1,
Tooltip = "overlay_misc",
},
Teleport = {
key = 'teleport',
Label = '<LOC range_0014>Teleport Range',
Categories = categories.OVERLAYTELEPORT,
NormalColor = glowAllNormal..'7b61d8',
SelectColor = glowAllSelect..'8c75d0',
RolloverColor = glowAllOver..'9c86e9',
Inner = innerMilitary,
Outer = outerMilitary,
Type = 3,
Tooltip = "overlay_teleport",
},
Comment on lines +138 to +149
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Game engine wont process this one.


AllIntel = {
key = 'allintel',
Expand Down
4 changes: 4 additions & 0 deletions lua/ui/help/tooltips.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,10 @@ Tooltips = {
title = "<LOC tooltipui0617>Combine Intelligence",
description = "<LOC tooltipui0618>Combine all sub-filters into a single overlay",
},
overlay_teleport = {
title = "<LOC tooltipui0755>Teleport Range",
description = "<LOC tooltipui0756>Toggle the range overlays of your teleporters",
},

-- **********************
-- ** Faction select
Expand Down
1 change: 1 addition & 0 deletions lua/ui/lobby/UnitsAnalyzer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ CategoriesHidden = {
["OVERLAYSONAR"] = true,
["OVERLAYDIRECTFIRE"] = true,
["OVERLAYRADAR"] = true,
["OVERLAYTELEPORT"] = true,
["OVERLAYOMNI"] = true,
["OVERLAYDEFENSE"] = true,
["OVERLAYANTINAVY"] = true,
Expand Down
2 changes: 2 additions & 0 deletions units/UAL0001/UAL0001_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ UnitBlueprint{
"MOBILE",
"OVERLAYDIRECTFIRE",
"OVERLAYOMNI",
"OVERLAYTELEPORT",
"PATROLHELPER",
"PRODUCTSC1",
"RECLAIM",
Expand All @@ -70,6 +71,7 @@ UnitBlueprint{
SkipDynamicThreatCalculations = true,
SubThreatLevel = 0,
SurfaceThreatLevel = 45,
TeleportMaxRadius = 350,
},
Display = {
Abilities = {
Expand Down
2 changes: 2 additions & 0 deletions units/UAL0301/UAL0301_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ UnitBlueprint{
"MOBILE",
"OVERLAYDIRECTFIRE",
"OVERLAYOMNI",
"OVERLAYTELEPORT",
"PATROLHELPER",
"PRODUCTSC1",
"RECLAIM",
Expand All @@ -62,6 +63,7 @@ UnitBlueprint{
RegenRate = 17,
SubThreatLevel = 0,
SurfaceThreatLevel = 30,
TeleportMaxRadius = 350,
},
Display = {
Abilities = {
Expand Down
2 changes: 2 additions & 0 deletions units/UEL0001/UEL0001_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ UnitBlueprint {
"OVERLAYDIRECTFIRE",
"OVERLAYINDIRECTFIRE",
"OVERLAYOMNI",
"OVERLAYTELEPORT",
"PATROLHELPER",
"PODSTAGINGPLATFORM",
"PRODUCTSC1",
Expand All @@ -77,6 +78,7 @@ UnitBlueprint {
SkipDynamicThreatCalculations = true,
SubThreatLevel = 0,
SurfaceThreatLevel = 45,
TeleportMaxRadius = 350,
},
Display = {
Abilities = {
Expand Down
2 changes: 2 additions & 0 deletions units/URL0001/URL0001_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ UnitBlueprint{
"MOBILE",
"OVERLAYDIRECTFIRE",
"OVERLAYOMNI",
"OVERLAYTELEPORT",
"PATROLHELPER",
"PRODUCTSC1",
"RECLAIM",
Expand All @@ -72,6 +73,7 @@ UnitBlueprint{
SkipDynamicThreatCalculations = true,
SubThreatLevel = 0,
SurfaceThreatLevel = 45,
TeleportMaxRadius = 350,
},
Display = {
Abilities = {
Expand Down
2 changes: 2 additions & 0 deletions units/XSL0001/XSL0001_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ UnitBlueprint{
"OVERLAYDIRECTFIRE",
"OVERLAYINDIRECTFIRE",
"OVERLAYOMNI",
"OVERLAYTELEPORT",
"PATROLHELPER",
"PRODUCTFA",
"RECLAIM",
Expand All @@ -83,6 +84,7 @@ UnitBlueprint{
SkipDynamicThreatCalculations = true,
SubThreatLevel = 0,
SurfaceThreatLevel = 45,
TeleportMaxRadius = 350,
},
Display = {
Abilities = {
Expand Down
2 changes: 2 additions & 0 deletions units/XSL0301/XSL0301_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ UnitBlueprint{
"MOBILE",
"OVERLAYDIRECTFIRE",
"OVERLAYOMNI",
"OVERLAYTELEPORT",
"PATROLHELPER",
"PRODUCTFA",
"RECLAIM",
Expand All @@ -67,6 +68,7 @@ UnitBlueprint{
RegenRate = 15,
SubThreatLevel = 0,
SurfaceThreatLevel = 527,
TeleportMaxRadius = 350,
},
Display = {
Abilities = {
Expand Down