Skip to content

Commit

Permalink
Added Civilian Detection Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
LukenSkyne committed May 13, 2021
1 parent e71fbbb commit 14022d7
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 7 deletions.
8 changes: 7 additions & 1 deletion NX-Tweaks/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
"nx_ssc": "NX-Tweaks",

"nx_disable_shaped_charges_during_stealth_title": "Disable Shaped Charges During Stealth",
"nx_disable_shaped_charges_during_stealth_desc": "turn off to use shaped charges during stealth, how sneaky!"
"nx_disable_shaped_charges_during_stealth_desc": "turn off to use shaped charges during stealth, how sneaky!",

"nx_civilians_distinguish_detection_title": "Civilians: Distinguish Detection",
"nx_civilians_distinguish_detection_desc": "changes the icon & color of the detection marker for civilians",

"nx_civilians_display_intimidation_title": "Civilians: Display Intimidation",
"nx_civilians_display_intimidation_desc": "changes the icon & color of the marker for intimidated/dropped civilians"
}
4 changes: 3 additions & 1 deletion NX-Tweaks/menu/Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ NX.settings_file = SavePath .. "NX-Tweaks.json"
NX.locale_file = NX.locale_path .. "en.json"

NX.settings = {
disable_shaped_charges_during_stealth = true
disable_shaped_charges_during_stealth = true,
civilians_distinguish_detection = false,
civilians_display_intimidation = false,
}

-- no BLT, no MenuHelper ):
Expand Down
14 changes: 9 additions & 5 deletions NX-Tweaks/mod.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
{
"name": "NX-Tweaks",
"description": "This mod provides some smaller quality of life changes to improve your game experience (: \n\nFeatures:\n- Disable Shaped Charges During Stealth",
"description": "This mod provides some smaller quality of life changes to improve your game experience (: \n\nFeatures:\n- Disable Shaped Charges During Stealth\n- Civilians: Distinguish Detection\n- Civilians: Display Intimidation",
"author": "Luken",
"contact": "Discord @ Luken#1104",
"version": "0.0.2",
"version": "0.0.3",
"blt_version": 2,
"color": "0 0 0",
"image": "NX_1000px.png",
"priority": 100,
"priority": 0,
"hooks" : [
{
"hook_id": "lib/managers/menumanager",
"script_path": "menu/Menu.lua"
},
{
"hook_id" : "lib/units/interactions/interactionext",
"script_path" : "scripts/Interaction.lua"
"hook_id": "lib/units/interactions/interactionext",
"script_path": "scripts/Interaction.lua"
},
{
"hook_id": "lib/managers/group_ai_states/groupaistatebase",
"script_path": "scripts/GroupAIStateBase.lua"
}
],
"updates" : [
{
Expand Down
49 changes: 49 additions & 0 deletions NX-Tweaks/scripts/GroupAIStateBase.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-- civilians_distinguish_detection
-- civilians_display_intimidation

local _upd_criminal_suspicion_progress_original = GroupAIStateBase._upd_criminal_suspicion_progress

function GroupAIStateBase:_upd_criminal_suspicion_progress(...)
if self._ai_enabled then
for obs_key, obs_susp_data in pairs(self._suspicion_hud_data or {}) do
local unit = obs_susp_data.u_observer

if managers.enemy:is_civilian(unit) then
local waypoint_id = "susp1" .. tostring(obs_key)
local waypoint = managers.hud and managers.hud._hud.waypoints[waypoint_id]

if waypoint then
local color, arrow_color

if unit:anim_data().drop and NX.settings.civilians_display_intimidation then
if not obs_susp_data._subdued_civ then
obs_susp_data._alerted_civ = nil
obs_susp_data._subdued_civ = true
color = Color(0, 0.71, 1)
arrow_color = Color(0, 0.35, 0.5)
waypoint.bitmap:set_image("guis/textures/menu_tickbox")
waypoint.bitmap:set_texture_rect(24, 0, 24, 24)
end
elseif obs_susp_data.alerted and NX.settings.civilians_distinguish_detection then
if not obs_susp_data._alerted_civ then
obs_susp_data._subdued_civ = nil
obs_susp_data._alerted_civ = true

color = Color(1, 0.5, 0)
arrow_color = Color(0.5, 0.25, 0)
waypoint.bitmap:set_image("guis/textures/menu_tickbox")
waypoint.bitmap:set_texture_rect(0, 0, 24, 24)
end
end

if color and arrow_color then
waypoint.bitmap:set_color(color)
waypoint.arrow:set_color(arrow_color:with_alpha(0.75))
end
end
end
end
end

return _upd_criminal_suspicion_progress_original(self, ...)
end
2 changes: 2 additions & 0 deletions NX-Tweaks/scripts/Interaction.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- disable_shaped_charges_during_stealth

if string.lower(RequiredScript) == "lib/units/interactions/interactionext" then
local BaseInteraction_can_select_original = BaseInteractionExt.can_select

Expand Down

0 comments on commit 14022d7

Please sign in to comment.