From 616be6eed8821897f34968232fc21d8e1112ecc0 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Fri, 22 Jun 2012 14:10:48 -0700 Subject: [PATCH] More while loop stuff, removed shitloads of unnecessary curly brackets in the map reader, fixed ED-209 projectiles --- code/ZAS/FEA_system.dm | 2 +- .../datums/diseases/robotic_transformation.dm | 2 +- code/datums/diseases/xeno_transformation.dm | 2 +- code/game/events/Events/BlowOut.dm | 4 +- code/game/machinery/bots/ed209bot.dm | 36 ++-- code/game/machinery/teleporter.dm | 8 - code/game/machinery/turrets.dm | 25 ++- code/game/mecha/mech_fabricator.dm | 2 +- code/game/mecha/mecha_wreckage.dm | 18 +- code/game/objects/items/helper_procs.dm | 2 +- .../objects/items/weapons/implants/implant.dm | 4 +- code/game/objects/window.dm | 11 +- code/modules/admin/admin.dm | 2 +- code/modules/admin/verbs/mapping.dm | 14 +- code/modules/maps/reader.dm | 182 +++++++----------- .../carbon/alien/humanoid/caste/sentinel.dm | 13 +- 16 files changed, 133 insertions(+), 194 deletions(-) diff --git a/code/ZAS/FEA_system.dm b/code/ZAS/FEA_system.dm index fcd71dbff51..8c121b88fa4 100644 --- a/code/ZAS/FEA_system.dm +++ b/code/ZAS/FEA_system.dm @@ -162,7 +162,7 @@ datum if(!success) //Runtimed. failed_ticks++ if(failed_ticks > 20) - world << "ERROR IN ATMOS TICKER. Killing air simulation!" + world << "ERROR IN ATMOS TICKER. Killing air simulation!" kill_air = 1 sleep(max(5,update_delay*tick_multiplier)) diff --git a/code/datums/diseases/robotic_transformation.dm b/code/datums/diseases/robotic_transformation.dm index 34b074e34f4..8692ef54467 100644 --- a/code/datums/diseases/robotic_transformation.dm +++ b/code/datums/diseases/robotic_transformation.dm @@ -53,7 +53,7 @@ affected_mob.updatehealth() if(prob(40)) //So everyone can feel like robot Seth Brundle if(src.gibbed != 0) return 0 - var/turf/T = find_loc(affected_mob) + var/turf/T = get_turf(affected_mob) gibs(T) src.cure(0) gibbed = 1 diff --git a/code/datums/diseases/xeno_transformation.dm b/code/datums/diseases/xeno_transformation.dm index 9d3289708ff..09e3f20e77a 100644 --- a/code/datums/diseases/xeno_transformation.dm +++ b/code/datums/diseases/xeno_transformation.dm @@ -53,7 +53,7 @@ affected_mob.updatehealth() if(prob(40)) if(gibbed != 0) return 0 - var/turf/T = find_loc(affected_mob) + var/turf/T = get_turf(affected_mob) gibs(T) src.cure(0) gibbed = 1 diff --git a/code/game/events/Events/BlowOut.dm b/code/game/events/Events/BlowOut.dm index 89945d33fcb..1d660989d96 100644 --- a/code/game/events/Events/BlowOut.dm +++ b/code/game/events/Events/BlowOut.dm @@ -23,9 +23,7 @@ command_alert("Station has entered radiation cloud. Do not leave cover until it has passed.") if(ActiveFor == 100 || ActiveFor == 150) //1/2 and 2/2 f the way after it start proper make peope be half dead mostly for(var/mob/living/carbon/M in world) - var/area = M.loc.loc - while(!istype(area, /area)) - area = area:loc + var/area = get_area(M) if(area:radsafe) continue if(!M.stat) diff --git a/code/game/machinery/bots/ed209bot.dm b/code/game/machinery/bots/ed209bot.dm index 5614dcc7826..a40aa01d400 100644 --- a/code/game/machinery/bots/ed209bot.dm +++ b/code/game/machinery/bots/ed209bot.dm @@ -753,13 +753,9 @@ Auto Patrol: []"}, if(lastfired && world.time - lastfired < shot_delay) return lastfired = world.time - var/turf/T = loc - var/atom/U = (istype(target, /atom/movable) ? target.loc : target) - if ((!( U ) || !( T ))) - return - while(!( istype(U, /turf) )) - U = U.loc - if (!( istype(T, /turf) )) + var/turf/T = get_turf(src) + var/turf/U = (istype(target, /atom/movable) ? get_turf(target) : target) + if ( !istype(T) || !istype(U) ) return //if(lastfired && world.time - lastfired < 100) @@ -767,31 +763,25 @@ Auto Patrol: []"}, var/obj/item/projectile/A if(!lasercolor) - if (src.emagged) - A = new /obj/item/projectile/beam( loc ) + if (emagged) + A = new /obj/item/projectile/beam( T ) else - A = new /obj/item/projectile/energy/electrode( loc ) + A = new /obj/item/projectile/energy/electrode( T ) else if(lasercolor == "b") - if (src.emagged) - A = new /obj/item/projectile/energy/electrode( loc ) + if (emagged) + A = new /obj/item/projectile/energy/electrode( T ) else - A = new /obj/item/projectile/bluetag( loc ) + A = new /obj/item/projectile/bluetag( T ) else if(lasercolor == "r") - if (src.emagged) - A = new /obj/item/projectile/energy/electrode( loc ) + if (emagged) + A = new /obj/item/projectile/energy/electrode( T ) else - A = new /obj/item/projectile/redtag( loc ) - - if (!( istype(U, /turf) )) - //A = null - del(A) - return + A = new /obj/item/projectile/redtag( T ) A.current = U A.yo = U.y - T.y A.xo = U.x - T.x spawn( 0 ) - A.process() - return + A.fired() return /obj/machinery/bot/ed209/attack_alien(var/mob/living/carbon/alien/user as mob) diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 1fec2e76069..9ddf4658776 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -105,14 +105,6 @@ src.id = t return -/proc/find_loc(obj/R as obj) - if (!R) return null - var/turf/T = R.loc - while(!istype(T, /turf)) - T = T.loc - if(!T || istype(T, /area)) return null - return T - /obj/machinery/teleport/hub/Bumped(M as mob|obj) spawn() if (src.icon_state == "tele1") diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index 63ff42adc98..2bdd535798f 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -477,6 +477,7 @@ var/health = 40 var/list/scan_for = list("human"=0,"cyborg"=0,"mecha"=0,"alien"=1) var/on = 0 + var/processing = 0 //So we dun get dozens of duplicate while loops icon = 'turrets.dmi' icon_state = "gun_turret" @@ -567,16 +568,20 @@ process() - spawn while(on) - if(projectiles<=0) - on = 0 - return - if(cur_target && !validate_target(cur_target)) - cur_target = null - if(!cur_target) - cur_target = get_target() - fire(cur_target) - sleep(cooldown) + if(!processing) + spawn + while(on) + processing = 1 + if(projectiles<=0) + on = 0 + return + if(cur_target && !validate_target(cur_target)) + cur_target = null + if(!cur_target) + cur_target = get_target() + fire(cur_target) + sleep(cooldown) + processing = 0 return proc/get_target() diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index b4311815a44..0d284d8ed25 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -721,7 +721,7 @@ del(src) return 1 else - user << "\red You can't load the [src.name] while it's opened." + user << "\red You can't load \the [src] while it's opened." return 1 if(istype(W, /obj/item/weapon/card/emag)) diff --git a/code/game/mecha/mecha_wreckage.dm b/code/game/mecha/mecha_wreckage.dm index 29dc0eef7f2..08ac18ac82c 100644 --- a/code/game/mecha/mecha_wreckage.dm +++ b/code/game/mecha/mecha_wreckage.dm @@ -36,7 +36,7 @@ if(salvage_num <= 0) user << "You don't see anything that can be cut with [W]." return - if (!isemptylist(welder_salvage) && WT.remove_fuel(0,user)) + if (welder_salvage && welder_salvage.len && WT.remove_fuel(0,user)) var/type = prob(70)?pick(welder_salvage):null if(type) var/N = new type(get_turf(user)) @@ -53,7 +53,7 @@ if(salvage_num <= 0) user << "You don't see anything that can be cut with [W]." return - else if(!isemptylist(wirecutters_salvage)) + else if(wirecutters_salvage && wirecutters_salvage.len) var/type = prob(70)?pick(wirecutters_salvage):null if(type) var/N = new type(get_turf(user)) @@ -62,7 +62,7 @@ else user << "You failed to salvage anything valuable from [src]." if(istype(W, /obj/item/weapon/crowbar)) - if(!isemptylist(crowbar_salvage)) + if(crowbar_salvage && crowbar_salvage.len) var/obj/S = pick(crowbar_salvage) if(S) S.loc = get_turf(user) @@ -89,7 +89,7 @@ /obj/item/mecha_parts/part/gygax_left_leg, /obj/item/mecha_parts/part/gygax_right_leg) for(var/i=0;i<2;i++) - if(!isemptylist(parts) && prob(40)) + if(parts.len && prob(40)) var/part = pick(parts) welder_salvage += part parts -= part @@ -124,7 +124,7 @@ /obj/item/mecha_parts/part/ripley_left_leg, /obj/item/mecha_parts/part/ripley_right_leg) for(var/i=0;i<2;i++) - if(!isemptylist(parts) && prob(40)) + if(parts && parts.len && prob(40)) var/part = pick(parts) welder_salvage += part parts -= part @@ -143,7 +143,7 @@ /obj/item/mecha_parts/part/ripley_right_leg, /obj/item/clothing/suit/fire) for(var/i=0;i<2;i++) - if(!isemptylist(parts) && prob(40)) + if(parts && parts.len && prob(40)) var/part = pick(parts) welder_salvage += part parts -= part @@ -168,7 +168,7 @@ /obj/item/mecha_parts/part/honker_left_leg, /obj/item/mecha_parts/part/honker_right_leg) for(var/i=0;i<2;i++) - if(!isemptylist(parts) && prob(40)) + if(parts && parts.len && prob(40)) var/part = pick(parts) welder_salvage += part parts -= part @@ -188,7 +188,7 @@ /obj/item/mecha_parts/part/durand_left_leg, /obj/item/mecha_parts/part/durand_right_leg) for(var/i=0;i<2;i++) - if(!isemptylist(parts) && prob(40)) + if(parts && parts.len && prob(40)) var/part = pick(parts) welder_salvage += part parts -= part @@ -213,7 +213,7 @@ /obj/item/mecha_parts/part/odysseus_left_leg, /obj/item/mecha_parts/part/odysseus_right_leg) for(var/i=0;i<2;i++) - if(!isemptylist(parts) && prob(40)) + if(parts && parts.len && prob(40)) var/part = pick(parts) welder_salvage += part parts -= part diff --git a/code/game/objects/items/helper_procs.dm b/code/game/objects/items/helper_procs.dm index 8d5d9aa71f3..4b02b4e8a9e 100644 --- a/code/game/objects/items/helper_procs.dm +++ b/code/game/objects/items/helper_procs.dm @@ -32,7 +32,7 @@ /proc/get_turf(turf/location as turf) while (location) - if (istype(location, /turf)) + if (istype(location)) return location location = location.loc diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index f5422469e2f..9278947952a 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -271,8 +271,8 @@ the implant may become unstable and either pre-maturely inject the subject or si if(istype(imp_in, /mob/)) var/mob/T = imp_in T.gib() - explosion(find_loc(imp_in), 1, 3, 4, 6, 3) - var/turf/t = find_loc(imp_in) + explosion(get_turf(imp_in), 1, 3, 4, 6, 3) + var/turf/t = get_turf(imp_in) if(t) t.hotspot_expose(3500,125) del(src) diff --git a/code/game/objects/window.dm b/code/game/objects/window.dm index b6bc1e5c897..f4924f25ec4 100644 --- a/code/game/objects/window.dm +++ b/code/game/objects/window.dm @@ -229,12 +229,11 @@ step(src, get_dir(user, src)) if (src.health <= 0) if (src.dir == SOUTHWEST) - var/index = null - index = 0 - while(index < 2) - new /obj/item/weapon/shard( src.loc ) - if(reinf) new /obj/item/stack/rods( src.loc) - index++ + new /obj/item/weapon/shard( src.loc ) + new /obj/item/weapon/shard( src.loc ) + if(reinf) + new /obj/item/stack/rods( src.loc) + new /obj/item/stack/rods( src.loc) else new /obj/item/weapon/shard( src.loc ) if(reinf) new /obj/item/stack/rods( src.loc) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index e19b735ac15..659bbf362e4 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1894,7 +1894,7 @@ var/global/BSACooldown = 0 //feedback_add_details("admin_secrets_fun_used","PW") message_admins("\blue [key_name_admin(usr)] teleported all players to the prison station.", 1) for(var/mob/living/carbon/human/H in world) - var/turf/loc = find_loc(H) + var/turf/loc = get_turf(H) var/security = 0 if(loc.z > 1 || prisonwarped.Find(H)) //don't warp them if they aren't ready or are already there diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index f319ebe5019..d943bca690d 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -165,16 +165,10 @@ var/intercom_range_display_status = 0 for(var/atom/A in world) if(istype(A,type_path)) - var/atom/B = A - while(!(isturf(B.loc))) - if(B && B.loc) - B = B.loc - else - break - if(B) - if(B.z == num_level) - count++ - atom_list += A + var/turf/B = get_turf(A) + if(istype(B) && B.z == num_level) + count++ + atom_list += A /* var/atom/temp_atom for(var/i = 0; i <= (atom_list.len/10); i++) diff --git a/code/modules/maps/reader.dm b/code/modules/maps/reader.dm index 8bd9179cfdb..6d520a30b21 100644 --- a/code/modules/maps/reader.dm +++ b/code/modules/maps/reader.dm @@ -1,60 +1,59 @@ -dmm_suite{ - load_map(var/dmm_file as file, var/z_offset as num){ - if(!z_offset){ +dmm_suite + load_map(var/dmm_file as file, var/z_offset as num) + if(!z_offset) z_offset = world.maxz+1 - } var/quote = ascii2text(34) var/tfile = file2text(dmm_file) var/tfile_len = length(tfile) var/list/grid_models[0] var/key_len = length(copytext(tfile,2,findtext(tfile,quote,2,0))) - for(var/lpos=1;lposlength(zgrid)){break} + if(gpos+length(grid_line)+1>length(zgrid)) + break sleep(-1) - } - if(findtext(tfile,quote+"}",zpos,0)+2==tfile_len){break} + if(findtext(tfile,quote+"}",zpos,0)+2==tfile_len) + break sleep(-1) - } - } - proc{ - parse_grid(var/model as text,var/xcrd as num,var/ycrd as num,var/zcrd as num){ + proc + parse_grid(var/model as text,var/xcrd as num,var/ycrd as num,var/zcrd as num) /*Method parse_grid() - Accepts a text string containing a comma separated list of type paths of the same construction as those contained in a .dmm file, and instantiates them. */ var/list/text_strings[0] - for(var/index=1;findtext(model,quote);index++){ + for(var/index=1;findtext(model,quote);index++) /*Loop: Stores quoted portions of text in text_strings, and replaces them with an index to that list. - Each iteration represents one quoted section of text. @@ -63,7 +62,6 @@ dmm_suite{ text_strings[index] = copytext(model,findtext(model,quote)+1,findtext(model,quote,findtext(model,quote)+1,0)) model = copytext(model,1,findtext(model,quote))+"~[index]"+copytext(model,findtext(model,quote,findtext(model,quote)+1,0)+1,0) sleep(-1) - } var/list/old_turf_underlays[0] var/old_turf_density var/old_turf_opacity @@ -71,118 +69,104 @@ dmm_suite{ This is done to approximate the layered turf effect of DM's map editor. An image of each turf is stored in old_turf_underlays[], and is later added to the new turf's underlays. */ - for(var/dpos=1;dpos!=0;dpos=findtext(model,",",dpos,0)+1){ + for(var/dpos=1;dpos!=0;dpos=findtext(model,",",dpos,0)+1) /*Loop: Identifies each object's data, instantiates it, and reconstitues it's fields. - Each iteration represents one object's data, including type path and field values. */ var/full_def = copytext(model,dpos,findtext(model,",",dpos,0)) var/atom_def = text2path(copytext(full_def,1,findtext(full_def,"{"))) var/list/attributes[0] - if(findtext(full_def,"{")){ + if(findtext(full_def,"{")) full_def = copytext(full_def,1,length(full_def)) - for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1){ + for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1) //Loop: Identifies each attribute/value pair, and stores it in attributes[]. attributes.Add(copytext(full_def,apos,findtext(full_def,";",apos,0))) - if(!findtext(copytext(full_def,apos,0),";")){break} + if(!findtext(copytext(full_def,apos,0),";")) + break sleep(-1) - } - } //Construct attributes associative list var/list/fields = new(0) - for(var/index=1;index<=attributes.len;index++){ + for(var/index=1;index<=attributes.len;index++) var/trim_left = trim_text(copytext(attributes[index],1,findtext(attributes[index],"="))) var/trim_right = trim_text(copytext(attributes[index],findtext(attributes[index],"=")+1,0)) //Check for string - if(findtext(trim_right,"~")){ + if(findtext(trim_right,"~")) var/reference_index = copytext(trim_right,findtext(trim_right,"~")+1,0) trim_right=text_strings[text2num(reference_index)] - } //Check for number - else if(isnum(text2num(trim_right))){ + else if(isnum(text2num(trim_right))) trim_right = text2num(trim_right) - } //Check for file - else if(copytext(trim_right,1,2) == "'"){ + else if(copytext(trim_right,1,2) == "'") trim_right = file(copytext(trim_right,2,length(trim_right))) - } fields[trim_left] = trim_right - } //End construction //Begin Instanciation var/atom/instance var/dmm_suite/preloader/_preloader = new(fields) - if(ispath(atom_def,/area)){ + if(ispath(atom_def,/area)) instance = locate(atom_def) instance.contents.Add(locate(xcrd,ycrd,zcrd)) - } - else if(ispath(atom_def,/turf)){ + else if(ispath(atom_def,/turf)) var/turf/old_turf = locate(xcrd,ycrd,zcrd) if(old_turf.density){old_turf_density = 1} if(old_turf.opacity){old_turf_opacity = 1} - if(old_turf.icon){ + if(old_turf.icon) var/image/old_turf_image = image(old_turf.icon,null,old_turf.icon_state,old_turf.layer,old_turf.dir) old_turf_underlays.Add(old_turf_image) - } instance = new atom_def(old_turf, _preloader) - for(var/inverse_index=old_turf_underlays.len;inverse_index;inverse_index--){ + for(var/inverse_index=old_turf_underlays.len;inverse_index;inverse_index--) var/image/image_underlay = old_turf_underlays[inverse_index] image_underlay.loc = instance instance.underlays.Add(image_underlay) - } - if(!instance.density){instance.density = old_turf_density} - if(!instance.opacity){instance.opacity = old_turf_opacity} - } + if(!instance.density) + instance.density = old_turf_density + if(!instance.opacity) + instance.opacity = old_turf_opacity - if(_preloader && instance){ + if(_preloader && instance) _preloader.load(instance) - } //End Instanciation - if(!findtext(copytext(model,dpos,0),",")){break} + if(!findtext(copytext(model,dpos,0),",")) + break sleep(-1) - } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for(var/dpos=1;dpos!=0;dpos=findtext(model,",",dpos,0)+1) - { /*Loop: Identifies each object's data, instantiates it, and reconstitues it's fields. - Each iteration represents one object's data, including type path and field values. */ var/full_def = copytext(model,dpos,findtext(model,",",dpos,0)) var/atom_def = text2path(copytext(full_def,1,findtext(full_def,"{"))) var/list/attributes[0] - if(findtext(full_def,"{")){ + if(findtext(full_def,"{")) full_def = copytext(full_def,1,length(full_def)) - for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1){ + for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1) //Loop: Identifies each attribute/value pair, and stores it in attributes[]. attributes.Add(copytext(full_def,apos,findtext(full_def,";",apos,0))) - if(!findtext(copytext(full_def,apos,0),";")){break} + if(!findtext(copytext(full_def,apos,0),";")) + break sleep(-1) - } - } //Construct attributes associative list var/list/fields = new(0) - for(var/index=1;index<=attributes.len;index++){ + for(var/index=1;index<=attributes.len;index++) var/trim_left = trim_text(copytext(attributes[index],1,findtext(attributes[index],"="))) var/trim_right = trim_text(copytext(attributes[index],findtext(attributes[index],"=")+1,0)) //Check for string - if(findtext(trim_right,"~")){ + if(findtext(trim_right,"~")) var/reference_index = copytext(trim_right,findtext(trim_right,"~")+1,0) trim_right=text_strings[text2num(reference_index)] - } //Check for number - else if(isnum(text2num(trim_right))){ + else if(isnum(text2num(trim_right))) trim_right = text2num(trim_right) - } //Check for file - else if(copytext(trim_right,1,2) == "'"){ + else if(copytext(trim_right,1,2) == "'") trim_right = file(copytext(trim_right,2,length(trim_right))) - } fields[trim_left] = trim_right - } //End construction @@ -190,60 +174,42 @@ dmm_suite{ var/atom/instance var/dmm_suite/preloader/_preloader = new(fields) if(!ispath(atom_def,/area) && !ispath(atom_def,/turf)) - { instance = new atom_def(locate(xcrd,ycrd,zcrd), _preloader) - } if(_preloader && instance) - { _preloader.load(instance) - } //End Instanciation - if(!findtext(copytext(model,dpos,0),",")){break} + if(!findtext(copytext(model,dpos,0),",")) + break sleep(-1) - } - - } - trim_text(var/what as text){ - while(length(what) && findtext(what," ",1,2)){ + trim_text(var/what as text) + while(length(what) && findtext(what," ",1,2)) what=copytext(what,2,0) - } - while(length(what) && findtext(what," ",length(what),0)){ + while(length(what) && findtext(what," ",length(what),0)) what=copytext(what,1,length(what)) - } return what - } - } - } -atom/New(atom/loc, dmm_suite/preloader/_dmm_preloader){ - if(istype(_dmm_preloader, /dmm_suite/preloader)){ +atom/New(atom/loc, dmm_suite/preloader/_dmm_preloader) + if(istype(_dmm_preloader, /dmm_suite/preloader)) _dmm_preloader.load(src) - } . = ..() - } -dmm_suite{ - preloader{ - parent_type = /datum - var{ - list/attributes - } - New(list/the_attributes){ - .=..() - if(!the_attributes.len){ Del()} - attributes = the_attributes - } - proc{ - load(atom/what){ - for(var/attribute in attributes){ - what.vars[attribute] = attributes[attribute] - } - Del() - } - } - } - } + +dmm_suite + preloader + parent_type = /datum + var + list/attributes + New(list/the_attributes) + .=..() + if(!the_attributes.len) + Del() + attributes = the_attributes + proc + load(atom/what) + for(var/attribute in attributes) + what.vars[attribute] = attributes[attribute] + Del() diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm index b0222d60c9e..cfb3606eb90 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/sentinel.dm @@ -167,20 +167,15 @@ if ((O.client && !( O.blinded ))) O << "\red [src] spits neurotoxin at [target]!" //I'm not motivated enough to revise this. Prjectile code in general needs update. - var/turf/T = loc - var/turf/U = (istype(target, /atom/movable) ? target.loc : target) + var/turf/T = get_turf(src) + var/turf/U = (istype(target, /atom/movable) ? get_turf(target) : target) - if(!U || !T) - return - while(U && !istype(U,/turf)) - U = U.loc - if(!istype(T, /turf)) + if(!istype(T, /turf) || !istype(U,/turf)) return + if (U == T) usr.bullet_act(src, src.get_organ_target()) return - if(!istype(U, /turf)) - return var/obj/item/projectile/energy/dart/A = new /obj/item/projectile/energy/dart(usr.loc)