From 15a5ecdd062ab758902023c843680cbbfa9e3d55 Mon Sep 17 00:00:00 2001 From: panurgomatic Date: Fri, 24 Jun 2011 23:30:27 +0000 Subject: [PATCH] - Moved passability flags from atom/var/flags to atom/var/pass_flags. Currently there are three - PASSTABLE, PASSGLASS and PASSGRILLE. PASSTABLE - same as TABLEPASS, PASSGRILLE - can this atom pass through grilles and PASSGLASS - can this atom pass through windows, glass doors, etc. Most can_pass() procs were updated. Added checkpass atom proc to check if this atom has certain pass_flag set. - Added proc/sanitize_simple() and proc/strip_html_simple(). sanitize_simple does not html_encode the string and strip_html_simple does not sanitize it. Additionally, sanitize_simple and sanitize can take associative list of key-val chars as second argument, where key is char to searh for and val is replacement. - Added datum/gas_mixture/proc/return_volume() and datum/gas_mixture/proc/return_temperature(). - Added proc/tg_text2list() and proc/tg_list2text(). tg_list2text is slower then dd_list2text, but processes associative lists differently (it adds not the keys, but associated values). tg_text2list is somewhat faster then dd_text2list. - Added proc/listclearnulls(), proc/difflist(), proc/intersectlist() and proc/uniquemergelist(). Check the code comments for more info. - Mechs can hold 3 equipment pieces. Gygax can hold 4. - Tweaked global_iterator CRASH report. - Fixed mech pilot ejection if mecha was destroyed. - Fixed mech fabricator process() waiting for sync() to finish. - Fixed mech fabricator Topic() waiting for process_queue() to finish. - Some bugixes related to global map and random sectors. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1722 316c924e-a436-60f5-8080-3fe189b3f50e --- code/FEA/FEA_gas_mixture.dm | 6 + code/WorkInProgress/optics/beam.dm | 3 +- .../helper_datums/construction_datum.dm | 7 +- code/datums/helper_datums/global_iterator.dm | 9 +- code/defines/atom.dm | 1 + code/defines/obj.dm | 2 + code/defines/procs/helpers.dm | 160 ++++++++++++++---- code/game/asteroid/asteroid.dm | 6 +- code/game/atom_procs.dm | 7 +- code/game/gamemodes/meteor/meteors.dm | 2 + code/game/machinery/OpTable.dm | 8 +- code/game/machinery/deployable.dm | 4 +- code/game/machinery/doors/door.dm | 2 +- code/game/machinery/doors/windowdoor.dm | 4 +- code/game/machinery/shieldgen.dm | 2 +- code/game/mecha/combat/gygax.dm | 2 +- code/game/mecha/combat/honker.dm | 13 +- code/game/mecha/mech_fabricator.dm | 23 ++- code/game/mecha/mecha.dm | 53 +++--- code/game/objects/grille.dm | 3 +- code/game/objects/items/weapons/guns_new.dm | 1 + code/game/objects/tables_racks.dm | 5 +- code/game/objects/window.dm | 7 +- code/game/supplyshuttle.dm | 4 +- code/setup.dm | 5 + 25 files changed, 224 insertions(+), 115 deletions(-) diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index a823fb624c1..b17b36d89dd 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -93,6 +93,12 @@ datum return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume return 0 + return_temperature() + return temperature + + return_volume() + return max(0, volume) + thermal_energy() return temperature*heat_capacity() diff --git a/code/WorkInProgress/optics/beam.dm b/code/WorkInProgress/optics/beam.dm index 16466ab96df..f63a6080c17 100644 --- a/code/WorkInProgress/optics/beam.dm +++ b/code/WorkInProgress/optics/beam.dm @@ -7,9 +7,8 @@ icon_state = "full" density = 0 mouse_opacity = 0 - + pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE flags = TABLEPASS - var/wavelength // the (vaccuum) wavelength of the beam var/width = 1 // 1=thin, 2=medium, 3=wide diff --git a/code/datums/helper_datums/construction_datum.dm b/code/datums/helper_datums/construction_datum.dm index bbcccd16476..a7a3981c58c 100644 --- a/code/datums/helper_datums/construction_datum.dm +++ b/code/datums/helper_datums/construction_datum.dm @@ -50,7 +50,7 @@ if(istype(used_atom, text2path(L["key"]))) if(custom_action(i, used_atom, user)) steps[i]=null;//stupid byond list from list removal... - clear_nulls(steps); + listclearnulls(steps); if(!steps.len) spawn_result() return 1 @@ -64,11 +64,6 @@ del holder return - proc/clear_nulls(list/L) - while(null in L) - L -= null - return - proc/set_desc(index as num) var/list/step = steps[index] holder.desc = step["desc"] diff --git a/code/datums/helper_datums/global_iterator.dm b/code/datums/helper_datums/global_iterator.dm index 9f3d3f21f6b..4ce4cf0d55d 100644 --- a/code/datums/helper_datums/global_iterator.dm +++ b/code/datums/helper_datums/global_iterator.dm @@ -71,8 +71,7 @@ Data storage vars: while(src && control_switch) last_exec = world.timeofday if(check_for_null && has_null_args()) - spawn(-1) //don't wait for state_check() in stop() - stop() + stop() return 0 result = process(arglist(arg_list)) for(var/sleep_time=delay;sleep_time>0;sleep_time--) //uhh, this is ugly. But I see no other way to terminate sleeping proc. Such disgrace. @@ -98,10 +97,8 @@ Data storage vars: if(!active()) return control_switch = 0 -/* //always fails if called inside process() - if(!state_check()) - return -*/ + spawn(-1) //report termination error but don't wait for state_check(). + state_check() return 1 proc/state_check() diff --git a/code/defines/atom.dm b/code/defines/atom.dm index d6c1c119329..6ef4f705bf3 100644 --- a/code/defines/atom.dm +++ b/code/defines/atom.dm @@ -8,6 +8,7 @@ var/blood_DNA = null var/blood_type = null var/last_bumped = 0 + var/pass_flags = 0 ///Chemistry. var/datum/reagents/reagents = null diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 373974cdb6b..1af671c8d3c 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -71,6 +71,7 @@ name = "beam" unacidable = 1//Just to be sure. var/def_zone + pass_flags = PASSTABLE /obj/beam/i_beam name = "i beam" @@ -304,6 +305,7 @@ var/force_unwielded = 0 var/force_wielded = 0 flags = FPRINT | TABLEPASS + pass_flags = PASSTABLE pressure_resistance = 50 var/obj/item/master = null diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index 07a919d0ad5..f6ad486da1c 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -117,47 +117,32 @@ K += item return K -/proc/sanitize(var/t) - var/index = findtext(t, "\n") - while(index) - t = copytext(t, 1, index) + "#" + copytext(t, index+1) - index = findtext(t, "\n") +/proc/sanitize_simple(var/t,var/list/repl_chars = list("\n"="#","\t"="#","ÿ"="ß")) + for(var/char in repl_chars) + var/index = findtext(t, char) + while(index) + t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index+1) + index = findtext(t, char) + return t - index = findtext(t, "\t") - while(index) - t = copytext(t, 1, index) + "#" + copytext(t, index+1) - index = findtext(t, "\t") +/proc/strip_html_simple(var/t,var/limit=MAX_MESSAGE_LEN) + var/list/strip_chars = list("<",">") + t = copytext(t,1,limit) + for(var/char in strip_chars) + var/index = findtext(t, char) + while(index) + t = copytext(t, 1, index) + copytext(t, index+1) + index = findtext(t, char) + return t - index = findtext(t, "ÿ") - while(index) - t = copytext(t, 1, index) + "ß" + copytext(t, index+1) - index = findtext(t, "ÿ") - - return html_encode(t) +/proc/sanitize(var/t,var/list/repl_chars = null) + return html_encode(sanitize_simple(t,repl_chars)) /proc/strip_html(var/t,var/limit=MAX_MESSAGE_LEN) - t = copytext(t,1,limit) - var/index = findtext(t, "<") - while(index) - t = copytext(t, 1, index) + copytext(t, index+1) - index = findtext(t, "<") - index = findtext(t, ">") - while(index) - t = copytext(t, 1, index) + copytext(t, index+1) - index = findtext(t, ">") - return sanitize(t) + return sanitize(strip_html_simple(t)) /proc/adminscrub(var/t,var/limit=MAX_MESSAGE_LEN) - t = copytext(t,1,limit) - var/index = findtext(t, "<") - while(index) - t = copytext(t, 1, index) + copytext(t, index+1) - index = findtext(t, "<") - index = findtext(t, ">") - while(index) - t = copytext(t, 1, index) + copytext(t, index+1) - index = findtext(t, ">") - return html_encode(t) + return html_encode(strip_html_simple(t)) /proc/add_zero(t, u) while (length(t) < u) @@ -310,6 +295,57 @@ count++ return newText +//slower then dd_list2text, but correctly processes associative lists. +proc/tg_list2text(list/list, glue=",") + if(!istype(list) || !list.len) + return + var/output + for(var/i=1 to list.len) + output += (i!=1? glue : null)+(!isnull(list["[list[i]]"])?"[list["[list[i]]"]]":"[list[i]]") + return output + + +//tg_text2list is faster then dd_text2list +//not case sensitive version +proc/tg_text2list(string, separator=",") + if(!string) + return + var/list/output = new + var/seplength = length(separator) + var/strlength = length(string) + var/prev = 1 + var/index + do + index = findtext(string, separator, prev, 0) + output += copytext(string, prev, index) + if(!index) + break + prev = index+seplength + if(prev>strlength) + break + while(index) + return output + +//case sensitive version +proc/tg_extext2list(string, separator=",") + if(!string) + return + var/list/output = new + var/seplength = length(separator) + var/strlength = length(string) + var/prev = 1 + var/index + do + index = findtextEx(string, separator, prev, 0) + output += copytext(string, prev, index) + if(!index) + break + prev = index+seplength + if(prev>strlength) + break + while(index) + return output + /proc/english_list(var/list/input, nothing_text = "nothing", and_text = " and ", comma_text = ", ", final_comma_text = "," ) var/total = input.len if (!total) @@ -1021,7 +1057,7 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl proc/listgetindex(var/list/list,index) if(istype(list) && list.len) if(isnum(index)) - if(index>0 && index<=list.len) + if(InRange(index,1,list.len)) return list[index] else if(index in list) return list[index] @@ -1042,6 +1078,12 @@ proc/clearlist(list/list) list.len = 0 return +proc/listclearnulls(list/list) + if(istype(list)) + while(null in list) + list -= null + return + /atom/proc/GetAllContents(searchDepth = 5) var/list/toReturn = list() @@ -1050,4 +1092,48 @@ proc/clearlist(list/list) if(part.contents.len && searchDepth) toReturn += part.GetAllContents(searchDepth - 1) - return toReturn \ No newline at end of file + return toReturn + + +//WIP + +/* + * Returns list containing all the entries present in both lists + * If either of arguments is not a list, returns null + */ +/proc/intersectlist(var/list/first, var/list/second) + if(!islist(first) || !islist(second)) + return + return first & second + +/* + * Returns list containing all the entries from first list that are not present in second. + * If skiprep = 1, repeated elements are treated as one. + * If either of arguments is not a list, returns null + */ +/proc/difflist(var/list/first, var/list/second, var/skiprep=0) + if(!islist(first) || !islist(second)) + return + var/list/result = new + if(skiprep) + for(var/e in first) + if(!(e in result) && !(e in second)) + result += e + else + result = first - second + return result + +/* + * Returns list containing entries that are in either list but not both. + * If skipref = 1, repeated elements are treated as one. + * If either of arguments is not a list, returns null + */ +/proc/uniquemergelist(var/list/first, var/list/second, var/skiprep=0) + if(!islist(first) || !islist(second)) + return + var/list/result = new + if(skiprep) + result = difflist(first, second, skiprep)+difflist(second, first, skiprep) + else + result = first ^ second + return result diff --git a/code/game/asteroid/asteroid.dm b/code/game/asteroid/asteroid.dm index 86f1fed15fc..b3bfab3c749 100644 --- a/code/game/asteroid/asteroid.dm +++ b/code/game/asteroid/asteroid.dm @@ -1,4 +1,4 @@ -proc/spawn_asteroid(var/atom/start_loc,var/type,var/size,var/richness)//type: 0 or null - random, 1 - nothing, 2 - iron, 3 - silicon +proc/spawn_asteroid(var/turf/start_loc,var/type,var/size,var/richness)//type: 0 or null - random, 1 - nothing, 2 - iron, 3 - silicon if(!size) size = pick(100;2,50;3,35;4,25;6,10;12) if(start_loc.x - size < 5 || start_loc.x + size >= world.maxx - 5 || start_loc.y - size < 5 || start_loc.y + size > world.maxy -5) @@ -9,6 +9,8 @@ proc/spawn_asteroid(var/atom/start_loc,var/type,var/size,var/richness)//type: 0 richness = rand(10,40) // world << "Asteroid size: [size]; Asteroid type: [type]" var/list/turfs = circlerangeturfs(start_loc,size) + if(!islist(turfs) || isemptylist(turfs)) + return 0 var/area/asteroid/AstAr = new AstAr.name = "Asteroid #[start_loc.x][start_loc.y][start_loc.z]" for(var/turf/T in turfs) @@ -45,7 +47,7 @@ proc/spawn_asteroid(var/atom/start_loc,var/type,var/size,var/richness)//type: 0 var/y = rand(1,world.maxy) // world << "Asteroid coords: [x], [y], [z]" var/start_loc = locate(x,y,z) - if(spawn_asteroid(start_loc)) + if(start_loc && spawn_asteroid(start_loc)) density-- return diff --git a/code/game/atom_procs.dm b/code/game/atom_procs.dm index 3a3278d1a03..b288eacbc35 100644 --- a/code/game/atom_procs.dm +++ b/code/game/atom_procs.dm @@ -404,7 +404,7 @@ /atom/proc/get_global_map_pos() - if(!global_map.len) return + if(!islist(global_map) || isemptylist(global_map)) return var/cur_x = null var/cur_y = null var/list/y_arr = null @@ -417,4 +417,7 @@ if(cur_x && cur_y) return list("x"=cur_x,"y"=cur_y) else - return 0 \ No newline at end of file + return 0 + +/atom/proc/checkpass(passflag) + return pass_flags&passflag \ No newline at end of file diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 9d3d7c3efba..32c59606828 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -88,10 +88,12 @@ anchored = 1.0 var/hits = 1 var/dest + pass_flags = PASSTABLE /obj/meteor/small name = "small meteor" icon_state = "smallf" + pass_flags = PASSTABLE | PASSGRILLE /obj/meteor/Move() var/turf/T = src.loc diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index e2eebf61fb7..ff295072a57 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -63,13 +63,7 @@ /obj/machinery/optable/CanPass(atom/movable/O as mob|obj, target as turf) - if(!O) - return 0 - if ((O.flags & 2 || istype(O, /obj/meteor))) - return 1 - else - return 0 - return + return (istype(O) && O.checkpass(PASSTABLE)) /obj/machinery/optable/MouseDrop_T(obj/O as obj, mob/user as mob) diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index 8aca2cf99c6..e0232b461ae 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -133,7 +133,7 @@ for reference: CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff. if(air_group || (height==0)) return 1 - if (mover.flags & 2) + if(istype(mover) && mover.checkpass(PASSTABLE)) return 1 else return 0 @@ -269,7 +269,7 @@ These should not block bullets/N */ CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff. if(air_group || (height==0)) return 1 - if (mover.flags & 2) + if(istype(mover) && mover.checkpass(PASSTABLE)) return 1 else return 0 diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 4c356242c96..b5b5876c09f 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -49,7 +49,7 @@ /obj/machinery/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group) return 0 - if(istype(mover, /obj/beam)) + if(istype(mover) && mover.checkpass(PASSGLASS)) return !opacity return !density diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index d7f02d2bba9..5a276a2dbe7 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -59,7 +59,7 @@ return /obj/machinery/door/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(istype(mover, /obj/beam)) + if(istype(mover) && mover.checkpass(PASSGLASS)) return 1 if(get_dir(loc, target) == dir) //Make sure looking at appropriate border if(air_group) return 0 @@ -68,7 +68,7 @@ return 1 /obj/machinery/door/window/CheckExit(atom/movable/mover as mob|obj, turf/target as turf) - if(istype(mover, /obj/beam)) + if(istype(mover) && mover.checkpass(PASSGLASS)) return 1 if(get_dir(loc, target) == dir) return !density diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index d862a25ae26..ad0bb42efd2 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -526,7 +526,7 @@ /obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group || (height==0)) return 1 - if ((istype(mover, /obj/item/weapon/dummy) || istype(mover, /obj/beam))) + if(istype(mover) && mover.checkpass(PASSGLASS)) return prob(20) else if (istype(mover, /obj/item/projectile)) diff --git a/code/game/mecha/combat/gygax.dm b/code/game/mecha/combat/gygax.dm index 7ceb6c1c0a2..52b04e13ddc 100644 --- a/code/game/mecha/combat/gygax.dm +++ b/code/game/mecha/combat/gygax.dm @@ -10,7 +10,7 @@ var/overload = 0 wreckage = "/obj/decal/mecha_wreckage/gygax" internal_damage_threshold = 35 - max_equip = 3 + max_equip = 4 /* diff --git a/code/game/mecha/combat/honker.dm b/code/game/mecha/combat/honker.dm index 49d64f113f0..f79ae49cc1b 100644 --- a/code/game/mecha/combat/honker.dm +++ b/code/game/mecha/combat/honker.dm @@ -11,10 +11,12 @@ operation_req_access = list(access_clown) add_req_access = 0 max_equip = 3 + var/squeak = 0 +/* /obj/mecha/combat/honker/New() ..() -/* + weapons += new /datum/mecha_weapon/honker(src) weapons += new /datum/mecha_weapon/missile_rack/banana_mortar(src) weapons += new /datum/mecha_weapon/missile_rack/mousetrap_mortar(src) @@ -38,6 +40,7 @@ [internal_damage&MECHA_INT_CONTROL_LOST?"HONK-A-DOODLE - Recalibrate
":null] IntegriHONK: [health/initial(health)*100] %)
PowerHONK charge: [isnull(cell_charge)?"Someone HONKed powerHonk!!!":"[cell.percent()]%"])
+ Air source: [use_internal_tank?"Internal AirHONK":"EnvironHONK"]
AirHONK pressure: [src.return_pressure()]HoNKs
Internal HONKature: [src.return_temperature()]°honK|[src.return_temperature() - T0C]°honCk
Lights: [lights?"on":"off"]
@@ -120,9 +123,13 @@ /obj/mecha/combat/honker/relaymove(mob/user,direction) - var/result = ..(user,direction) + var/result = ..() if(result) - playsound(src, "clownstep", 70, 1) + if(!squeak) + playsound(src, "clownstep", 70, 1) + squeak = 1 + else + squeak = 0 return result diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index bba539dda99..0de023d3f9b 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -94,7 +94,7 @@ /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster, /obj/item/mecha_parts/mecha_equipment/repair_droid, /obj/item/mecha_parts/mecha_equipment/tesla_energy_relay - ), + ), "Misc"=list(/obj/item/mecha_tracking) @@ -105,10 +105,12 @@ for(var/part_set in part_sets) convert_part_set(part_set) files = new /datum/research(src) //Setup the research data holder. + /* if(!id) for(var/obj/machinery/r_n_d/server/centcom/S in world) S.initialize() break + */ return Del() @@ -251,8 +253,9 @@ proc/add_part_set_to_queue(set_name) if(set_name in part_sets) var/list/part_set = part_sets[set_name] - for(var/part in part_set) - add_to_queue(part) + if(islist(part_set)) + for(var/part in part_set) + add_to_queue(part) return proc/add_to_queue(part) @@ -332,7 +335,7 @@ if(!silent) temp = "Updating local R&D database..." src.updateUsrDialog() - sleep(30) + sleep(30) //only sleep if called by user for(var/obj/machinery/computer/rdconsole/RDC in get_area(src)) if(!RDC.sync) continue @@ -448,9 +451,10 @@ if(href_list["process_queue"]) if(processing_queue || being_built) return 0 - processing_queue = 1 - process_queue() - processing_queue = 0 + spawn(-1) //don't wait for process_queue() to finish + processing_queue = 1 + process_queue() + processing_queue = 0 /* if(href_list["list_queue"]) list_queue() @@ -463,7 +467,7 @@ var/index = text2num(href_list["index"]) var/new_index = index + text2num(href_list["queue_move"]) if(isnum(index) && isnum(new_index)) - if(new_index>0&&new_index<=queue.len) + if(InRange(new_index,1,queue.len)) queue.Swap(index,new_index) return update_queue_on_page() if(href_list["clear_queue"]) @@ -487,7 +491,8 @@ if (stat & (NOPOWER|BROKEN)) return if(sync) - src.sync(1) + spawn(-1) + sync(1) return attackby(obj/item/stack/sheet/W as obj, mob/user as mob) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index a372c432080..6e9d4de1df6 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -64,7 +64,7 @@ var/list/equipment = new var/obj/item/mecha_parts/mecha_equipment/selected - var/max_equip = 2 + var/max_equip = 3 /obj/mecha/New() ..() @@ -418,31 +418,33 @@ /obj/mecha/proc/destroy() spawn() + go_out() var/turf/T = get_turf(src) tag = "\ref[src]" //better safe then sorry loc.Exited(src) loc = null - if(prob(40)) - explosion(T, 0, 0, 1, 3) - if(wreckage) - var/obj/decal/mecha_wreckage/WR = new wreckage(T) - for(var/obj/item/mecha_parts/mecha_equipment/E in equipment) - if(prob(30)) - WR.crowbar_salvage += E - E.loc = WR - E.equip_ready = 1 - E.reliability = rand(30,100) - else - E.loc = T - E.destroy() - if(cell) - WR.crowbar_salvage += cell - cell.loc = WR - cell.charge = rand(0, cell.charge) - if(internal_tank) - WR.crowbar_salvage += internal_tank - internal_tank.loc = WR - del(src) + if(T) + if(prob(40)) + explosion(T, 0, 0, 1, 3) + if(wreckage) + var/obj/decal/mecha_wreckage/WR = new wreckage(T) + for(var/obj/item/mecha_parts/mecha_equipment/E in equipment) + if(prob(30)) + WR.crowbar_salvage += E + E.loc = WR + E.equip_ready = 1 + E.reliability = rand(30,100) + else + E.loc = T + E.destroy() + if(cell) + WR.crowbar_salvage += cell + cell.loc = WR + cell.charge = rand(0, cell.charge) + if(internal_tank) + WR.crowbar_salvage += internal_tank + internal_tank.loc = WR + del(src) return /obj/mecha/ex_act(severity) @@ -1161,7 +1163,7 @@ onclose(occupant, "exosuit_log") return if (href_list["change_name"]) - name = input(occupant,"Choose new exosuit name","Rename exosuit",initial(name)) + name = strip_html_simple(input(occupant,"Choose new exosuit name","Rename exosuit",initial(name))) return if (href_list["repair_int_control_lost"]) src.occupant_message("Recalibrating coordination system.") @@ -1362,5 +1364,8 @@ if(mecha.internal_damage & MECHA_INT_TANK_BREACH) //remove some air from internal tank if(int_tank_air) var/datum/gas_mixture/leaked_gas = int_tank_air.remove_ratio(0.25) - mecha.loc.assume_air(leaked_gas) + if(mecha.loc && hascall(mecha.loc,"assume_air")) + mecha.loc.assume_air(leaked_gas) + else + del(leaked_gas) return diff --git a/code/game/objects/grille.dm b/code/game/objects/grille.dm index 78d77e49fe6..3dac6343d99 100644 --- a/code/game/objects/grille.dm +++ b/code/game/objects/grille.dm @@ -75,8 +75,7 @@ /obj/grille/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group || (height==0)) return 1 - - if ((istype(mover, /obj/effects) || istype(mover, /obj/item/weapon/dummy) || istype(mover, /obj/beam) || istype(mover, /obj/meteor/small))) + if(istype(mover) && mover.checkpass(PASSGRILLE)) return 1 else if (istype(mover, /obj/item/projectile)) diff --git a/code/game/objects/items/weapons/guns_new.dm b/code/game/objects/items/weapons/guns_new.dm index ca272f94525..7118b440b35 100644 --- a/code/game/objects/items/weapons/guns_new.dm +++ b/code/game/objects/items/weapons/guns_new.dm @@ -36,6 +36,7 @@ var/const/PROJECTILE_DART = 8 name = "laser" damage_type = PROJECTILE_LASER icon_state = "laser" + pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE pulse name = "pulse" diff --git a/code/game/objects/tables_racks.dm b/code/game/objects/tables_racks.dm index 46d3ae15658..e2d0ccf9db8 100644 --- a/code/game/objects/tables_racks.dm +++ b/code/game/objects/tables_racks.dm @@ -94,7 +94,7 @@ TABLE AND RACK OBJECT INTERATIONS /obj/table/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group || (height==0)) return 1 - if ((mover.flags & 2 || istype(mover, /obj/meteor)) ) + if(istype(mover) && mover.checkpass(PASSTABLE)) return 1 else return 0 @@ -293,8 +293,7 @@ TABLE AND RACK OBJECT INTERATIONS /obj/rack/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group || (height==0)) return 1 - - if (mover.flags & 2) + if(istype(mover) && mover.checkpass(PASSTABLE)) return 1 else return 0 diff --git a/code/game/objects/window.dm b/code/game/objects/window.dm index df610de59ef..40e57b0e65b 100644 --- a/code/game/objects/window.dm +++ b/code/game/objects/window.dm @@ -43,20 +43,19 @@ del(src) /obj/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(istype(mover, /obj/beam) || istype(mover, /obj/item/projectile/beam)) + if(istype(mover) && mover.checkpass(PASSGLASS)) return 1 if (src.dir == SOUTHWEST || src.dir == SOUTHEAST || src.dir == NORTHWEST || src.dir == NORTHEAST) return 0 //full tile window, you can't move into it! if(get_dir(loc, target) == dir) - return !density else return 1 /obj/window/CheckExit(atom/movable/O as mob|obj, target as turf) - if(istype(O, /obj/beam) || istype(O, /obj/item/projectile/beam)) + if(istype(O) && O.checkpass(PASSGLASS)) return 1 - if (get_dir(O.loc, target) == src.dir) + if (get_dir(O.loc, target) == dir) return 0 return 1 diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index a09ed6ff1a0..8388660ff72 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -45,7 +45,9 @@ var/ordernum=0 layer = 4 /obj/plasticflaps/CanPass(atom/A, turf/T) - if (istype(A, /mob/living)) // You Shall Not Pass! + if(istype(A) && A.checkpass(PASSGLASS)) + return prob(60) + else if(istype(A, /mob/living)) // You Shall Not Pass! var/mob/living/M = A if(!M.lying) // unless you're lying down return 0 diff --git a/code/setup.dm b/code/setup.dm index 295af4a6f52..0a359ff7c5e 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -113,6 +113,11 @@ #define NOREACT 16384 //Reagents dont' react inside this container. +//flags for pass_flags +#define PASSTABLE 1 +#define PASSGLASS 2 +#define PASSGRILLE 4 + // bitflags for clothing parts #define HEAD 1