Adds a few turf istype helpers (#20754)

* a very calming act
when the world is too much, too fast

* i'm tired
but i have to be efficient, infinite

* lick your lips at the sight of me
a fantasy made reality
This commit is contained in:
Joan Lung
2016-10-01 19:25:46 +02:00
committed by AnturK
parent d6ba32394c
commit bdcb16113a
145 changed files with 337 additions and 326 deletions
+1 -1
View File
@@ -164,7 +164,7 @@
..()
/obj/item/device/mmi/Destroy()
if(isrobot(loc))
if(iscyborg(loc))
var/mob/living/silicon/robot/borg = loc
borg.mmi = null
if(brainmob)
@@ -48,7 +48,7 @@ Doesn't work on other aliens/AI.*/
if(!silent)
user << "<span class='noticealien'>Not enough plasma stored.</span>"
return 0
if(check_turf && (!isturf(user.loc) || istype(user.loc, /turf/open/space)))
if(check_turf && (!isturf(user.loc) || isspaceturf(user.loc)))
if(!silent)
user << "<span class='noticealien'>Bad place for a garden!</span>"
return 0
+2 -2
View File
@@ -432,7 +432,7 @@
/mob/living/movement_delay()
. = ..()
if(istype(loc, /turf/open))
if(isopenturf(loc))
var/turf/open/T = loc
. += T.slowdown
switch(m_intent)
@@ -739,7 +739,7 @@
else if(istype(loc, /obj/structure/transit_tube_pod))
loc_temp = environment.temperature
else if(istype(get_turf(src), /turf/open/space))
else if(isspaceturf(get_turf(src)))
var/turf/heat_turf = get_turf(src)
loc_temp = heat_turf.temperature
+4 -4
View File
@@ -47,7 +47,7 @@
/mob/living/silicon/ai/proc/lacks_power()
var/turf/T = get_turf(src)
var/area/A = get_area(src)
return !T || !A || ((!A.master.power_equip || istype(T, /turf/open/space)) && !is_type_in_list(src.loc, list(/obj/item, /obj/mecha)))
return !T || !A || ((!A.master.power_equip || isspaceturf(T)) && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
/mob/living/silicon/ai/updatehealth()
if(status_flags & GODMODE)
@@ -88,7 +88,7 @@
var/turf/T = get_turf(src)
var/area/AIarea = get_area(src)
if(AIarea && AIarea.master.power_equip)
if(!istype(T, /turf/open/space))
if(!isspaceturf(T))
ai_restore_power()
return
src << "Fault confirmed: missing external power. Shutting down main control system to save power."
@@ -96,7 +96,7 @@
src << "Emergency control system online. Verifying connection to power network."
sleep(50)
T = get_turf(src)
if (istype(T, /turf/open/space))
if(isspaceturf(T))
src << "Unable to verify! No power connection detected!"
aiRestorePowerRoutine = POWER_RESTORATION_SEARCH_APC
return
@@ -123,7 +123,7 @@
aiRestorePowerRoutine = POWER_RESTORATION_SEARCH_APC
return
if(AIarea.master.power_equip)
if (!istype(T, /turf/open/space))
if(!isspaceturf(T))
ai_restore_power()
return
switch(PRP)
@@ -98,7 +98,7 @@
return
if(emagged == 2) //Emag functions
if(istype(loc, /turf/open))
if(isopenturf(loc))
for(var/mob/living/carbon/victim in loc)
if(victim != target)
@@ -187,10 +187,10 @@
if(!target && emagged < 2)
if(targetdirection != null) //The bot is in line mode.
var/turf/T = get_step(src, targetdirection)
if(istype(T, /turf/open/space)) //Check for space
if(isspaceturf(T)) //Check for space
target = T
process_type = LINE_SPACE_MODE
if(istype(T, /turf/open/floor)) //Check for floor
if(isfloorturf(T)) //Check for floor
target = T
if(!target)
@@ -250,7 +250,7 @@
return
if(istype(target, /turf/) && emagged < 2)
repair(target)
else if(emagged == 2 && istype(target,/turf/open/floor))
else if(emagged == 2 && isfloorturf(target))
var/turf/open/floor/F = target
anchored = 1
mode = BOT_REPAIRING
@@ -291,7 +291,7 @@
result = F
if(REPLACE_TILE)
F = scan_target
if(istype(F, /turf/open/floor) && !istype(F, /turf/open/floor/plating)) //The floor must already have a tile.
if(isfloorturf(F) && !istype(F, /turf/open/floor/plating)) //The floor must already have a tile.
result = F
if(FIX_TILE) //Selects only damaged floors.
F = scan_target
@@ -307,14 +307,14 @@
/mob/living/simple_animal/bot/floorbot/proc/repair(turf/target_turf)
if(istype(target_turf, /turf/open/space/))
if(isspaceturf(target_turf))
//Must be a hull breach or in line mode to continue.
if(!is_hull_breach(target_turf) && !targetdirection)
target = null
return
else if(!istype(target_turf, /turf/open/floor))
else if(!isfloorturf(target_turf))
return
if(istype(target_turf, /turf/open/space/)) //If we are fixing an area not part of pure space, it is
if(isspaceturf(target_turf)) //If we are fixing an area not part of pure space, it is
anchored = 1
icon_state = "floorbot-c"
visible_message("<span class='notice'>[targetdirection ? "[src] begins installing a bridge plating." : "[src] begins to repair the hole."] </span>")
@@ -113,7 +113,7 @@
//Removing from inventory
if(href_list["remove_inv"])
if(!Adjacent(usr) || !(ishuman(usr) || ismonkey(usr) || isrobot(usr) || isalienadult(usr)))
if(!Adjacent(usr) || !(ishuman(usr) || ismonkey(usr) || iscyborg(usr) || isalienadult(usr)))
return
var/remove_from = href_list["remove_inv"]
switch(remove_from)
@@ -140,7 +140,7 @@
//Adding things to inventory
else if(href_list["add_inv"])
if(!Adjacent(usr) || !(ishuman(usr) || ismonkey(usr) || isrobot(usr) || isalienadult(usr)))
if(!Adjacent(usr) || !(ishuman(usr) || ismonkey(usr) || iscyborg(usr) || isalienadult(usr)))
return
var/add_to = href_list["add_inv"]
@@ -76,7 +76,7 @@
return
var/turf/beacon_loc = get_turf(src.loc)
if(!istype(beacon_loc, /turf/open/floor))
if(!isfloorturf(beacon_loc))
return
if(beacon)
@@ -108,7 +108,7 @@
LayEggs()
/mob/living/simple_animal/hostile/alien/proc/SpreadPlants()
if(!isturf(loc) || istype(loc, /turf/open/space))
if(!isturf(loc) || isspaceturf(loc))
return
if(locate(/obj/structure/alien/weeds/node) in get_turf(src))
return
@@ -116,7 +116,7 @@
new /obj/structure/alien/weeds/node(loc)
/mob/living/simple_animal/hostile/alien/proc/LayEggs()
if(!isturf(loc) || istype(loc, /turf/open/space))
if(!isturf(loc) || isspaceturf(loc))
return
if(locate(/obj/structure/alien/egg) in get_turf(src))
return
@@ -352,7 +352,7 @@
EscapeConfinement()
for(var/dir in cardinal)
var/turf/T = get_step(targets_from, dir)
if(istype(T, /turf/closed/wall) || istype(T, /turf/closed/mineral))
if(iswallturf(T) || ismineralturf(T))
if(T.Adjacent(targets_from))
T.attack_animal(src)
for(var/a in T)
@@ -496,7 +496,7 @@ Difficulty: Very Hard
for(var/atom/Stuff in A)
if(isturf(Stuff))
var/turf/T = Stuff
if((istype(T, /turf/open/space) || istype(T, /turf/open/floor)) && NewTerrainFloors)
if((isspaceturf(T) || isfloorturf(T)) && NewTerrainFloors)
var/turf/open/O = T.ChangeTurf(NewTerrainFloors)
if(O.air)
var/datum/gas_mixture/G = O.air
@@ -505,7 +505,7 @@ Difficulty: Very Hard
var/atom/Picked = pick(NewFlora)
new Picked(O)
continue
if(istype(T, /turf/closed/wall) && NewTerrainWalls)
if(iswallturf(T) && NewTerrainWalls)
T.ChangeTurf(NewTerrainWalls)
continue
if(istype(Stuff, /obj/structure/chair) && NewTerrainChairs)
@@ -759,7 +759,7 @@ Difficulty: Very Hard
sound = null
/obj/effect/proc_holder/spell/targeted/exit_possession/cast(list/targets, mob/user = usr)
if(!istype(user.loc, /turf/open/floor))
if(!isfloorturf(user.loc))
return
var/datum/mind/target_mind = user.mind
for(var/i in user)
@@ -492,7 +492,7 @@ Difficulty: Hard
friendly_fire_check = friendly_fire
if(new_caster)
hit_things += new_caster
if(istype(loc, /turf/closed/mineral)) //drill mineral turfs
if(ismineralturf(loc)) //drill mineral turfs
var/turf/closed/mineral/M = loc
M.gets_drilled(caster)
addtimer(src, "blast", 0)
@@ -199,7 +199,7 @@ var/global/list/protected_objects = list(/obj/structure/table, /obj/structure/ca
/mob/living/simple_animal/hostile/mimic/copy/machine/CanAttack(atom/the_target)
if(the_target == creator) // Don't attack our creator AI.
return 0
if(isrobot(the_target))
if(iscyborg(the_target))
var/mob/living/silicon/robot/R = the_target
if(R.connected_ai == creator) // Only attack robots that aren't synced to our creator AI.
return 0
@@ -483,7 +483,7 @@
/obj/effect/goliath_tentacle/New()
var/turftype = get_turf(src)
if(istype(turftype, /turf/closed/mineral))
if(ismineralturf(turftype))
var/turf/closed/mineral/M = turftype
M.gets_drilled()
addtimer(src, "Trip", 10)
@@ -987,7 +987,7 @@
/mob/living/simple_animal/hostile/spawner/lavaland/New()
..()
for(var/F in RANGE_TURFS(1, src))
if(istype(F, /turf/closed/mineral))
if(ismineralturf(F))
var/turf/closed/mineral/M = F
M.ChangeTurf(M.turf_type)
gps = new /obj/item/device/gps/internal(src)
@@ -41,7 +41,7 @@
/mob/living/simple_animal/hostile/tree/Life()
..()
if(istype(src.loc, /turf/open))
if(isopenturf(loc))
var/turf/open/T = src.loc
if(T.air && T.air.gases["co2"])
var/co2 = T.air.gases["co2"][MOLES]
@@ -199,7 +199,7 @@
return
//Is the usr's mob type able to do this? (lolaliens)
if(ishuman(usr) || ismonkey(usr) || isrobot(usr) || isalienadult(usr))
if(ishuman(usr) || ismonkey(usr) || iscyborg(usr) || isalienadult(usr))
//Removing from inventory
if(href_list["remove_inv"])
@@ -199,7 +199,7 @@
//world << "changed from [bodytemperature] by [diff] to [bodytemperature + diff]"
bodytemperature += diff
if(istype(T,/turf/open))
if(isopenturf(T))
var/turf/open/ST = T
if(ST.air)
var/ST_gases = ST.air.gases
+2 -2
View File
@@ -318,7 +318,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
if(hud_used && hud_used.action_intent)
hud_used.action_intent.icon_state = "[a_intent]"
else if(isrobot(src) || ismonkey(src) || islarva(src))
else if(iscyborg(src) || ismonkey(src) || islarva(src))
switch(input)
if("help")
a_intent = "help"
@@ -342,7 +342,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
if(!istype(M))
return 0
if(issilicon(M))
if(isrobot(M)) //For cyborgs, returns 1 if the cyborg has a law 0 and special_role. Returns 0 if the borg is merely slaved to an AI traitor.
if(iscyborg(M)) //For cyborgs, returns 1 if the cyborg has a law 0 and special_role. Returns 0 if the borg is merely slaved to an AI traitor.
var/mob/living/silicon/robot/R = M
if(R.mind && R.mind.special_role)
if(R.laws && R.laws.zeroth && R.syndicate)
+2 -2
View File
@@ -85,7 +85,7 @@
/client/verb/drop_item()
set hidden = 1
if(!isrobot(mob))
if(!iscyborg(mob))
mob.drop_item_v()
return
@@ -283,7 +283,7 @@
continue
else if(isturf(A))
var/turf/turf = A
if(istype(turf,/turf/open/space))
if(isspaceturf(turf))
continue
if(!turf.density && !mob_negates_gravity())
continue
+1 -1
View File
@@ -304,7 +304,7 @@
var/mob/living/character = create_character() //creates the human and transfers vars and mind
var/equip = SSjob.EquipRank(character, rank, 1)
if(isrobot(equip)) //Borgs get borged in the equip, so we need to make sure we handle the new mob.
if(iscyborg(equip)) //Borgs get borged in the equip, so we need to make sure we handle the new mob.
character = equip