Fixes spell action button not being updated correctly regarding zlevel and clothes requirements. The buttons are now always not red in these cases but clicking them give the proper fail message.

Fixes blind AI (lack of power) staying blind if transfered to a mech or a card.
Fixes magboots action button icon not updating when toggling the boots on.
Fixes Area teleport spells not having a cancel button when choosing the destination area.
Fixes spell action button not being removed when the spell is refunded.
Fixes revenant spell action button icons not being updated when the revenant is inhibited by a null rod.
This commit is contained in:
phil235
2016-02-29 16:30:54 +01:00
parent e7d0451a93
commit 3c8a9274bf
10 changed files with 64 additions and 63 deletions
+9
View File
@@ -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)
@@ -169,8 +169,10 @@
"<span class='revendanger'>As \the [W] passes through you, you feel your essence draining away!</span>")
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)
+2 -8
View File
@@ -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()
+2 -2
View File
@@ -630,7 +630,7 @@
if(AI.mind.special_role) //Malf AIs cannot leave mechs. Except through death.
user << "<span class='boldannounce'>ACCESS DENIED.</span>"
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)
+3
View File
@@ -32,6 +32,9 @@
user << "<span class='notice'>You [magpulse ? "enable" : "disable"] the mag-pulse traction system.</span>"
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
+1 -1
View File
@@ -804,7 +804,7 @@ var/list/ai_list = list()
user << "<span class='warning'>No intelligence patterns detected.</span>" //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.
+36 -28
View File
@@ -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
-2
View File
@@ -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)
+6 -20
View File
@@ -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 << "<span class='notice'>You can't cast this spell here.</span>"
return 0
if(!skipcharge)
@@ -160,6 +161,10 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
still_recharging_msg = "<span class='notice'>[name] is still recharging.</span>"
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)))
@@ -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