From 2b96fec3f1487174fd8945e8ed5fa83c323e32c8 Mon Sep 17 00:00:00 2001 From: Ren Erthilo Date: Sun, 29 Apr 2012 22:41:02 +0100 Subject: [PATCH] TG: Bugfixes for NTSL. AIs can now use script consoles. Fixes crashes. Buffs metroid magic. More core uses! Revision: r3334 Author: vageyenaman --- code/defines/procs/helpers.dm | 36 ++++++++- .../telecomms/machine_interactions.dm | 73 +++++++++++-------- .../machinery/telecomms/traffic_control.dm | 1 + code/modules/chemical/Chemistry-Recipes.dm | 11 +-- 4 files changed, 86 insertions(+), 35 deletions(-) diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index 075cb3e4150..88ce01f0c4a 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -229,6 +229,8 @@ return max(low,min(high,num)) /proc/dd_replacetext(text, search_string, replacement_string) + if(!text || !istext(text) || !search_string || !istext(search_string) || !istext(replacement_string)) + return null var/textList = dd_text2list(text, search_string) return dd_list2text(textList, replacement_string) @@ -1383,7 +1385,7 @@ proc/listclearnulls(list/list) var/y_pos = null var/z_pos = null -/area/proc/move_contents_to(var/area/A, var/turftoleave=null) +/area/proc/move_contents_to(var/area/A, var/turftoleave=null, var/direction = null) //Takes: Area. Optional: turf type to leave behind. //Returns: Nothing. //Notes: Attempts to move the contents of one area to another area. @@ -1442,7 +1444,39 @@ proc/listclearnulls(list/list) X.icon_state = old_icon_state1 X.icon = old_icon1 //Shuttle floors are in shuttle.dmi while the defaults are floors.dmi + /* Quick visual fix for some weird shuttle corner artefacts when on transit space tiles */ + if(direction && findtext(X.icon_state, "swall_s")) + + // Spawn a new shuttle corner object + var/obj/corner = new() + corner.loc = X + corner.density = 1 + corner.anchored = 1 + corner.icon = X.icon + corner.icon_state = dd_replacetext(X.icon_state, "_s", "_f") + corner.tag = "delete me" + corner.name = "wall" + + // Find a new turf to take on the property of + var/turf/nextturf = get_step(corner, direction) + if(!nextturf || !istype(nextturf, /turf/space)) + nextturf = get_step(corner, turn(direction, 180)) + + + // Take on the icon of a neighboring scrolling space icon + X.icon = nextturf.icon + X.icon_state = nextturf.icon_state + + for(var/obj/O in T) + + // Reset the shuttle corners + if(O.tag == "delete me") + X.icon = 'shuttle.dmi' + X.icon_state = dd_replacetext(O.icon_state, "_f", "_s") // revert the turf to the old icon_state + X.name = "wall" + del(O) // prevents multiple shuttle corners from stacking + continue if(!istype(O,/obj)) continue O.loc = X for(var/mob/M in T) diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index 2ead66f3eb7..7d87be6345b 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -90,19 +90,25 @@ del(src) + attack_ai(var/mob/user as mob) + attack_hand(user) + attack_hand(var/mob/user as mob) - // You need a multitool to use this. - if(user.equipped()) - if(!istype(user.equipped(), /obj/item/device/multitool)) + // You need a multitool to use this, or be silicon + if(!issilicon(user)) + if(user.equipped()) + if(!istype(user.equipped(), /obj/item/device/multitool)) + return + else return - else - return if(stat & (BROKEN|NOPOWER) || !on) return - var/obj/item/device/multitool/P = user.equipped() + var/obj/item/device/multitool/P = null + if(!issilicon(user)) + P = user.equipped() user.machine = src var/dat @@ -138,10 +144,12 @@ dat += "
\[Add Filter\]" dat += "
" - if(P.buffer) - dat += "

MULTITOOL BUFFER: [P.buffer] ([P.buffer.id]) \[Link\] \[Flush\]" - else - dat += "

MULTITOOL BUFFER:
\[Add Machine\]" + + if(P) + if(P.buffer) + dat += "

