I’m making a state system for my game with addable and removeable states. I want to know which states are available using type
.
type States = "Dead" | "IFrames" | "Stunned" | "Attacking" | "Parrying" | "Blocking" | "Any"
You can see there’s already 7 basic ones. I want to externally add another string onto this line so when I call on my function:
function module:SetState(State : States, Value : true | false | "Any", Time, bypass: boolean)
if self.CurrentState.Name == "Dead" and not bypass then return end;
if self.PriorityTable[self.CurrentState.Name] > self.PriorityTable[State] then
self.CurrentState.Name = State
self.CurrentState.Value = Value
self.States[State] = true
self.Signal:Fire("States", "CurrentState", State, Value, Time)
end
if Time == nil or Time == 0 then return end;
self.Timers[State.." Timer"] = TimerModule.new(State .. " Timer", Time, function()
warn("State has finished, attempting to return the current state to Idle.")
self:UpdateState("Idle", true, 0)
self.States[State] = false
end)
self.Timers[State.." Timer"]:startTimer(Time)
end
It’ll do the little thing where it tells you what’s available.
just wanna know if that’s impossible and im overthinking it lol