Macro refactoring.

Turns several of the is* procs into istype defines.
This commit is contained in:
PsiOmegaDelta
2015-09-16 12:57:14 +02:00
parent 75b424924e
commit 7ce27f76fd
14 changed files with 59 additions and 147 deletions
+1 -1
View File
@@ -1334,7 +1334,7 @@
src.owner << "You sent [input] to [L] via a secure channel."
log_admin("[src.owner] replied to [key_name(L)]'s Centcomm message with the message [input].")
message_admins("[src.owner] replied to [key_name(L)]'s Centcom message with: \"[input]\"")
if(!L.isMobAI())
if(!isAI(L))
L << "<span class='info'>You hear something crackle in your headset for a moment before a voice speaks.</span>"
L << "<span class='info'>Please stand by for a message from Central Command.</span>"
L << "<span class='info'>Message as follows.</span>"
+2 -122
View File
@@ -1,14 +1,4 @@
// fun if you want to typecast humans/monkeys/etc without writing long path-filled lines.
/proc/ishuman(A)
if(istype(A, /mob/living/carbon/human))
return 1
return 0
/proc/isalien(A)
if(istype(A, /mob/living/carbon/alien))
return 1
return 0
/proc/isxenomorph(A)
if(istype(A, /mob/living/carbon/human))
var/mob/living/carbon/human/H = A
@@ -22,79 +12,7 @@
return 1
return 0
/proc/isbrain(A)
if(A && istype(A, /mob/living/carbon/brain))
return 1
return 0
/proc/isslime(A)
if(istype(A, /mob/living/carbon/slime))
return 1
return 0
/proc/isrobot(A)
if(istype(A, /mob/living/silicon/robot))
return 1
return 0
/proc/isanimal(A)
if(istype(A, /mob/living/simple_animal))
return 1
return 0
/proc/iscorgi(A)
if(istype(A, /mob/living/simple_animal/corgi))
return 1
return 0
/proc/iscrab(A)
if(istype(A, /mob/living/simple_animal/crab))
return 1
return 0
/proc/iscat(A)
if(istype(A, /mob/living/simple_animal/cat))
return 1
return 0
/proc/ismouse(A)
if(istype(A, /mob/living/simple_animal/mouse))
return 1
return 0
/proc/isbear(A)
if(istype(A, /mob/living/simple_animal/hostile/bear))
return 1
return 0
/proc/iscarp(A)
if(istype(A, /mob/living/simple_animal/hostile/carp))
return 1
return 0
/proc/isclown(A)
if(istype(A, /mob/living/simple_animal/hostile/retaliate/clown))
return 1
return 0
/mob/proc/isSilicon()
return 0
/mob/living/silicon/isSilicon()
return 1
/proc/isAI(A)
if(istype(A, /mob/living/silicon/ai))
return 1
return 0
/mob/proc/isMobAI()
return 0
/mob/living/silicon/ai/isMobAI()
return 1
/mob/proc/isSynthetic()
/mob/living/proc/isSynthetic()
return 0
/mob/living/carbon/human/isSynthetic()
@@ -107,56 +25,18 @@
/mob/living/silicon/isSynthetic()
return 1
/mob/living/carbon/human/isMonkey()
return istype(species, /datum/species/monkey)
/mob/proc/isMonkey()
return 0
/mob/living/carbon/human/isMonkey()
return istype(species, /datum/species/monkey)
/proc/ispAI(A)
if(istype(A, /mob/living/silicon/pai))
return 1
return 0
/proc/iscarbon(A)
if(istype(A, /mob/living/carbon))
return 1
return 0
/proc/issilicon(A)
if(istype(A, /mob/living/silicon))
return 1
return 0
/proc/isliving(A)
if(istype(A, /mob/living))
return 1
return 0
proc/isobserver(A)
if(istype(A, /mob/dead/observer))
return 1
return 0
proc/isorgan(A)
if(istype(A, /obj/item/organ/external))
return 1
return 0
proc/isdeaf(A)
if(istype(A, /mob))
var/mob/M = A
return (M.sdisabilities & DEAF) || M.ear_deaf
return 0
proc/isnewplayer(A)
if(istype(A, /mob/new_player))
return 1
return 0
proc/hasorgans(A) // Fucking really??
return ishuman(A)
@@ -644,7 +524,7 @@ proc/is_blind(A)
// A proper CentCom id is hard currency.
else if(id && istype(id, /obj/item/weapon/card/id/centcom))
return SAFE_PERP
if(check_access && !access_obj.allowed(src))
threatcount += 4
+1 -1
View File
@@ -65,7 +65,7 @@
var/cameras[0]
var/lost_sources[0]
if(user.isMobAI())
if(isAI(user))
for(var/obj/machinery/camera/C in A.cameras())
cameras[++cameras.len] = C.nano_structure()
for(var/datum/alarm_source/AS in A.sources)
+1 -1
View File
@@ -69,4 +69,4 @@
return extra_href
/datum/topic_state/air_alarm/proc/has_access(var/mob/user)
return user && (user.isMobAI() || atmos_control.access.allowed(user) || atmos_control.emagged || air_alarm.rcon_setting == RCON_YES || (air_alarm.alarm_area.atmosalm && air_alarm.rcon_setting == RCON_AUTO))
return user && (isAI(user) || atmos_control.access.allowed(user) || atmos_control.emagged || air_alarm.rcon_setting == RCON_YES || (air_alarm.alarm_area.atmosalm && air_alarm.rcon_setting == RCON_AUTO))
+2 -2
View File
@@ -8,7 +8,7 @@
usr << "<span class='warning'>Unable to establish a connection</span>: You're too far away from the station!"
return 0
if(href_list["track"])
if(usr.isMobAI())
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
var/mob/living/carbon/human/H = locate(href_list["track"]) in mob_list
if(hassensorlevel(H, SUIT_SENSOR_TRACKING))
@@ -19,7 +19,7 @@
var/data[0]
var/turf/T = get_turf(nano_host())
data["isAI"] = user.isMobAI()
data["isAI"] = isAI(user)
data["crewmembers"] = crew_repository.health_data(T)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
+2 -2
View File
@@ -136,7 +136,7 @@
if(href_list["notify_laws"])
owner << "<span class='danger'>Law Notice</span>"
owner.laws.show_laws(owner)
if(owner.isMobAI())
if(isAI(owner))
var/mob/living/silicon/ai/AI = owner
for(var/mob/living/silicon/robot/R in AI.connected_robots)
R << "<span class='danger'>Law Notice</span>"
@@ -163,7 +163,7 @@
package_laws(data, "inherent_laws", owner.laws.inherent_laws)
package_laws(data, "supplied_laws", owner.laws.supplied_laws)
data["isAI"] = owner.isMobAI()
data["isAI"] = isAI(owner)
data["isMalf"] = is_malf(user)
data["isSlaved"] = owner.is_slaved()
data["isAdmin"] = is_admin(user)