Skip to content

Commit

Permalink
added preignite, made noPowerFix weapons only
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronoVortex committed Feb 18, 2023
1 parent b05f445 commit 321e74a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions data/hyperspace.xml.append
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<mod-append:script>data/vertex_module/tags/lockdownBeam.lua</mod-append:script>
<mod-append:script>data/vertex_module/tags/mindControl.lua</mod-append:script>
<mod-append:script>data/vertex_module/tags/noPowerFix.lua</mod-append:script>
<mod-append:script>data/vertex_module/tags/preignited.lua</mod-append:script>

<mod-append:script>data/vertex_module/xmlDataRead.lua</mod-append:script>
</mod:findLike>
Expand Down
2 changes: 1 addition & 1 deletion data/vertex_module/tags/noPowerFix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local crew_data = mods.vertexutil.crew_data
------------
-- PARSER --
------------
customTagsAll["noPowerFix"] = function(node)
customTagsWeapons["noPowerFix"] = function(node)
return {doFix = true}
end

Expand Down
48 changes: 48 additions & 0 deletions data/vertex_module/tags/preignited.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
-------------
-- IMPORTS --
-------------
local weaponInfo = mods.vertexdata.weaponInfo
local droneInfo = mods.vertexdata.droneInfo
local customTagsAll = mods.vertexdata.customTagsAll
local customTagsWeapons = mods.vertexdata.customTagsWeapons
local customTagsDrones = mods.vertexdata.customTagsDrones
local Children = mods.vertexdata.Children
local parse_xml_bool = mods.vertexdata.parse_xml_bool

local vter = mods.vertexutil.vter
local under_mind_system = mods.vertexutil.under_mind_system
local can_be_mind_controlled = mods.vertexutil.can_be_mind_controlled
local get_ship_crew_point = mods.vertexutil.get_ship_crew_point
local get_adjacent_rooms = mods.vertexutil.get_adjacent_rooms
local get_room_at_location = mods.vertexutil.get_room_at_location
local crew_data = mods.vertexutil.crew_data

------------
-- PARSER --
------------
customTagsWeapons["preignited"] = function(node)
return {doPreignite = true}
end

-----------
-- LOGIC --
-----------
local wasJumping = false
script.on_internal_event(Defines.InternalEvents.ON_TICK, function()
local isJumping = false
if pcall(function() isJumping = Hyperspace.ships.player.bJumping end) then
if not isJumping and wasJumping then
local weapons = nil
pcall(function() weapons = Hyperspace.ships.player.weaponSystem.weapons end)
if weapons then
for weapon in vter(weapons) do
local preignited = weaponInfo[weapon.blueprint.name]["preignited"]
if preignited and preignited.doPreignite and weapon.powered and weapon.cooldown.first < weapon.cooldown.second then
weapon.cooldown.first = weapon.cooldown.second - Hyperspace.FPS.SpeedFactor/16
end
end
end
end
wasJumping = isJumping
end
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.8 ]]></version>
<version><![CDATA[ 1.9 ]]></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 321e74a

Please sign in to comment.