mirror of
https://github.com/TemujinCalidius/SurvivorCore.git
synced 2026-08-14 00:58:01 +00:00
+9
-1
@@ -5,7 +5,15 @@ All notable changes to SurvivorCore are recorded here. The format follows
|
||||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). At release time, `## Unreleased`
|
||||
is promoted to the new version and `main` is tagged `vX.Y.Z`.
|
||||
|
||||
## Unreleased
|
||||
## 0.2.1 — 2026-06-22
|
||||
|
||||
### Fixed
|
||||
- **Custom stat `attribute` overrides now work end to end** (#20) — the HUD bound stat bars by the
|
||||
stat *name*, but the engine stores each value under the stat's backing `attribute` (overridable
|
||||
via `Config.override("SurvivalStats", { Stat = { attribute = "…" } })`), so an override silently
|
||||
froze the bar. The binder now reads + listens on the resolved `attribute`; the same hardcoded-name
|
||||
slip in the Health↔Humanoid sync and the energy (vignette/breathing) feedback is fixed too.
|
||||
Default behaviour (attribute defaults to the name) is unchanged.
|
||||
|
||||
## 0.2.0 — 2026-06-20
|
||||
|
||||
|
||||
+7
-2
@@ -156,6 +156,11 @@ function Hud.start(_options: { [string]: any }?)
|
||||
warn(`[SurvivorCore HUD] bar '{bar:GetFullName()}' is missing a 'Stat' attribute`)
|
||||
return
|
||||
end
|
||||
-- The bar's `Stat` attribute names the stat; the value lives on the player under the stat's
|
||||
-- backing attribute (`def.attribute`, which defaults to the name). Read + listen on THAT,
|
||||
-- so a custom `attribute` override (set in config before start, never changes at runtime)
|
||||
-- stays in sync with the HUD instead of silently reading a name nobody writes to.
|
||||
local attrName = (byName[statName] and byName[statName].attribute) or statName
|
||||
local fill = bar:FindFirstChild("Fill")
|
||||
if not fill or not fill:IsA("GuiObject") then
|
||||
warn(`[SurvivorCore HUD] bar '{bar:GetFullName()}' is missing a 'Fill' GuiObject child`)
|
||||
@@ -191,7 +196,7 @@ function Hud.start(_options: { [string]: any }?)
|
||||
local normalColor = bar:GetAttribute("FillColor") or authoredColor
|
||||
local warnColor = bar:GetAttribute("WarnColor") or DEFAULT_WARN_COLOR
|
||||
|
||||
local value = localPlayer:GetAttribute(statName)
|
||||
local value = localPlayer:GetAttribute(attrName)
|
||||
local ratio = 0
|
||||
if typeof(value) == "number" and max > 0 then
|
||||
ratio = math.clamp(value / max, 0, 1)
|
||||
@@ -234,7 +239,7 @@ function Hud.start(_options: { [string]: any }?)
|
||||
end
|
||||
end
|
||||
|
||||
local connection = localPlayer:GetAttributeChangedSignal(statName):Connect(render)
|
||||
local connection = localPlayer:GetAttributeChangedSignal(attrName):Connect(render)
|
||||
-- also re-render when the bar's own Icon is set at runtime (lets the game assign art live)
|
||||
local iconConn = bar:GetAttributeChangedSignal("Icon"):Connect(render)
|
||||
renderers[bar] = render
|
||||
|
||||
@@ -22,6 +22,7 @@ assert(RunService:IsClient(), "SurvivorCore.MovementFeedback is client-only —
|
||||
|
||||
local MovementConfig = require(script.Parent.Parent.shared.MovementConfig)
|
||||
local Remotes = require(script.Parent.Parent.shared.Remotes)
|
||||
local StatConfig = require(script.Parent.Parent.stats.StatConfig)
|
||||
|
||||
local MovementFeedback = {}
|
||||
|
||||
@@ -55,6 +56,10 @@ function MovementFeedback.start(_options: { [string]: any }?)
|
||||
local player = Players.LocalPlayer
|
||||
local cfg = MovementConfig.get()
|
||||
|
||||
-- Read Energy from its backing attribute (defaults to "Energy"), respecting a custom override.
|
||||
local energyDef = StatConfig.resolve().byName.Energy
|
||||
local energyAttr = (energyDef and energyDef.attribute) or "Energy"
|
||||
|
||||
-- --- Sprint input → server -------------------------------------------------
|
||||
local sprintRemote = Remotes.event("SprintIntent")
|
||||
local sprintHeld = false
|
||||
@@ -109,7 +114,7 @@ function MovementFeedback.start(_options: { [string]: any }?)
|
||||
local heartbeat = makeLoopedSound("SurvivorCoreHeartbeat", cfg.Assets.Heartbeat)
|
||||
|
||||
RunService.RenderStepped:Connect(function(dt)
|
||||
local energy = player:GetAttribute("Energy")
|
||||
local energy = player:GetAttribute(energyAttr)
|
||||
if typeof(energy) ~= "number" then
|
||||
energy = 0
|
||||
end
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ require(script.shared.ConsequenceConfig)
|
||||
|
||||
local SurvivorCore = {}
|
||||
|
||||
SurvivorCore.VERSION = "0.2.0"
|
||||
SurvivorCore.VERSION = "0.2.1"
|
||||
|
||||
-- Foundation
|
||||
SurvivorCore.Config = Config
|
||||
|
||||
@@ -57,7 +57,11 @@ local function isAtMax(player: Player, name: string): boolean
|
||||
end
|
||||
|
||||
local function syncHealth(player: Player, humanoid: Humanoid)
|
||||
player:SetAttribute("Health", math.max(0, math.round(humanoid.Health)))
|
||||
-- Write to the Health stat's backing attribute (defaults to "Health"), so a custom
|
||||
-- `attribute` override still lands where the HUD reads it.
|
||||
local def = SurvivalStats.getDefinition("Health")
|
||||
local attr = (def and def.attribute) or "Health"
|
||||
player:SetAttribute(attr, math.max(0, math.round(humanoid.Health)))
|
||||
end
|
||||
|
||||
local function setupCharacter(player: Player, character: Model)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "temujincalidius/survivorcore"
|
||||
description = "Batteries-included, creator-extensible survival game framework for Roblox."
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
license = "MIT"
|
||||
authors = ["Samuel Lison"]
|
||||
registry = "https://github.com/UpliftGames/wally-index"
|
||||
|
||||
Reference in New Issue
Block a user