mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 03:55:11 +01:00
76b933fd4b
## About The Pull Request The recipes are locked behind a particular skillchip anyway. We might as well just use the framework for learnable recipes instead of relying on a particular trait with no other use to it. This also prevents these recipes from showing in the menu even if the requirements aren't met. ## Why It's Good For The Game See above. ## Changelog 🆑 refactor: Underwater basketweaving refactored so it doesn't show in the crafting menu unless you've the skillchip active. /🆑
44 lines
1.7 KiB
Plaintext
44 lines
1.7 KiB
Plaintext
|
|
/obj/item/skillchip/basketweaving
|
|
name = "Basketsoft 3000 skillchip"
|
|
desc = "Underwater edition."
|
|
skill_name = "Underwater Basketweaving"
|
|
skill_description = "Master intricate art of using twine to create perfect baskets while submerged."
|
|
skill_icon = "shopping-basket"
|
|
activate_message = span_notice("You're one with the twine and the sea.")
|
|
deactivate_message = span_notice("Higher mysteries of underwater basketweaving leave your mind.")
|
|
|
|
/obj/item/skillchip/basketweaving/has_mob_incompatibility(mob/living/carbon/target)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
if(!target.mind)
|
|
return "Target incapable of learning recipe."
|
|
|
|
/obj/item/skillchip/basketweaving/on_activate(mob/living/carbon/user, silent=FALSE)
|
|
. = ..()
|
|
if(!user.mind)
|
|
return
|
|
learn_recipes(user)
|
|
//Prevent the skill from being transferred via mindswap. What an edge case
|
|
RegisterSignal(user.mind, COMSIG_MIND_TRANSFERRED, PROC_REF(forget_recipes))
|
|
RegisterSignal(user, COMSIG_MOB_MIND_TRANSFERRED_INTO, PROC_REF(learn_recipes))
|
|
|
|
/obj/item/skillchip/basketweaving/proc/learn_recipes(mob/source)
|
|
SIGNAL_HANDLER
|
|
for(var/recipe_type in typesof(/datum/crafting_recipe/underwater_basket))
|
|
source.mind.teach_crafting_recipe(recipe_type)
|
|
|
|
/obj/item/skillchip/basketweaving/proc/forget_recipes(datum/mind/source, mob/previous_body)
|
|
SIGNAL_HANDLER
|
|
for(var/recipe_type in typesof(/datum/crafting_recipe/underwater_basket))
|
|
source.forget_crafting_recipe(recipe_type)
|
|
|
|
/obj/item/skillchip/basketweaving/on_deactivate(mob/living/carbon/user, silent=FALSE)
|
|
if(user.mind)
|
|
forget_recipes(user.mind)
|
|
UnregisterSignal(user.mind, COMSIG_MIND_TRANSFERRED)
|
|
UnregisterSignal(user, COMSIG_MOB_MIND_TRANSFERRED_INTO)
|
|
return ..()
|