Skills & States 🔗
A library to create and manage skills and states. A skill can be an action like a super-high jump, a damaging aura or a passive one like a stat boost. A state is the same thing but temporary and with no need to unlock it before applying it.
Doesn't provide any base skill.
Contains partially AI-generated tests, docs, and code (manually reviewed and humanly engineered)
Here some examples of how to register a skill:
skills.register_skill("example_mod:counter", {
name = "Counter",
description = "Counts. You can use it every 2s.",
sounds = {
cast = {name = "ding", pitch = 2}
},
cooldown = 2,
data = {
counter = 0
},
cast = function(self)
self.data.counter = self.data.counter + 1
print(self.pl_name .. " is counting: " .. self.data.counter)
end
})
skills.register_skill("example_mod:heal_over_time", {
name = "Heal Over Time",
description = "Restores a heart every 3 seconds for 30 seconds.",
loop_params = {
cast_rate = 3,
duration = 30
},
sounds = {
cast = {name = "heart_added"},
bgm = {name = "angelic_music"}
},
cast = function(self)
local player = self.player
player:set_hp(player:get_hp() + 2)
end
})
skills.register_skill("example_mod:boost_physics", {
name = "Boost Physics",
description = "Multiplies the speed and the gravity x1.5 for 3 seconds.",
loop_params = {
duration = 3
},
sounds = {
start = {name = "speed_up"},
stop = {name = "speed_down"}
},
physics = {
operation = "multiply",
speed = 1.5,
gravity = 1.5
}
})
skills.register_skill("example_mod:set_speed", {
name = "Set Speed",
description = "Sets speed to 3.",
passive = true,
data = {
original_speed = {}
},
on_start = function(self)
local player = self.player
self.data.original_speed = player:get_physics_override().speed
player:set_physics_override({speed = 3})
end,
on_stop = function(self)
self.player:set_physics_override({speed = self.data.original_speed})
end
})
Long overdue
I recall how much I wanted a skills library when I was working on a mod of mine last year. I also wondered back then how it was possible that no one had ever thought about creating something useful like a mod that allowed you to easily introduce skills in your game. Because it's something that basically every genre might need. RPG, FPS, MOBA, you name it. I also recall how I ended up throwing in the towel because I couldn't focus on yet another mod to maintain. So I renounced.
...until now! Thanks for what you're doing :)
Underrated
I was searching for simple skills and found an api but i was curious and opened the docs and code. Wow 😮 This seems very well designed, idk why no other mods seem to use it on cdb but it seems very flexible and customizable. Other "skills" framework are kinda ridicoulous in comparison, even though they usually are not as generalistic. But it also allows states in a very simple way re-using the same mechanism so double wow. Good job, maybe I'll use it for some mods with my friends! The only downside is that it doesn't provide any default things but it's a sensible choice if this only aims to be a core library
Good job!
Well.... This mod is very similar to those moba games you know and it's very beautiful to tell the truth bro.