From 321e74a414e3cb7406f0222f771b3442911673a4 Mon Sep 17 00:00:00 2001 From: ChronoVortex Date: Sat, 18 Feb 2023 00:28:06 -0800 Subject: [PATCH] added preignite, made noPowerFix weapons only --- data/hyperspace.xml.append | 1 + data/vertex_module/tags/noPowerFix.lua | 2 +- data/vertex_module/tags/preignited.lua | 48 ++++++++++++++++++++++++++ mod-appendix/metadata.xml | 2 +- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 data/vertex_module/tags/preignited.lua diff --git a/data/hyperspace.xml.append b/data/hyperspace.xml.append index e28e69d..09a3d2b 100644 --- a/data/hyperspace.xml.append +++ b/data/hyperspace.xml.append @@ -11,6 +11,7 @@ data/vertex_module/tags/lockdownBeam.lua data/vertex_module/tags/mindControl.lua data/vertex_module/tags/noPowerFix.lua + data/vertex_module/tags/preignited.lua data/vertex_module/xmlDataRead.lua diff --git a/data/vertex_module/tags/noPowerFix.lua b/data/vertex_module/tags/noPowerFix.lua index 03c46b4..65c157b 100644 --- a/data/vertex_module/tags/noPowerFix.lua +++ b/data/vertex_module/tags/noPowerFix.lua @@ -20,7 +20,7 @@ local crew_data = mods.vertexutil.crew_data ------------ -- PARSER -- ------------ -customTagsAll["noPowerFix"] = function(node) +customTagsWeapons["noPowerFix"] = function(node) return {doFix = true} end diff --git a/data/vertex_module/tags/preignited.lua b/data/vertex_module/tags/preignited.lua new file mode 100644 index 0000000..b45323b --- /dev/null +++ b/data/vertex_module/tags/preignited.lua @@ -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) diff --git a/mod-appendix/metadata.xml b/mod-appendix/metadata.xml index c016657..d6c987d 100644 --- a/mod-appendix/metadata.xml +++ b/mod-appendix/metadata.xml @@ -2,7 +2,7 @@ <![CDATA[ Vertex Tags and Utility Functions ]]> - +