Removed Unnecessary Mod Files; Updated Mods

This commit is contained in:
2024-03-20 06:40:41 -04:00
parent 7f0caa168b
commit 290378b961
185 changed files with 14333 additions and 8374 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,27 @@
-- ======================================================================
--[[ Personal Adjustable Waypoint
-- ======================================================================
Mapspot DXML update script
Author: Catspaw (CatspawMods @ ModDB)
Source: https://www.moddb.com/mods/stalker-anomaly/addons/personal-adjustable-waypoint-for-anomaly-151-152-and-gamma
Modifying the contents of this file will only result in sadness.
-- ===================================================================--]]
function on_xml_read()
RegisterScriptCallback("on_xml_read",
function(xml_file_name, xml_obj)
if (xml_file_name == [[ui\map_spots.xml]]) or
(xml_file_name == [[ui\map_spots_16.xml]]) or
(xml_file_name == [[ui\map_spots_21.xml]]) then
printf("DXML is patching mapspots for PAW in %s",xml_file_name)
local paw_mapspots_include =
[[
#include "ui\map_spots_paw.xml"
]]
xml_obj:insertFromXMLString(paw_mapspots_include)
end
end
)
end
@@ -0,0 +1,371 @@
-- ======================================================================
--[[ Personal Adjustable Waypoint
-- ======================================================================
HUD reticle features script
Author: Catspaw (CatspawMods @ ModDB)
Source: https://www.moddb.com/mods/stalker-anomaly/addons/personal-adjustable-waypoint-for-anomaly-151-152-and-gamma
Portions of the target ID code adapted from Crook's Faction ID addon.
The main script actually loads the MCM settings for Crook's addon, if
it is installed, so that reticle behavior should mirror the NPC ID.
-- ===================================================================--]]
assert(tasks_placeable_waypoints ~= nil, "\n\n"..
"~ ------------------------------------------------------------------------\n"..
"Could not find tasks_placeable_waypoints.script - PAW is not installed".."\n"..
"~ ------------------------------------------------------------------------\n"
)
paw = tasks_placeable_waypoints
dl = paw.dl
vl = paw.vl
unsquish_aspect = paw.unsquish_aspect
easing_outquint = paw.easing_outquint
npc_ident = paw.npc_ident
anim_fade = paw.anim_fade
reticle_color = paw.reticle_color
autotag_milpda = paw.autotag_milpda_feature
pda_feature_en = item_milpda and item_milpda.pda_feature_enabled
-- ======================================================================
class "UIPAWReticle" (CUIScriptWnd)
function UIPAWReticle:__init() super()
--printf("UIPAWReticle:__init(%s)",id)
self:InitControls()
RegisterScriptCallback("actor_on_net_destroy", self)
end
function UIPAWReticle:__finalize()
end
function UIPAWReticle:InitControls(id)
--printf("UIPAWReticle:InitControls(%s)",id)
self.unknown = game.translate_string("st_paw_unknown")
self.namecache = {}
self.newtags = {}
self.last_tick = 0
self.last_check_time = 0
self:SetAutoDelete(true)
self.xml = CScriptXmlInit()
self.xml:ParseFile("paw_hud_pin_icon.xml")
self.reticle = self.xml:InitStatic("marker",self)
self.objtex = "ui_icons_paw_crosshair_valid"
self.idtex = "ui_icons_paw_crosshair_targetid"
self.locktex = "ui_icons_paw_crosshair_targetlock"
self.tex = self.idtex
self.reticle:InitTexture(self.tex)
local clr = reticle_color
self.reticle:SetTextureColor(GetARGB(clr.a,clr.r,clr.g,clr.b))
self.reticle:SetWndSize(vector2():set(32,32))
unsquish_aspect(self.reticle)
local w = self.reticle:GetWidth()
local h = self.reticle:GetHeight()
self.reticle:SetWndPos(vector2():set(512.5,384.5))
self:ShowMarker(false)
end
function UIPAWReticle:Destroy()
get_hud():RemoveDialogToRender(self)
end
function UIPAWReticle:actor_on_net_destroy()
get_hud():RemoveDialogToRender(self)
end
function UIPAWReticle:ShowMarker(onoff)
self.reticle:Show(onoff)
end
function UIPAWReticle:npc_on_death_callback(npc, who)
if not self.last_target then return end
if npc:id() == self.last_target:id() then
self:TargetOut(self.last_target)
self.last_target = nil
end
end
function UIPAWReticle:npc_on_net_destroy(npc)
if not self.last_target then return end
if npc:id() == self.last_target:id() then
self:TargetOut(self.last_target)
self.last_target = nil
end
end
function UIPAWReticle:IsValidTagTarget(obj)
return obj and (IsStalker(obj) or IsMonster(obj)) and (not paw.blacklisted_object(obj:id())) and (obj:id() ~= 0) and (npc_ident.id_bodies or (obj.health > 0))
end
function UIPAWReticle:GetTargetName(obj)
if not obj then return end
if self.namecache[obj] then return self.namecache[obj] end
local name
if IsStalker(obj) then
name = obj:character_name()
else
--local id = obj:id()
--name = paw.safename(id)
--if name == self.unknown then name = name..id end
name = obj:name()
end
self.namecache[obj] = name
return name
end
function UIPAWReticle:GetIDProgress(obj,name)
--printf("UIPAWReticle:GetIDProgress: %s (%s)",self:GetTargetName(obj),obj and obj:id())
name = name or self:GetTargetName(obj)
local progress = npc_ident.progress
if not progress[name] then
progress[name] = 0
end
if progress[name] >= 1 then
return 1
end
if not npc_ident.delay_id then
if progress[name] == 0 then
self.newtags[name] = true
end
progress[name] = 1
return 1
end
local distance = db.actor:position():distance_to_sqr(obj:position())
if distance < 2500 then
if progress[name] == 0 then
self.newtags[name] = true
end
progress[name] = 1
return 1
end
local power = (100 / ((distance - 2500) * 0.1) / device().fov) * (npc_ident.tick_speed * 0.1)
progress[name] = progress[name] + (power * npc_ident.id_speed)
if progress[name] >= 1 then
progress[name] = 1
self.newtags[name] = true
return 1
else
--printf("GetIDProgress: %s has %s progress towards identification at %s",name,progress[name],time_global())
end
return progress[name]
end
function UIPAWReticle:OnTarget(obj)
if not obj then return end
local progress = self:GetIDProgress(obj,name,id)
return progress
end
function UIPAWReticle:TargetOut()
self:ShowMarker(false)
end
function UIPAWReticle:UpdateIDProgress(obj,name)
if not obj then return end
name = name or self:GetTargetName(obj)
if (time_global() - self.last_tick) < npc_ident.tick_speed then return end
self.last_tick = time_global()
if not npc_ident.progress[name] then return end
local progress = self:GetIDProgress(obj,name)
return progress
end
function UIPAWReticle:TargetIDTick(obj,name,id)
name = name or self:GetTargetName(obj)
id = id or (obj and obj:id())
progress = 0
if self:IsValidTagTarget(obj) then
if self.last_target then
if obj:id() ~= self.last_target:id() then
self:ShowMarker(false)
progress = self:OnTarget(obj,name,id)
else
progress = self:UpdateIDProgress(obj,name)
end
else
progress = self:OnTarget(obj,name,id)
end
self.last_target = obj
return progress
else
if self.last_target then
if npc_ident.lenience >= 1.0 then
self:ShowMarker(false)
self.last_target = nil
return 0
end
if (time_global() - self.last_check_time) > 100 then
self.last_check_time = time_global()
local pos = utils_obj.safe_bone_pos(self.last_target, "bip01_spine")
if pos then
local dot = paw.dist_from_crosshair(pos)
if dot < npc_ident.lenience then
self:TargetOut()
self.last_target = nil
return 0
end
end
end
end
end
if self.last_target then
progress = self:UpdateIDProgress(self.last_target)
end
return progress
end
function UIPAWReticle:UpdateAutotagReticle(obj,name,id)
self:TargetIDTick(obj,name,id)
local progress = (name and npc_ident.progress[name]) or 0
if self.playing_anim then
--printf("<PAW> Reticle animation still playing, skipping update cycle")
self:ShowMarker(true)
return
end
if id and name and progress then
local tex = self.idtex
--printf("<PAW> TargetID progress for %s (%s): %s",name,id,progress)
if progress <= 0 then
self:ShowMarker(false)
return
elseif progress >= 1 then
progress = 1
if paw.pins[id] then tex = self.locktex end
end
local alpha = reticle_color.a
self.reticle:InitTexture(tex)
if self.newtags[name] then
local smart_pins = paw.smart_pins
function play_tag_crosshair_anim()
self.playing_anim = false
self.reticle:SetTextureColor(GetARGB(alpha,255,255,255))
self.reticle:SetWndSize(vector2():set(32,32))
unsquish_aspect(self.reticle)
self:ShowMarker(true)
--printf("<PAW> End anim timeevent at %s, reticle to 32x32",time_global())
return true
end
--printf("<PAW> New positive ID on %s, calling smart pin",name)
self.reticle:InitTexture(self.locktex)
self.reticle:SetTextureColor(GetARGB(alpha,255,255,255))
self.reticle:SetWndSize(vector2():set(24,24))
unsquish_aspect(self.reticle)
self.newtags[name] = nil
self.playing_anim = true
--printf("<PAW> Starting anim timeevent at %s, reticle to 24x24",time_global())
CreateTimeEvent("paw_crosshair_tag_anim",time_global(),0.125,play_tag_crosshair_anim)
local target = paw.get_smart_target_type(obj)
local smartpin = target and smart_pins[target]
--printf("smart pin type %s: enabled %s | pin %s",target,smartpin and smartpin.enabled,smartpin and smartpin.pin)
if (not (id and paw.pins[id])) and smartpin and smartpin.enabled and smartpin.pin then
paw.autotag_target(true)
end
return
end
local w = 80 - (48 * progress)
local h = 80 - (48 * progress)
--printf("<PAW> Setting reticle to %sx%s at %s",w,h,time_global())
self.reticle:SetTextureColor(GetARGB(alpha * progress,255,255,255))
self.reticle:SetWndSize(vector2():set(w,h))
unsquish_aspect(self.reticle)
self:ShowMarker(true)
end
end
function UIPAWReticle:UpdateValidObjectReticle(obj,name,id)
if id and (id > 0) then
--printf("Reticle has valid id %s",id)
local se_obj = alife_object(id)
if not se_obj then return end
if paw.allow_non_wp_targets or paw.valid_waypoint_target(se_obj) then
self:ShowMarker(true)
vl("ID %s is a valid waypoint/pin target",id)
if not (self.hovered or self.fading_in) then
anim_fade(self.reticle,0,reticle_color.a,400,"reticle_fade",false,nil,nil,nil,easing_outquint,nil,abort_fade_in)
self.fading_in = true
self.fading_out = false
self.hovered = true
end
return
end
elseif self.hovered then
self.hovered = false
self.fading_out = true
self.fading_in = false
anim_fade(self.reticle,reticle_color.a,0,600,"reticle_fade",false,nil,nil,nil,easing_outquint,nil,abort_fade_out)
return
end
if not self.fading_out then
self:ShowMarker(false)
end
end
function UIPAWReticle:Update()
local mode = paw.reticle_mode
local cart_mode = paw.cart_mode
local enabled = false
if autotag_milpda and pda_feature_en then
local dev = db.actor:item_in_slot(8)
enabled = dev and pda_feature_en(dev:section(),"autotag")
if not enabled then mode = 0 end
end
if mode and type(mode) == "number" then
if mode == 0 then
self:ShowMarker(false)
get_hud():RemoveDialogToRender(self)
return
end
enabled = (mode > 0) and paw.feature_valid_in_mode(mode)
--printf("UIPAWReticle: mode %s + cart_mode %s = enabled %s",mode,cart_mode,enabled)
end
CUIScriptWnd.Update(self)
if enabled and ((main_hud_shown() and not paw.reticle_mustzoom) or
axr_main.binoc_is_zoomed or
axr_main.scoped_weapon_is_zoomed) then
local obj = level.get_target_obj()
local id = obj and obj:id()
local name = self:GetTargetName(obj)
if paw.mark_on_positive_id then
self:UpdateAutotagReticle(obj,name,id)
else
self:UpdateValidObjectReticle(obj,name,id)
end
else
self:ShowMarker(false)
end
end
@@ -0,0 +1,260 @@
-- ======================================================================
--[[ Monkeypatch to enable dynamic UI elements in MCM
-- ======================================================================
Author: Catspaw
Version: 2.3
Updated: 20231020
Source: https://www.moddb.com/mods/stalker-anomaly/addons/personal-adjustable-waypoint-for-anomaly-151-152-and-gamma
Included with Personal Adjustable Waypoint, but parameterized so that
any addon can make use of it.
The code in this script is based on code from RavenAscendant's MCM,
which is in turn based on the works of Tronex and others.
You may freely include this script in your own addon, unaltered--but
unless your name is RavenAscendant, please do not release it merged
with ui_mcm.script or otherwise as an integrated alteration to your
own (or your modpack's) version of MCM.
2.3 roll back support for the Track element due to reported issues
2.2 adds "borderless" attribute to the slide element and "desc"
to supported elements
2.1 adds support for the Track element.
-- ======================================================================
USAGE
-- ======================================================================
Adds a new functor attribute to the Slide and Image element types:
- [ui_hook_functor]
- Define: ( table {function, parameters} )
- Used by: image, slide, list, desc (only in this monkeypatch)
- Parameters passed: anchor, handlers, attrs, flags
Execute a function on initial registration of a UI element
anchor - empty static image container
handlers- table of UI handlers
attrs - table of MCM attributes for the menu option
flags - table of MCM metadata
The value of the "parameters" option in the table is added to the end of the parameters list.
Adds a new functor attribute that triggers on changes in all input types:
- [on_selection_functor]
- Define: ( table {function, parameters} )
- Used by option elements: ALL (only in this monkeypatch)
- Parameters passed: path, opt, value, attrs
Execute a function on any unsaved change to an option value
path - MCM path to changed option
opt - name of the changed option
value - value of uncommitted change
attrs - table of MCM attributes for the menu option
The value of the "parameters" option in the table is added to the end of the parameters list.
For most purposes, like simple custom text or image display and/or
formatting, it is sufficient to just instantiate an "image"-type
menu element with a ui_hook_functor, and let the called functor do
whatever work is necessary to build your UI.
-- ======================================================================
COMPATIBILITY / TROUBLESHOOTING
-- ======================================================================
This monkeypatch should work with any recent MCM version. If yours
is old and doesn't work, just upgrade already.
This monkeypatch should NOT alter any functionality of MCM for any
element that does not explicitly invoke either of the new functors.
However, if you beleve this script is causing problems, you should be
able to delete or disable it without causing issues. Anyone using
these functors in their own addon should know to have it gracefully
fail if this script is missing.
-- ==================================================================--]]
if ui_mcm and not ui_mcm.ui_functors_enabled then
cache_value = ui_mcm.UIMCM.CacheValue
-- Storing pointer to the unmodified MCM function
function init_wrapper_box(xml, anchor, w, h, posx, posy)
if not (xml and anchor) then return end
wrapbox = xml:InitStatic("elements:image", anchor)
if not wrapbox then return end
w = w or anchor:GetWidth()
h = h or anchor:GetHeight()
posx = posx and (type(posx) == "number") and posx or 0
posy = posy and (type(posy) == "number") and posy or 0
wrapbox:SetWndSize(vector2():set(w,h))
pos = wrapbox:GetWndPos()
wrapbox:SetWndPos(vector2():set(pos.x + posx, pos.y + posy))
return wrapbox
end
function ui_mcm.UIMCM:CacheValue(path, opt, value, v)
cache_value(self,path,opt,value,v)
-- Use pointer to pass the args through to MCM unaltered
-- We need to prepend "self" to the args because we're invoking a class method without the colon
if v and v.on_selection_functor then ui_mcm.exec(unpack(v.on_selection_functor),path,opt,value,v) end
-- If the on_selection_functor attribute contains a functor, pass a copy of the same args to the functor
end
function ui_mcm.UIMCM:Register_Image(xml, handler, v)
local pic = xml:InitStatic("elements:image",handler)
if v.link then
if (v.pos) then
local pos = pic:GetWndPos()
pic:SetWndPos(vector2():set( pos.x + v.pos[1] , pos.y + v.pos[2] ))
end
if (v.size) then
pic:SetWndSize(vector2():set( v.size[1] , v.size[2] ))
end
pic:InitTexture(v.link)
pic:SetStretchTexture(v.stretch and true or false)
end
if v.ui_hook_functor then
local wrapbox = init_wrapper_box(xml,handler,pic:GetWidth(),pic:GetHeight(),-10)
local handlers = {
pic = pic, -- Handler for the image element
}
local flags = {
etype = "image",
}
ui_mcm.exec(unpack(v.ui_hook_functor),wrapbox,handlers,v,flags)
end
return pic:GetHeight()
end
function ui_mcm.UIMCM:Register_Slide(xml, handler, v)
local frame = xml:InitStatic("elements:slide", handler)
local _pos = frame:GetWndPos()
frame:SetWndPos(vector2():set( _pos.x , _pos.y + (v.spacing or 20) ))
local pic = xml:InitStatic("elements:slide:pic", frame)
if v.link then
pic:InitTexture(v.link)
pic:SetStretchTexture(true)
if (v.pos) then
local pos = pic:GetWndPos()
pic:SetWndPos(vector2():set( pos.x + v.pos[1] , pos.y + v.pos[2] ))
end
if (v.size) then
pic:SetWndSize(vector2():set( v.size[1] * (utils_xml.is_widescreen() and 0.8 or 1) , v.size[2] ))
end
pic:InitTexture(v.link)
end
local txt = xml:InitTextWnd("elements:slide:txt", frame)
if v.text then
txt:SetText( game.translate_string(v.text) )
end
if not v.borderless then
xml:InitStatic("elements:slide:line_1", frame)
xml:InitStatic("elements:slide:line_2", frame)
end
if v.ui_hook_functor then
local wrapbox = init_wrapper_box(xml,handler,pic:GetWidth(),pic:GetHeight() + 20,-10)
local handlers = {
pic = pic, -- handler for the image element
txt = txt, -- handler for the text element
}
local flags = {
etype = "slide",
}
ui_mcm.exec(unpack(v.ui_hook_functor),wrapbox,handlers,v,flags)
end
return (pic:GetHeight() + 20)
end
function ui_mcm.UIMCM:Register_Desc(xml, handler, v)
local desc = xml:InitTextWnd("elements:desc", handler)
desc:SetText( game.translate_string(v.text) )
desc:AdjustHeightToText()
desc:SetWndSize(vector2():set(desc:GetWidth(), desc:GetHeight() + 20))
if v.clr and v.clr[4] then
desc:SetTextColor( GetARGB(v.clr[1], v.clr[2], v.clr[3], v.clr[4]) )
end
if v.ui_hook_functor then
local wrapbox = init_wrapper_box(xml,handler,desc:GetWidth(),desc:GetHeight(),-10)
local handlers = {
desc = desc, -- Handler for the text description element
}
local flags = {
etype = "desc",
}
ui_mcm.exec(unpack(v.ui_hook_functor),wrapbox,handlers,v,flags)
end
return desc:GetHeight()
end
function ui_mcm.UIMCM:Register_List(xml, handler, path, opt, v, flags)
local id = ui_mcm.cc(path , opt)
-- Caption
local h = self:Register_Cap(xml, handler, id, v.hint)
-- Apply to all button
if flags.apply_to_all and flags.group then
self:Register_BtnAll(xml, handler, path, opt, v, flags)
end
-- Create control
local ctrl = xml:InitComboBox("elements:list",handler)
if (ctrl:GetHeight() > h) then
--h = ctrl:GetHeight()
end
-- Get values
local idx
local value = self:GetValue(path, opt, v, flags)
local content = self:GetContent(path, opt, v)
-- Setup
for i=1,#content do
local str_2 = content[i][2] or tostring(content[i][1])
local str = v.no_str and str_2 or game.translate_string("ui_mcm_lst_" .. str_2)
ctrl:AddItem( game.translate_string(str), i)
if content[i][1] == value then
idx = i
end
end
idx = idx or 1
local str_2 = content[idx][2] or tostring(content[idx][1])
local str = v.no_str and str_2 or game.translate_string("ui_mcm_lst_" .. str_2)
ctrl:enable_id( idx )
ctrl:SetText( game.translate_string(str) )
-- Register
local id_ctrl = self:Stacker(path, opt, v)
self:Register(ctrl, id_ctrl)
local _wrapper = function(handler) -- we need wrapper in order to pass ctrl to method
self:Callback_List(ctrl, path, opt, v)
end
self:AddCallback(id_ctrl, ui_events.LIST_ITEM_SELECT, _wrapper, self)
if v.ui_hook_functor then
local id_cap = string.gsub(id, "/", "_")
local cap = self._Cap[id_cap]
local wrapbox = init_wrapper_box(xml,handler,handler:GetWidth(),ctrl:GetHeight(),-10)
local handlers = {
ctrl = ctrl, -- handler for the list control element
cap = cap, -- handler for text caption element
}
flags.etype = "list"
flags.path = path -- MCM menu path
flags.opt = opt -- MCM option ID
ui_mcm.exec(unpack(v.ui_hook_functor),wrapbox,handlers,v,flags)
end
return h
end
printf("ui_mcm.script monkeypatched by zzzzz_monkey_paw_ui_mcm.script")
elseif ui_mcm then
printf("zzzzz_monkey_paw_ui_mcm.script: installed MCM already supports UI functors, aborting monkeypatch")
else
printf("zzzzz_monkey_paw_ui_mcm.script: MCM not found, aborting monkeypatch")
end