mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] more TG prefs (#11241)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
committed by
GitHub
parent
dd34a22879
commit
f51b2c3f7d
@@ -113,9 +113,7 @@
|
||||
|
||||
///Adds the shadekin abilities to the owner.
|
||||
/datum/component/shadekin/proc/add_shadekin_abilities()
|
||||
if(!owner.ability_master || !istype(owner.ability_master, /obj/screen/movable/ability_master/shadekin))
|
||||
owner.ability_master = null
|
||||
owner.ability_master = new /obj/screen/movable/ability_master/shadekin(owner)
|
||||
create_shadekin_abilities()
|
||||
for(var/datum/power/shadekin/P in shadekin_ability_datums)
|
||||
if(!(P.verbpath in owner.verbs))
|
||||
add_verb(owner, P.verbpath)
|
||||
@@ -127,6 +125,52 @@
|
||||
arguments = list()
|
||||
)
|
||||
|
||||
|
||||
///Builds and adds abilities to our owner. Should be used if you're adding new abilities
|
||||
/datum/component/shadekin/proc/build_and_add_abilities()
|
||||
clear_shadekin_abilities()
|
||||
build_ability_datums()
|
||||
add_shadekin_abilities()
|
||||
|
||||
|
||||
///Clears the ability datums and rebuilds it.
|
||||
/datum/component/shadekin/proc/build_ability_datums()
|
||||
//generates powers and then adds them
|
||||
for(var/datum/power in shadekin_ability_datums)
|
||||
qdel(power)
|
||||
shadekin_ability_datums = list()
|
||||
for(var/power in shadekin_abilities)
|
||||
var/datum/power/shadekin/SKP = new power(src)
|
||||
shadekin_ability_datums.Add(SKP)
|
||||
|
||||
///Gets rid of any old ability master if we have one and replaces it with a shadekin ability master.
|
||||
/datum/component/shadekin/proc/create_shadekin_abilities()
|
||||
if(!owner.ability_master)
|
||||
owner.ability_master = new /obj/screen/movable/ability_master/shadekin(owner)
|
||||
else if(!istype(owner.ability_master, /obj/screen/movable/ability_master/shadekin))
|
||||
qdel_null(owner.ability_master)
|
||||
owner.ability_master = new /obj/screen/movable/ability_master/shadekin(owner)
|
||||
|
||||
//Clears up our verbs. Used when rebuilding our verbs list..
|
||||
/datum/component/shadekin/proc/clear_shadekin_abilities()
|
||||
for(var/datum/power/shadekin/P in shadekin_ability_datums)
|
||||
if((P.verbpath in owner.verbs))
|
||||
remove_verb(owner, P.verbpath)
|
||||
owner.ability_master.remove_shadekin_ability(
|
||||
object_given = owner,
|
||||
verb_given = P.verbpath,
|
||||
arguments = list()
|
||||
)
|
||||
|
||||
//Clears our abilities master and gives us a new, non-shadekin one. Used for destroy.
|
||||
/datum/component/shadekin/proc/replace_shadekin_master()
|
||||
if(!owner.ability_master)
|
||||
owner.ability_master = new /obj/screen/movable/ability_master(owner)
|
||||
else if(istype(owner.ability_master, /obj/screen/movable/ability_master/shadekin))
|
||||
qdel_null(owner.ability_master)
|
||||
owner.ability_master = new /obj/screen/movable/ability_master(owner)
|
||||
clear_shadekin_abilities()
|
||||
|
||||
//wait, it's all light?
|
||||
///Allows setting the light and darkness gain.
|
||||
///@Args: light_gain, dark_gain
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
var/in_dark_respite = FALSE
|
||||
var/manual_respite = FALSE
|
||||
var/respite_activating = FALSE
|
||||
///If we return to The Dark upon death or not.
|
||||
var/no_retreat = FALSE
|
||||
|
||||
//Dark Tunneling Vars (Unused on Virgo)
|
||||
///If we have already made a dark tunnel
|
||||
@@ -93,17 +95,13 @@
|
||||
if(!isliving(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
owner = parent
|
||||
add_shadekin_abilities(owner)
|
||||
if(ishuman(owner))
|
||||
RegisterSignal(owner, COMSIG_SHADEKIN_COMPONENT, PROC_REF(handle_comp)) //Happens every species tick.
|
||||
else
|
||||
RegisterSignal(owner, COMSIG_LIVING_LIFE, PROC_REF(handle_comp)) //Happens every life tick (mobs)
|
||||
|
||||
//generates powers and then adds them
|
||||
for(var/power in shadekin_abilities)
|
||||
var/datum/power/shadekin/SKP = new power(src)
|
||||
shadekin_ability_datums.Add(SKP)
|
||||
add_shadekin_abilities()
|
||||
build_and_add_abilities()
|
||||
|
||||
handle_comp() //First hit is free!
|
||||
|
||||
@@ -112,23 +110,21 @@
|
||||
set_eye_energy() //Sets the energy values based on our eye color.
|
||||
|
||||
//Misc stuff we need to do
|
||||
if(extended_kin)
|
||||
add_verb(owner, /mob/living/proc/nutrition_conversion_toggle)
|
||||
add_verb(owner, /mob/living/proc/flicker_adjustment)
|
||||
add_verb(owner, /mob/living/proc/shadekin_control_panel)
|
||||
|
||||
/datum/component/shadekin/Destroy(force)
|
||||
if(ishuman(owner))
|
||||
UnregisterSignal(owner, COMSIG_SHADEKIN_COMPONENT)
|
||||
else
|
||||
UnregisterSignal(owner, COMSIG_LIVING_LIFE)
|
||||
if(extended_kin)
|
||||
remove_verb(owner, /mob/living/proc/nutrition_conversion_toggle)
|
||||
remove_verb(owner, /mob/living/proc/flicker_adjustment)
|
||||
remove_verb(owner, /mob/living/proc/shadekin_control_panel)
|
||||
for(var/datum/power in shadekin_ability_datums)
|
||||
qdel(power)
|
||||
for(var/obj/effect/abstract/dark_maw/dm as anything in active_dark_maws) //if the component gets destroyed so does your precious maws
|
||||
if(!QDELETED(dm))
|
||||
qdel(dm)
|
||||
owner.shadekin_display.invisibility = INVISIBILITY_ABSTRACT //hide it
|
||||
replace_shadekin_master()
|
||||
active_dark_maws.Cut()
|
||||
shadekin_abilities.Cut()
|
||||
shadekin_ability_datums.Cut()
|
||||
@@ -209,6 +205,9 @@
|
||||
"flicker_color" = flicker_color,
|
||||
"flicker_break_chance" = flicker_break_chance,
|
||||
"flicker_distance" = flicker_distance,
|
||||
"no_retreat" = no_retreat,
|
||||
"nutrition_energy_conversion" = nutrition_energy_conversion,
|
||||
"extended_kin" = extended_kin,
|
||||
)
|
||||
|
||||
return data
|
||||
@@ -250,27 +249,18 @@
|
||||
flicker_distance = new_distance
|
||||
ui.user.write_preference_directly(/datum/preference/numeric/living/flicker_distance, new_distance)
|
||||
return TRUE
|
||||
if("toggle_retreat")
|
||||
var/new_retreat = !no_retreat
|
||||
no_retreat = !no_retreat
|
||||
ui.user.write_preference_directly(/datum/preference/toggle/living/dark_retreat_toggle, new_retreat)
|
||||
if("toggle_nutrition")
|
||||
var/new_retreat = !nutrition_energy_conversion
|
||||
nutrition_energy_conversion = !nutrition_energy_conversion
|
||||
ui.user.write_preference_directly(/datum/preference/toggle/living/shadekin_nutrition_conversion, new_retreat)
|
||||
|
||||
/mob/living/proc/nutrition_conversion_toggle()
|
||||
set name = "Toggle Energy <-> Nutrition conversions"
|
||||
set desc = "Toggle dark energy and nutrition being converted into each other when full"
|
||||
set category = "Abilities.Shadekin"
|
||||
|
||||
var/datum/component/shadekin/SK = get_shadekin_component()
|
||||
if(!SK)
|
||||
to_chat(src, span_warning("Only a shadekin can use that!"))
|
||||
return FALSE
|
||||
|
||||
if(SK.nutrition_energy_conversion)
|
||||
to_chat(src, span_notice("Nutrition and dark energy conversions disabled."))
|
||||
SK.nutrition_energy_conversion = 0
|
||||
else
|
||||
to_chat(src, span_notice("Nutrition and dark energy conversions enabled."))
|
||||
SK.nutrition_energy_conversion = 1
|
||||
|
||||
/mob/living/proc/flicker_adjustment()
|
||||
set name = "Adjust Light Flicker"
|
||||
set desc = "Allows you to adjust the settings of the light flicker when you phase in!"
|
||||
/mob/living/proc/shadekin_control_panel()
|
||||
set name = "Shadekin Control Panel"
|
||||
set desc = "Allows you to adjust the settings of various shadekin settings!"
|
||||
set category = "Abilities.Shadekin"
|
||||
|
||||
var/datum/component/shadekin/SK = get_shadekin_component()
|
||||
|
||||
Reference in New Issue
Block a user