MULTITOOL BUFFER: [P.buffer] ([P.buffer.id]) \[Link\] \[Flush\]" + else + dat += "

MULTITOOL BUFFER:
\[Add Machine\]" dat += "" temp = "" @@ -150,16 +158,19 @@ Topic(href, href_list) - if(usr.equipped()) - if(!istype(usr.equipped(), /obj/item/device/multitool)) + if(!issilicon(usr)) + if(usr.equipped()) + if(!istype(usr.equipped(), /obj/item/device/multitool)) + return + else return - else - return if(stat & (BROKEN|NOPOWER) || !on) return - var/obj/item/device/multitool/P = usr.equipped() + var/obj/item/device/multitool/P = null + if(!issilicon(usr)) + P = usr.equipped() if(href_list["input"]) switch(href_list["input"]) @@ -205,27 +216,30 @@ if(href_list["unlink"]) - var/obj/machinery/telecomms/T = links[text2num(href_list["unlink"])] - temp = "-% Removed \ref[T] [T.name] from linked entities. %-" + if(text2num(href_list["unlink"]) <= length(links)) + var/obj/machinery/telecomms/T = links[text2num(href_list["unlink"])] + temp = "-% Removed \ref[T] [T.name] from linked entities. %-" - // Remove link entries from both T and src. - if(src in T.links) - T.links.Remove(src) - links.Remove(T) + // Remove link entries from both T and src. + if(src in T.links) + T.links.Remove(src) + links.Remove(T) if(href_list["link"]) - if(P.buffer) - if(!(src in P.buffer.links)) - P.buffer.links.Add(src) + if(P) - if(!(P.buffer in src.links)) - src.links.Add(P.buffer) + if(P.buffer) + if(!(src in P.buffer.links)) + P.buffer.links.Add(src) - temp = "-% Successfully linked with \ref[P.buffer] [P.buffer.name] %-" + if(!(P.buffer in src.links)) + src.links.Add(P.buffer) - else - temp = "-% Unable to acquire buffer %-" + temp = "-% Successfully linked with \ref[P.buffer] [P.buffer.name] %-" + + else + temp = "-% Unable to acquire buffer %-" if(href_list["buffer"]) @@ -244,3 +258,4 @@ updateUsrDialog() + diff --git a/code/game/machinery/telecomms/traffic_control.dm b/code/game/machinery/telecomms/traffic_control.dm index aee9ab68a4d..accfd0abea5 100644 --- a/code/game/machinery/telecomms/traffic_control.dm +++ b/code/game/machinery/telecomms/traffic_control.dm @@ -169,6 +169,7 @@ editingcode = usr winshow(editingcode, "Telecomms IDE", 1) // show the IDE winset(editingcode, "tcscode", "is-disabled=false") + winset(editingcode, "tcscode", "text=\"\"") var/showcode = dd_replacetext(storedcode, "\\\"", "\\\\\"") showcode = dd_replacetext(storedcode, "\"", "\\\"") winset(editingcode, "tcscode", "text=\"[showcode]\"") diff --git a/code/modules/chemical/Chemistry-Recipes.dm b/code/modules/chemical/Chemistry-Recipes.dm index b78486260f6..0ecef3b724f 100644 --- a/code/modules/chemical/Chemistry-Recipes.dm +++ b/code/modules/chemical/Chemistry-Recipes.dm @@ -759,13 +759,14 @@ datum if(M:eyecheck() <= 0) flick("e_flash", M.flash) - for(var/i = 1, i <= created_volume, i++) + for(var/i = 1, i <= created_volume + rand(1,2), i++) var/chosen = pick(borks) var/obj/B = new chosen - B.loc = get_turf_loc(holder.my_atom) - if(prob(50)) - for(var/j = 1, j <= rand(1, 3), j++) - step(B, pick(NORTH,SOUTH,EAST,WEST)) + if(B) + B.loc = get_turf_loc(holder.my_atom) + if(prob(50)) + for(var/j = 1, j <= rand(1, 3), j++) + step(B, pick(NORTH,SOUTH,EAST,WEST))