diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 7fc41c16e58..195755aa823 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1553,6 +1553,15 @@ spell_list += S S.action.Grant(current) +//To remove a specific spell from a mind +/datum/mind/proc/remove_spell(var/obj/effect/proc_holder/spell/spell) + if(!spell) return + for(var/X in spell_list) + var/obj/effect/proc_holder/spell/S = X + if(istype(S, spell)) + qdel(S) + spell_list -= S + /datum/mind/proc/transfer_actions(mob/living/new_character) if(current && current.actions) for(var/datum/action/A in current.actions) diff --git a/code/game/gamemodes/miniantags/revenant/revenant.dm b/code/game/gamemodes/miniantags/revenant/revenant.dm index c6bc4d033ae..e33dff2cf5a 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant.dm @@ -169,8 +169,10 @@ "As \the [W] passes through you, you feel your essence draining away!") adjustBruteLoss(25) //hella effective inhibited = 1 + update_action_buttons_icon() spawn(30) inhibited = 0 + update_action_buttons_icon() ..() /mob/living/simple_animal/revenant/adjustHealth(amount) diff --git a/code/game/gamemodes/wizard/wizard.dm b/code/game/gamemodes/wizard/wizard.dm index 1dac752b967..1db21f044c3 100644 --- a/code/game/gamemodes/wizard/wizard.dm +++ b/code/game/gamemodes/wizard/wizard.dm @@ -241,17 +241,11 @@ /mob/proc/spellremove(mob/M) if(!mind) return - for(var/obj/effect/proc_holder/spell/spell_to_remove in src.mind.spell_list) + for(var/X in src.mind.spell_list) + var/obj/effect/proc_holder/spell/spell_to_remove = X qdel(spell_to_remove) mind.spell_list -= spell_to_remove -/datum/mind/proc/remove_spell(var/obj/effect/proc_holder/spell/spell) //To remove a specific spell from a mind - use AddSpell to add one - if(!spell) return - for(var/obj/effect/proc_holder/spell/S in spell_list) - if(istype(S, spell)) - qdel(S) - spell_list -= S - /*Checks if the wizard can cast spells. Made a proc so this is not repeated 14 (or more) times.*/ /mob/proc/casting() diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 3cba2799aef..6881748241f 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -630,7 +630,7 @@ if(AI.mind.special_role) //Malf AIs cannot leave mechs. Except through death. user << "ACCESS DENIED." return - AI.aiRestorePowerRoutine = 0//So the AI initially has power. + AI.ai_restore_power()//So the AI initially has power. AI.control_disabled = 1 AI.radio_enabled = 0 AI.loc = card @@ -669,7 +669,7 @@ //Hack and From Card interactions share some code, so leave that here for both to use. /obj/mecha/proc/ai_enter_mech(mob/living/silicon/ai/AI, interaction) - AI.aiRestorePowerRoutine = 0 + AI.ai_restore_power() AI.loc = src occupant = AI icon_state = initial(icon_state) diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index bc4c31f0aa3..8d3f55c8dce 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -32,6 +32,9 @@ user << "You [magpulse ? "enable" : "disable"] the mag-pulse traction system." user.update_inv_shoes() //so our mob-overlays update user.update_gravity(user.mob_has_gravity()) + for(var/X in actions) + var/datum/action/A = X + A.UpdateButtonIcon() /obj/item/clothing/shoes/magboots/negates_gravity() return flags & NOSLIP diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index d05fdd4ae9c..91b5b987139 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -804,7 +804,7 @@ var/list/ai_list = list() user << "No intelligence patterns detected." //No more magical carding of empty cores, AI RETURN TO BODY!!!11 return new /obj/structure/AIcore/deactivated(loc)//Spawns a deactivated terminal at AI location. - aiRestorePowerRoutine = 0//So the AI initially has power. + ai_restore_power()//So the AI initially has power. control_disabled = 1//Can't control things remotely if you're stuck in a card! radio_enabled = 0 //No talking on the built-in radio for you either! loc = card//Throw AI into the card. diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index c977343e8ef..3ebd2fd6dd0 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -1,3 +1,8 @@ +#define POWER_RESTORATION_OFF 0 +#define POWER_RESTORATION_START 1 +#define POWER_RESTORATION_SEARCH_APC 2 +#define POWER_RESTORATION_APC_FOUND 3 + /mob/living/silicon/ai/Life() if (src.stat == DEAD) return @@ -29,26 +34,12 @@ if(home.powered(EQUIP)) home.use_power(1000, EQUIP) - if(aiRestorePowerRoutine==2) - src << "Alert cancelled. Power has been restored without our assistance." - aiRestorePowerRoutine = 0 - set_blindness(0) - update_sight() - return - else if (aiRestorePowerRoutine==3) - src << "Alert cancelled. Power has been restored." - aiRestorePowerRoutine = 0 - set_blindness(0) - update_sight() + if(aiRestorePowerRoutine >= POWER_RESTORATION_SEARCH_APC) + ai_restore_power() return else if(!aiRestorePowerRoutine) - aiRestorePowerRoutine = 1 - blind_eyes(1) - update_sight() - src << "You've lost power!" - spawn(20) - start_RestorePowerRoutine() + ai_lose_power() /mob/living/silicon/ai/proc/lacks_power() var/turf/T = get_turf(src) @@ -97,10 +88,7 @@ var/area/AIarea = get_area(src) if(AIarea && AIarea.master.power_equip) if(!istype(T, /turf/space)) - src << "Alert cancelled. Power has been restored without our assistance." - aiRestorePowerRoutine = 0 - set_blindness(0) - update_sight() + ai_restore_power() return src << "Fault confirmed: missing external power. Shutting down main control system to save power." sleep(20) @@ -109,7 +97,7 @@ T = get_turf(src) if (istype(T, /turf/space)) src << "Unable to verify! No power connection detected!" - aiRestorePowerRoutine = 2 + aiRestorePowerRoutine = POWER_RESTORATION_SEARCH_APC return src << "Connection verified. Searching for APC in power network." sleep(50) @@ -131,14 +119,11 @@ src << "Unable to locate APC!" else src << "Lost connection with the APC!" - aiRestorePowerRoutine = 2 + aiRestorePowerRoutine = POWER_RESTORATION_SEARCH_APC return if(AIarea.master.power_equip) if (!istype(T, /turf/space)) - src << "Alert cancelled. Power has been restored without our assistance." - aiRestorePowerRoutine = 0 - set_blindness(0) - update_sight() + ai_restore_power() return switch(PRP) if (1) src << "APC located. Optimizing route to APC to avoid needless power waste." @@ -152,8 +137,31 @@ apc_override = 1 theAPC.ui_interact(src, state = conscious_state) apc_override = 0 - aiRestorePowerRoutine = 3 + aiRestorePowerRoutine = POWER_RESTORATION_APC_FOUND src << "Here are your current laws:" show_laws() sleep(50) theAPC = null + +/mob/living/silicon/ai/proc/ai_restore_power() + if(aiRestorePowerRoutine) + if(aiRestorePowerRoutine == POWER_RESTORATION_APC_FOUND) + src << "Alert cancelled. Power has been restored." + else + src << "Alert cancelled. Power has been restored without our assistance." + aiRestorePowerRoutine = POWER_RESTORATION_OFF + set_blindness(0) + update_sight() + +/mob/living/silicon/ai/proc/ai_lose_power() + aiRestorePowerRoutine = POWER_RESTORATION_START + blind_eyes(1) + update_sight() + src << "You've lost power!" + spawn(20) + start_RestorePowerRoutine() + +#undef POWER_RESTORATION_OFF +#undef POWER_RESTORATION_START +#undef POWER_RESTORATION_SEARCH_APC +#undef POWER_RESTORATION_APC_FOUND \ No newline at end of file diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index a175d02523b..bac5319ef2a 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -251,8 +251,6 @@ if(client) stopLobbySound() var/mob/living/silicon/ai/O = new (loc,,,1)//No MMI but safety is in effect. - O.invisibility = 0 - O.aiRestorePowerRoutine = 0 if(mind) mind.transfer_to(O) diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index fb71988da4e..ecbcb21e743 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -73,6 +73,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin var/turf/T = get_turf(user) if(T.z == ZLEVEL_CENTCOM && (!centcom_cancast || ticker.mode.name == "ragin' mages")) //Certain spells are not allowed on the centcom zlevel + user << "You can't cast this spell here." return 0 if(!skipcharge) @@ -160,6 +161,10 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin still_recharging_msg = "[name] is still recharging." charge_counter = charge_max +/obj/effect/proc_holder/spell/Destroy() + qdel(action) + return ..() + /obj/effect/proc_holder/spell/Click() if(cast_check()) choose_targets() @@ -384,11 +389,6 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list)) return 0 - if(user.z == ZLEVEL_CENTCOM && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel - return 0 - if(user.z == ZLEVEL_CENTCOM && ticker.mode.name == "ragin' mages") - return 0 - switch(charge_type) if("recharge") if(charge_counter < charge_max) @@ -400,21 +400,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin if(user.stat && !stat_allowed) return 0 - if(ishuman(user)) - - var/mob/living/carbon/human/H = user - - if((invocation_type == "whisper" || invocation_type == "shout") && H.is_muzzled()) - return 0 - - if(clothes_req) //clothes check - if(!istype(H.wear_suit, /obj/item/clothing/suit/wizrobe) && !istype(H.wear_suit, /obj/item/clothing/suit/space/hardsuit/wizard)) - return 0 - if(!istype(H.shoes, /obj/item/clothing/shoes/sandal)) - return 0 - if(!istype(H.head, /obj/item/clothing/head/wizard) && !istype(H.head, /obj/item/clothing/head/helmet/space/hardsuit/wizard)) - return 0 - else + if(!ishuman(user)) if(clothes_req || human_req) return 0 if(nonabstract_req && (isbrain(user) || ispAI(user))) diff --git a/code/modules/spells/spell_types/area_teleport.dm b/code/modules/spells/spell_types/area_teleport.dm index 798a801dcee..7f766aa49e0 100644 --- a/code/modules/spells/spell_types/area_teleport.dm +++ b/code/modules/spells/spell_types/area_teleport.dm @@ -24,10 +24,11 @@ var/A = null if(!randomise_selection) - A = input("Area to teleport to", "Teleport", A) in teleportlocs + A = input("Area to teleport to", "Teleport", A) as null|anything in teleportlocs else A = pick(teleportlocs) - + if(!A) + return var/area/thearea = teleportlocs[A] return thearea