Skip to content

Commit

Permalink
added lockdownBeam tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronoVortex committed Feb 9, 2023
1 parent 3ee27ba commit e9463e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions data/vertex_module/xml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ customTagsWeapons["mindControl"] = function(node) -- Makes a weapon mind control

return mindControl
end
customTagsWeapons["lockdownBeam"] = function(node) -- Makes a beam weapon lock down rooms
if not tonumber(node:value()) then
error("Invalid number for lockdownBeam tag!", 2)
end
return tonumber(node:value())
end

-- Parse custom tags in blueprints and save them to tables
for _, file in ipairs(blueprintFiles) do
Expand Down Expand Up @@ -240,3 +246,12 @@ script.on_internal_event(Defines.InternalEvents.DAMAGE_AREA, function(shipManage
end
return Defines.Chain.CONTINUE, forceHit, shipFriendlyFire
end)

-- Handle lockdown beams
script.on_internal_event(Defines.InternalEvents.DAMAGE_BEAM, function(shipManager, projectile, location, damage, realNewTile, beamHitType)
local lockdown = weaponInfo[Hyperspace.Get_Projectile_Extend(projectile).name]["lockdownBeam"]
if lockdown > 0 and beamHitType == Defines.BeamHit.NEW_ROOM then
shipManager.ship:LockdownRoom(Hyperspace.ShipGraph.GetShipInfo(shipManager.iShipId):GetSelectedRoom(location.x, location.y, true), location)
end
return Defines.Chain.CONTINUE, beamHitType
end)
2 changes: 1 addition & 1 deletion mod-appendix/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<title><![CDATA[ Vertex Tags and Utility Functions ]]></title>
<threadUrl><![CDATA[ https://github.com/ChronoVortex/FTL-HS-Vertex ]]></threadUrl>
<author><![CDATA[ Vertaalfout, Chrono Vortex ]]></author>
<version><![CDATA[ 1.0 ]]></version>
<version><![CDATA[ 1.1 ]]></version>
<description>
<![CDATA[
This mod has no content, instead adding new tags and LUA utility functions for other mods to build off of.
Expand Down

0 comments on commit e9463e2

Please sign in to comment.