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
+10 -10
View File
@@ -230,7 +230,7 @@ RCD
return ..()
/obj/item/weapon/rcd/attackby(obj/item/weapon/W, mob/user, params)
if(isrobot(user)) //Make sure cyborgs can't load their RCDs
if(iscyborg(user)) //Make sure cyborgs can't load their RCDs
return
var/loaded = 0
if(istype(W, /obj/item/weapon/rcd_ammo))
@@ -307,7 +307,7 @@ RCD
switch(mode)
if(1)
if(istype(A, /turf/open/space))
if(isspaceturf(A))
var/turf/open/space/S = A
if(useResource(floorcost, user))
user << "<span class='notice'>You start building floor...</span>"
@@ -316,7 +316,7 @@ RCD
return 1
return 0
if(istype(A, /turf/open/floor))
if(isfloorturf(A))
var/turf/open/floor/F = A
if(checkResource(wallcost, user))
user << "<span class='notice'>You start building wall...</span>"
@@ -330,7 +330,7 @@ RCD
return 0
if(2)
if(istype(A, /turf/open/floor))
if(isfloorturf(A))
if(checkResource(airlockcost, user))
var/door_check = 1
for(var/obj/machinery/door/D in A)
@@ -370,12 +370,12 @@ RCD
return 0
if(3)
if(istype(A, /turf/closed/wall))
if(iswallturf(A))
var/turf/closed/wall/W = A
if(istype(W, /turf/closed/wall/r_wall) && !canRturf)
return 0
if(checkResource(deconwallcost, user))
user << "<span class='notice'>You start deconstructing wall...</span>"
user << "<span class='notice'>You start deconstructing [W]...</span>"
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
if(do_after(user, deconwalldelay, target = A))
if(!useResource(deconwallcost, user)) return 0
@@ -384,7 +384,7 @@ RCD
return 1
return 0
if(istype(A, /turf/open/floor))
if(isfloorturf(A))
var/turf/open/floor/F = A
if(istype(F, /turf/open/floor/engine) && !canRturf)
return 0
@@ -435,7 +435,7 @@ RCD
return 0
if (4)
if(istype(A, /turf/open/floor))
if(isfloorturf(A))
if(checkResource(grillecost, user))
if(locate(/obj/structure/grille) in A)
user << "<span class='warning'>There is already a grille there!</span>"
@@ -504,7 +504,7 @@ RCD
canRturf = 1
/obj/item/weapon/rcd/borg/useResource(amount, mob/user)
if(!isrobot(user))
if(!iscyborg(user))
return 0
var/mob/living/silicon/robot/borgy = user
if(!borgy.cell)
@@ -517,7 +517,7 @@ RCD
return .
/obj/item/weapon/rcd/borg/checkResource(amount, mob/user)
if(!isrobot(user))
if(!iscyborg(user))
return 0
var/mob/living/silicon/robot/borgy = user
if(!borgy.cell)
+7 -7
View File
@@ -64,13 +64,13 @@ RSF
/obj/item/weapon/rsf/afterattack(atom/A, mob/user, proximity)
if(!proximity)
return
if (!(istype(A, /obj/structure/table) || istype(A, /turf/open/floor)))
if (!(istype(A, /obj/structure/table) || isfloorturf(A)))
return
if(matter < 1)
user << "<span class='warning'>\The [src] doesn't have enough matter left.</span>"
return
if(isrobot(user))
if(iscyborg(user))
var/mob/living/silicon/robot/R = user
if(!R.cell || R.cell.charge < 200)
user << "<span class='warning'>You do not have enough power to use [src].</span>"
@@ -105,7 +105,7 @@ RSF
use_matter(10, user)
/obj/item/weapon/rsf/proc/use_matter(charge, mob/user)
if (isrobot(user))
if (iscyborg(user))
var/mob/living/silicon/robot/R = user
R.cell.charge -= charge
else
@@ -141,7 +141,7 @@ RSF
/obj/item/weapon/cookiesynth/attack_self(mob/user)
var/mob/living/silicon/robot/P = null
if(isrobot(user))
if(iscyborg(user))
P = user
if(emagged&&!toxin)
toxin = 1
@@ -162,12 +162,12 @@ RSF
return
if(!proximity)
return
if (!(istype(A, /obj/structure/table) || istype(A, /turf/open/floor)))
if (!(istype(A, /obj/structure/table) || isfloorturf(A)))
return
if(matter < 1)
user << "<span class='warning'>The [src] doesn't have enough matter left. Wait for it to recharge!</span>"
return
if(isrobot(user))
if(iscyborg(user))
var/mob/living/silicon/robot/R = user
if(!R.cell || R.cell.charge < 400)
user << "<span class='warning'>You do not have enough power to use [src].</span>"
@@ -178,7 +178,7 @@ RSF
var/obj/item/weapon/reagent_containers/food/snacks/cookie/S = new /obj/item/weapon/reagent_containers/food/snacks/cookie(T)
if(toxin)
S.reagents.add_reagent("chloralhydrate2", 10)
if (isrobot(user))
if (iscyborg(user))
var/mob/living/silicon/robot/R = user
R.cell.charge -= 100
else
@@ -55,7 +55,7 @@
// Find out if there is an open turf in front of us,
// and if not, pick the turf we are standing on.
var/turf/T = get_step(get_turf(src), user.dir)
if(!istype(T, /turf/open))
if(!isopenturf(T))
T = get_turf(src)
// they managed to lose their lungs between then and
+1 -1
View File
@@ -353,7 +353,7 @@
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
return
if(!wielded)
if(isrobot(user))
if(iscyborg(user))
user << "<span class='warning'>You must activate the paddles in your active module before you can use them on someone!</span>"
else
user << "<span class='warning'>You need to wield the paddles in both hands before you can use them on someone!</span>"
@@ -172,7 +172,7 @@
reagents.clear_reagents()
var/turf/T = get_turf(loc)
if(istype(T, /turf/open))
if(isopenturf(T))
var/turf/open/theturf = T
theturf.MakeSlippery(min_wet_time = 10, wet_time_to_add = 5)
@@ -29,25 +29,25 @@
icon_state = "frag"
/obj/item/weapon/grenade/gluon
desc = "An advanced grenade that releases a harmful stream of gluons inducing radiation in those nearby. These gluon streams will also make victims feel exhausted, and induce shivering. This extreme coldness will also likely wet any nearby floors."
name = "gluon frag grenade"
icon = 'icons/obj/grenade.dmi'
icon_state = "bluefrag"
item_state = "flashbang"
var/freeze_range = 4
var/rad_damage = 35
var/stamina_damage = 30
desc = "An advanced grenade that releases a harmful stream of gluons inducing radiation in those nearby. These gluon streams will also make victims feel exhausted, and induce shivering. This extreme coldness will also likely wet any nearby floors."
name = "gluon frag grenade"
icon = 'icons/obj/grenade.dmi'
icon_state = "bluefrag"
item_state = "flashbang"
var/freeze_range = 4
var/rad_damage = 35
var/stamina_damage = 30
/obj/item/weapon/grenade/gluon/prime()
update_mob()
playsound(loc, 'sound/effects/EMPulse.ogg', 50, 1)
radiation_pulse(loc,freeze_range,freeze_range+1,rad_damage)
for(var/turf/T in view(freeze_range,loc))
if(istype(T,/turf/open/floor))
var/turf/open/floor/F = T
F.wet = TURF_WET_PERMAFROST
addtimer(F, "MakeDry", rand(3000, 3100), 0, TURF_WET_PERMAFROST)
for(var/mob/living/carbon/L in T)
L.adjustStaminaLoss(stamina_damage)
L.bodytemperature -= 230
qdel(src)
update_mob()
playsound(loc, 'sound/effects/EMPulse.ogg', 50, 1)
radiation_pulse(loc,freeze_range,freeze_range+1,rad_damage)
for(var/turf/T in view(freeze_range,loc))
if(isfloorturf(T))
var/turf/open/floor/F = T
F.wet = TURF_WET_PERMAFROST
addtimer(F, "MakeDry", rand(3000, 3100), 0, TURF_WET_PERMAFROST)
for(var/mob/living/carbon/L in T)
L.adjustStaminaLoss(stamina_damage)
L.bodytemperature -= 230
qdel(src)
+1 -1
View File
@@ -186,7 +186,7 @@
return ..()
/obj/item/weapon/restraints/handcuffs/cable/zipties/cyborg/attack(mob/living/carbon/C, mob/user)
if(isrobot(user))
if(iscyborg(user))
if(!C.handcuffed)
playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2)
C.visible_message("<span class='danger'>[user] is trying to put zipties on [C]!</span>", \
@@ -83,7 +83,7 @@
var/shock = 0
/obj/item/weapon/holosign_creator/cyborg/attack_self(mob/user)
if(isrobot(user))
if(iscyborg(user))
var/mob/living/silicon/robot/R = user
if(shock)
@@ -82,7 +82,7 @@
else
user.take_bodypart_damage(2*force)
return
if(isrobot(target))
if(iscyborg(target))
..()
return
if(!isliving(target))
@@ -90,7 +90,7 @@
if (user.a_intent == "harm")
if(!..())
return
if(!isrobot(target))
if(!iscyborg(target))
return
else
if(cooldown <= world.time)
@@ -190,7 +190,7 @@
consume_everything(target)
else
var/turf/T = get_turf(src)
if(!istype(T,/turf/open/space))
if(!isspaceturf(T))
consume_turf(T)
/obj/item/weapon/melee/supermatter_sword/afterattack(target, mob/user, proximity_flag)
+1 -1
View File
@@ -26,7 +26,7 @@ obj/item/weapon/mop/proc/clean(turf/A)
for(var/obj/effect/O in A)
if(is_cleanable(O))
qdel(O)
if(istype(A, /turf/closed))
if(isclosedturf(A))
var/turf/closed/C = A
C.thermite = 0
reagents.reaction(A, TOUCH, 10) //Needed for proper floor wetting.
+1 -1
View File
@@ -83,7 +83,7 @@
if(paintleft <= 0)
icon_state = "paint_empty"
return
if(!istype(target) || istype(target, /turf/open/space))
if(!istype(target) || isspaceturf(target))
return
target.color = "#" + item_color
@@ -302,7 +302,7 @@
/obj/item/weapon/storage/backpack/satchel/flat/secret/New()
..()
if(istype(loc,/turf/open/floor) && !istype(loc,/turf/open/floor/plating/))
if(isfloorturf(loc) && !istype(loc,/turf/open/floor/plating/))
hide(1)
/obj/item/weapon/storage/backpack/satchel/flat/secret/hide(intact)
@@ -187,7 +187,7 @@ var/global/list/bibleitemstates = list("bible", "koran", "scrapbook", "bible", "
/obj/item/weapon/storage/book/bible/afterattack(atom/A, mob/user, proximity)
if(!proximity)
return
if (istype(A, /turf/open/floor))
if(isfloorturf(A))
user << "<span class='notice'>You hit the floor with the bible.</span>"
if(user.mind && (user.mind.assigned_role == "Chaplain"))
for(var/obj/effect/rune/R in orange(2,user))
@@ -386,7 +386,7 @@
if(labeler.mode)
return 0
. = 1 //no afterattack
if(isrobot(user))
if(iscyborg(user))
return //Robots can't interact with storage items.
if(!can_be_inserted(W, 0 , user))
+2 -2
View File
@@ -111,7 +111,7 @@
deductcharge(hitcost)
return
if(isrobot(M))
if(iscyborg(M))
..()
return
@@ -140,7 +140,7 @@
if(H.check_shields(0, "[user]'s [name]", src, MELEE_ATTACK)) //No message; check_shields() handles that
playsound(L, 'sound/weapons/Genhit.ogg', 50, 1)
return 0
if(isrobot(loc))
if(iscyborg(loc))
var/mob/living/silicon/robot/R = loc
if(!R || !R.cell || !R.cell.use(hitcost))
return 0
+3 -3
View File
@@ -41,7 +41,7 @@
else //something wrong
name = "[initial(name)]"
update_icon()
if(isrobot(user))
if(iscyborg(user))
user << "<span class='notice'>You free up your module.</span>"
else if(istype(src, /obj/item/weapon/twohanded/required))
user << "<span class='notice'>You drop \the [name].</span>"
@@ -71,7 +71,7 @@
force = force_wielded
name = "[name] (Wielded)"
update_icon()
if(isrobot(user))
if(iscyborg(user))
user << "<span class='notice'>You dedicate your module to [name].</span>"
else
user << "<span class='notice'>You grab the [name] with both hands.</span>"
@@ -362,7 +362,7 @@
/obj/item/weapon/twohanded/spear/afterattack(atom/movable/AM, mob/user, proximity)
if(!proximity)
return
if(istype(AM, /turf/open)) //So you can actually melee with it
if(isopenturf(AM)) //So you can actually melee with it
return
if(explosive && wielded)
user.say("[war_cry]")