- 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
This commit is contained in:
panurgomatic
2011-06-24 23:30:27 +00:00
parent af95e5a8a1
commit 15a5ecdd06
25 changed files with 224 additions and 115 deletions

View File

@@ -93,6 +93,12 @@ datum
return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume
return 0 return 0
return_temperature()
return temperature
return_volume()
return max(0, volume)
thermal_energy() thermal_energy()
return temperature*heat_capacity() return temperature*heat_capacity()

View File

@@ -7,9 +7,8 @@
icon_state = "full" icon_state = "full"
density = 0 density = 0
mouse_opacity = 0 mouse_opacity = 0
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
flags = TABLEPASS flags = TABLEPASS
var/wavelength // the (vaccuum) wavelength of the beam var/wavelength // the (vaccuum) wavelength of the beam
var/width = 1 // 1=thin, 2=medium, 3=wide var/width = 1 // 1=thin, 2=medium, 3=wide

View File

@@ -50,7 +50,7 @@
if(istype(used_atom, text2path(L["key"]))) if(istype(used_atom, text2path(L["key"])))
if(custom_action(i, used_atom, user)) if(custom_action(i, used_atom, user))
steps[i]=null;//stupid byond list from list removal... steps[i]=null;//stupid byond list from list removal...
clear_nulls(steps); listclearnulls(steps);
if(!steps.len) if(!steps.len)
spawn_result() spawn_result()
return 1 return 1
@@ -64,11 +64,6 @@
del holder del holder
return return
proc/clear_nulls(list/L)
while(null in L)
L -= null
return
proc/set_desc(index as num) proc/set_desc(index as num)
var/list/step = steps[index] var/list/step = steps[index]
holder.desc = step["desc"] holder.desc = step["desc"]

View File

@@ -71,8 +71,7 @@ Data storage vars:
while(src && control_switch) while(src && control_switch)
last_exec = world.timeofday last_exec = world.timeofday
if(check_for_null && has_null_args()) if(check_for_null && has_null_args())
spawn(-1) //don't wait for state_check() in stop() stop()
stop()
return 0 return 0
result = process(arglist(arg_list)) 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. 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()) if(!active())
return return
control_switch = 0 control_switch = 0
/* //always fails if called inside process() spawn(-1) //report termination error but don't wait for state_check().
if(!state_check()) state_check()
return
*/
return 1 return 1
proc/state_check() proc/state_check()

View File

@@ -8,6 +8,7 @@
var/blood_DNA = null var/blood_DNA = null
var/blood_type = null var/blood_type = null
var/last_bumped = 0 var/last_bumped = 0
var/pass_flags = 0
///Chemistry. ///Chemistry.
var/datum/reagents/reagents = null var/datum/reagents/reagents = null

View File

@@ -71,6 +71,7 @@
name = "beam" name = "beam"
unacidable = 1//Just to be sure. unacidable = 1//Just to be sure.
var/def_zone var/def_zone
pass_flags = PASSTABLE
/obj/beam/i_beam /obj/beam/i_beam
name = "i beam" name = "i beam"
@@ -304,6 +305,7 @@
var/force_unwielded = 0 var/force_unwielded = 0
var/force_wielded = 0 var/force_wielded = 0
flags = FPRINT | TABLEPASS flags = FPRINT | TABLEPASS
pass_flags = PASSTABLE
pressure_resistance = 50 pressure_resistance = 50
var/obj/item/master = null var/obj/item/master = null

View File

@@ -117,47 +117,32 @@
K += item K += item
return K return K
/proc/sanitize(var/t) /proc/sanitize_simple(var/t,var/list/repl_chars = list("\n"="#","\t"="#","<22>"="<22>"))
var/index = findtext(t, "\n") for(var/char in repl_chars)
while(index) var/index = findtext(t, char)
t = copytext(t, 1, index) + "#" + copytext(t, index+1) while(index)
index = findtext(t, "\n") t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index+1)
index = findtext(t, char)
return t
index = findtext(t, "\t") /proc/strip_html_simple(var/t,var/limit=MAX_MESSAGE_LEN)
while(index) var/list/strip_chars = list("<",">")
t = copytext(t, 1, index) + "#" + copytext(t, index+1) t = copytext(t,1,limit)
index = findtext(t, "\t") 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, "<22>") /proc/sanitize(var/t,var/list/repl_chars = null)
while(index) return html_encode(sanitize_simple(t,repl_chars))
t = copytext(t, 1, index) + "<22>" + copytext(t, index+1)
index = findtext(t, "<22>")
return html_encode(t)
/proc/strip_html(var/t,var/limit=MAX_MESSAGE_LEN) /proc/strip_html(var/t,var/limit=MAX_MESSAGE_LEN)
t = copytext(t,1,limit) return sanitize(strip_html_simple(t))
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)
/proc/adminscrub(var/t,var/limit=MAX_MESSAGE_LEN) /proc/adminscrub(var/t,var/limit=MAX_MESSAGE_LEN)
t = copytext(t,1,limit) return html_encode(strip_html_simple(t))
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)
/proc/add_zero(t, u) /proc/add_zero(t, u)
while (length(t) < u) while (length(t) < u)
@@ -310,6 +295,57 @@
count++ count++
return newText 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 = "," ) /proc/english_list(var/list/input, nothing_text = "nothing", and_text = " and ", comma_text = ", ", final_comma_text = "," )
var/total = input.len var/total = input.len
if (!total) 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) proc/listgetindex(var/list/list,index)
if(istype(list) && list.len) if(istype(list) && list.len)
if(isnum(index)) if(isnum(index))
if(index>0 && index<=list.len) if(InRange(index,1,list.len))
return list[index] return list[index]
else if(index in list) else if(index in list)
return list[index] return list[index]
@@ -1042,6 +1078,12 @@ proc/clearlist(list/list)
list.len = 0 list.len = 0
return return
proc/listclearnulls(list/list)
if(istype(list))
while(null in list)
list -= null
return
/atom/proc/GetAllContents(searchDepth = 5) /atom/proc/GetAllContents(searchDepth = 5)
var/list/toReturn = list() var/list/toReturn = list()
@@ -1050,4 +1092,48 @@ proc/clearlist(list/list)
if(part.contents.len && searchDepth) if(part.contents.len && searchDepth)
toReturn += part.GetAllContents(searchDepth - 1) toReturn += part.GetAllContents(searchDepth - 1)
return toReturn 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

View File

@@ -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) if(!size)
size = pick(100;2,50;3,35;4,25;6,10;12) 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) 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) richness = rand(10,40)
// world << "Asteroid size: [size]; Asteroid type: [type]" // world << "Asteroid size: [size]; Asteroid type: [type]"
var/list/turfs = circlerangeturfs(start_loc,size) var/list/turfs = circlerangeturfs(start_loc,size)
if(!islist(turfs) || isemptylist(turfs))
return 0
var/area/asteroid/AstAr = new var/area/asteroid/AstAr = new
AstAr.name = "Asteroid #[start_loc.x][start_loc.y][start_loc.z]" AstAr.name = "Asteroid #[start_loc.x][start_loc.y][start_loc.z]"
for(var/turf/T in turfs) 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) var/y = rand(1,world.maxy)
// world << "Asteroid coords: [x], [y], [z]" // world << "Asteroid coords: [x], [y], [z]"
var/start_loc = locate(x,y,z) var/start_loc = locate(x,y,z)
if(spawn_asteroid(start_loc)) if(start_loc && spawn_asteroid(start_loc))
density-- density--
return return

View File

@@ -404,7 +404,7 @@
/atom/proc/get_global_map_pos() /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_x = null
var/cur_y = null var/cur_y = null
var/list/y_arr = null var/list/y_arr = null
@@ -417,4 +417,7 @@
if(cur_x && cur_y) if(cur_x && cur_y)
return list("x"=cur_x,"y"=cur_y) return list("x"=cur_x,"y"=cur_y)
else else
return 0 return 0
/atom/proc/checkpass(passflag)
return pass_flags&passflag

View File

@@ -88,10 +88,12 @@
anchored = 1.0 anchored = 1.0
var/hits = 1 var/hits = 1
var/dest var/dest
pass_flags = PASSTABLE
/obj/meteor/small /obj/meteor/small
name = "small meteor" name = "small meteor"
icon_state = "smallf" icon_state = "smallf"
pass_flags = PASSTABLE | PASSGRILLE
/obj/meteor/Move() /obj/meteor/Move()
var/turf/T = src.loc var/turf/T = src.loc

View File

@@ -63,13 +63,7 @@
/obj/machinery/optable/CanPass(atom/movable/O as mob|obj, target as turf) /obj/machinery/optable/CanPass(atom/movable/O as mob|obj, target as turf)
if(!O) return (istype(O) && O.checkpass(PASSTABLE))
return 0
if ((O.flags & 2 || istype(O, /obj/meteor)))
return 1
else
return 0
return
/obj/machinery/optable/MouseDrop_T(obj/O as obj, mob/user as mob) /obj/machinery/optable/MouseDrop_T(obj/O as obj, mob/user as mob)

View File

@@ -133,7 +133,7 @@ for reference:
CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff. CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff.
if(air_group || (height==0)) if(air_group || (height==0))
return 1 return 1
if (mover.flags & 2) if(istype(mover) && mover.checkpass(PASSTABLE))
return 1 return 1
else else
return 0 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. CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff.
if(air_group || (height==0)) if(air_group || (height==0))
return 1 return 1
if (mover.flags & 2) if(istype(mover) && mover.checkpass(PASSTABLE))
return 1 return 1
else else
return 0 return 0

View File

@@ -49,7 +49,7 @@
/obj/machinery/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) /obj/machinery/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group) return 0 if(air_group) return 0
if(istype(mover, /obj/beam)) if(istype(mover) && mover.checkpass(PASSGLASS))
return !opacity return !opacity
return !density return !density

View File

@@ -59,7 +59,7 @@
return return
/obj/machinery/door/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) /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 return 1
if(get_dir(loc, target) == dir) //Make sure looking at appropriate border if(get_dir(loc, target) == dir) //Make sure looking at appropriate border
if(air_group) return 0 if(air_group) return 0
@@ -68,7 +68,7 @@
return 1 return 1
/obj/machinery/door/window/CheckExit(atom/movable/mover as mob|obj, turf/target as turf) /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 return 1
if(get_dir(loc, target) == dir) if(get_dir(loc, target) == dir)
return !density return !density

View File

@@ -526,7 +526,7 @@
/obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) /obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1 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) return prob(20)
else else
if (istype(mover, /obj/item/projectile)) if (istype(mover, /obj/item/projectile))

View File

@@ -10,7 +10,7 @@
var/overload = 0 var/overload = 0
wreckage = "/obj/decal/mecha_wreckage/gygax" wreckage = "/obj/decal/mecha_wreckage/gygax"
internal_damage_threshold = 35 internal_damage_threshold = 35
max_equip = 3 max_equip = 4
/* /*

View File

@@ -11,10 +11,12 @@
operation_req_access = list(access_clown) operation_req_access = list(access_clown)
add_req_access = 0 add_req_access = 0
max_equip = 3 max_equip = 3
var/squeak = 0
/*
/obj/mecha/combat/honker/New() /obj/mecha/combat/honker/New()
..() ..()
/*
weapons += new /datum/mecha_weapon/honker(src) weapons += new /datum/mecha_weapon/honker(src)
weapons += new /datum/mecha_weapon/missile_rack/banana_mortar(src) weapons += new /datum/mecha_weapon/missile_rack/banana_mortar(src)
weapons += new /datum/mecha_weapon/missile_rack/mousetrap_mortar(src) weapons += new /datum/mecha_weapon/missile_rack/mousetrap_mortar(src)
@@ -38,6 +40,7 @@
[internal_damage&MECHA_INT_CONTROL_LOST?"<font color='red'><b>HONK-A-DOODLE</b></font> - <a href='?src=\ref[src];repair_int_control_lost=1'>Recalibrate</a><br>":null] [internal_damage&MECHA_INT_CONTROL_LOST?"<font color='red'><b>HONK-A-DOODLE</b></font> - <a href='?src=\ref[src];repair_int_control_lost=1'>Recalibrate</a><br>":null]
<b>IntegriHONK: </b> [health/initial(health)*100] %) <br> <b>IntegriHONK: </b> [health/initial(health)*100] %) <br>
<b>PowerHONK charge: </b>[isnull(cell_charge)?"Someone HONKed powerHonk!!!":"[cell.percent()]%"])<br> <b>PowerHONK charge: </b>[isnull(cell_charge)?"Someone HONKed powerHonk!!!":"[cell.percent()]%"])<br>
<b>Air source: </b>[use_internal_tank?"Internal AirHONK":"EnvironHONK"]<br>
<b>AirHONK pressure: </b>[src.return_pressure()]HoNKs<br> <b>AirHONK pressure: </b>[src.return_pressure()]HoNKs<br>
<b>Internal HONKature: </b> [src.return_temperature()]&deg;honK|[src.return_temperature() - T0C]&deg;honCk<br> <b>Internal HONKature: </b> [src.return_temperature()]&deg;honK|[src.return_temperature() - T0C]&deg;honCk<br>
<b>Lights: </b>[lights?"on":"off"]<br> <b>Lights: </b>[lights?"on":"off"]<br>
@@ -120,9 +123,13 @@
/obj/mecha/combat/honker/relaymove(mob/user,direction) /obj/mecha/combat/honker/relaymove(mob/user,direction)
var/result = ..(user,direction) var/result = ..()
if(result) if(result)
playsound(src, "clownstep", 70, 1) if(!squeak)
playsound(src, "clownstep", 70, 1)
squeak = 1
else
squeak = 0
return result return result

View File

@@ -94,7 +94,7 @@
/obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster, /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster,
/obj/item/mecha_parts/mecha_equipment/repair_droid, /obj/item/mecha_parts/mecha_equipment/repair_droid,
/obj/item/mecha_parts/mecha_equipment/tesla_energy_relay /obj/item/mecha_parts/mecha_equipment/tesla_energy_relay
), ),
"Misc"=list(/obj/item/mecha_tracking) "Misc"=list(/obj/item/mecha_tracking)
@@ -105,10 +105,12 @@
for(var/part_set in part_sets) for(var/part_set in part_sets)
convert_part_set(part_set) convert_part_set(part_set)
files = new /datum/research(src) //Setup the research data holder. files = new /datum/research(src) //Setup the research data holder.
/*
if(!id) if(!id)
for(var/obj/machinery/r_n_d/server/centcom/S in world) for(var/obj/machinery/r_n_d/server/centcom/S in world)
S.initialize() S.initialize()
break break
*/
return return
Del() Del()
@@ -251,8 +253,9 @@
proc/add_part_set_to_queue(set_name) proc/add_part_set_to_queue(set_name)
if(set_name in part_sets) if(set_name in part_sets)
var/list/part_set = part_sets[set_name] var/list/part_set = part_sets[set_name]
for(var/part in part_set) if(islist(part_set))
add_to_queue(part) for(var/part in part_set)
add_to_queue(part)
return return
proc/add_to_queue(part) proc/add_to_queue(part)
@@ -332,7 +335,7 @@
if(!silent) if(!silent)
temp = "Updating local R&D database..." temp = "Updating local R&D database..."
src.updateUsrDialog() src.updateUsrDialog()
sleep(30) sleep(30) //only sleep if called by user
for(var/obj/machinery/computer/rdconsole/RDC in get_area(src)) for(var/obj/machinery/computer/rdconsole/RDC in get_area(src))
if(!RDC.sync) if(!RDC.sync)
continue continue
@@ -448,9 +451,10 @@
if(href_list["process_queue"]) if(href_list["process_queue"])
if(processing_queue || being_built) if(processing_queue || being_built)
return 0 return 0
processing_queue = 1 spawn(-1) //don't wait for process_queue() to finish
process_queue() processing_queue = 1
processing_queue = 0 process_queue()
processing_queue = 0
/* /*
if(href_list["list_queue"]) if(href_list["list_queue"])
list_queue() list_queue()
@@ -463,7 +467,7 @@
var/index = text2num(href_list["index"]) var/index = text2num(href_list["index"])
var/new_index = index + text2num(href_list["queue_move"]) var/new_index = index + text2num(href_list["queue_move"])
if(isnum(index) && isnum(new_index)) 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) queue.Swap(index,new_index)
return update_queue_on_page() return update_queue_on_page()
if(href_list["clear_queue"]) if(href_list["clear_queue"])
@@ -487,7 +491,8 @@
if (stat & (NOPOWER|BROKEN)) if (stat & (NOPOWER|BROKEN))
return return
if(sync) if(sync)
src.sync(1) spawn(-1)
sync(1)
return return
attackby(obj/item/stack/sheet/W as obj, mob/user as mob) attackby(obj/item/stack/sheet/W as obj, mob/user as mob)

View File

@@ -64,7 +64,7 @@
var/list/equipment = new var/list/equipment = new
var/obj/item/mecha_parts/mecha_equipment/selected var/obj/item/mecha_parts/mecha_equipment/selected
var/max_equip = 2 var/max_equip = 3
/obj/mecha/New() /obj/mecha/New()
..() ..()
@@ -418,31 +418,33 @@
/obj/mecha/proc/destroy() /obj/mecha/proc/destroy()
spawn() spawn()
go_out()
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
tag = "\ref[src]" //better safe then sorry tag = "\ref[src]" //better safe then sorry
loc.Exited(src) loc.Exited(src)
loc = null loc = null
if(prob(40)) if(T)
explosion(T, 0, 0, 1, 3) if(prob(40))
if(wreckage) explosion(T, 0, 0, 1, 3)
var/obj/decal/mecha_wreckage/WR = new wreckage(T) if(wreckage)
for(var/obj/item/mecha_parts/mecha_equipment/E in equipment) var/obj/decal/mecha_wreckage/WR = new wreckage(T)
if(prob(30)) for(var/obj/item/mecha_parts/mecha_equipment/E in equipment)
WR.crowbar_salvage += E if(prob(30))
E.loc = WR WR.crowbar_salvage += E
E.equip_ready = 1 E.loc = WR
E.reliability = rand(30,100) E.equip_ready = 1
else E.reliability = rand(30,100)
E.loc = T else
E.destroy() E.loc = T
if(cell) E.destroy()
WR.crowbar_salvage += cell if(cell)
cell.loc = WR WR.crowbar_salvage += cell
cell.charge = rand(0, cell.charge) cell.loc = WR
if(internal_tank) cell.charge = rand(0, cell.charge)
WR.crowbar_salvage += internal_tank if(internal_tank)
internal_tank.loc = WR WR.crowbar_salvage += internal_tank
del(src) internal_tank.loc = WR
del(src)
return return
/obj/mecha/ex_act(severity) /obj/mecha/ex_act(severity)
@@ -1161,7 +1163,7 @@
onclose(occupant, "exosuit_log") onclose(occupant, "exosuit_log")
return return
if (href_list["change_name"]) 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 return
if (href_list["repair_int_control_lost"]) if (href_list["repair_int_control_lost"])
src.occupant_message("Recalibrating coordination system.") 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(mecha.internal_damage & MECHA_INT_TANK_BREACH) //remove some air from internal tank
if(int_tank_air) if(int_tank_air)
var/datum/gas_mixture/leaked_gas = int_tank_air.remove_ratio(0.25) 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 return

View File

@@ -75,8 +75,7 @@
/obj/grille/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) /obj/grille/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1 if(air_group || (height==0)) return 1
if(istype(mover) && mover.checkpass(PASSGRILLE))
if ((istype(mover, /obj/effects) || istype(mover, /obj/item/weapon/dummy) || istype(mover, /obj/beam) || istype(mover, /obj/meteor/small)))
return 1 return 1
else else
if (istype(mover, /obj/item/projectile)) if (istype(mover, /obj/item/projectile))

View File

@@ -36,6 +36,7 @@ var/const/PROJECTILE_DART = 8
name = "laser" name = "laser"
damage_type = PROJECTILE_LASER damage_type = PROJECTILE_LASER
icon_state = "laser" icon_state = "laser"
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
pulse pulse
name = "pulse" name = "pulse"

View File

@@ -94,7 +94,7 @@ TABLE AND RACK OBJECT INTERATIONS
/obj/table/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) /obj/table/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1 if(air_group || (height==0)) return 1
if ((mover.flags & 2 || istype(mover, /obj/meteor)) ) if(istype(mover) && mover.checkpass(PASSTABLE))
return 1 return 1
else else
return 0 return 0
@@ -293,8 +293,7 @@ TABLE AND RACK OBJECT INTERATIONS
/obj/rack/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) /obj/rack/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1 if(air_group || (height==0)) return 1
if(istype(mover) && mover.checkpass(PASSTABLE))
if (mover.flags & 2)
return 1 return 1
else else
return 0 return 0

View File

@@ -43,20 +43,19 @@
del(src) del(src)
/obj/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) /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 return 1
if (src.dir == SOUTHWEST || src.dir == SOUTHEAST || src.dir == NORTHWEST || src.dir == NORTHEAST) if (src.dir == SOUTHWEST || src.dir == SOUTHEAST || src.dir == NORTHWEST || src.dir == NORTHEAST)
return 0 //full tile window, you can't move into it! return 0 //full tile window, you can't move into it!
if(get_dir(loc, target) == dir) if(get_dir(loc, target) == dir)
return !density return !density
else else
return 1 return 1
/obj/window/CheckExit(atom/movable/O as mob|obj, target as turf) /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 return 1
if (get_dir(O.loc, target) == src.dir) if (get_dir(O.loc, target) == dir)
return 0 return 0
return 1 return 1

View File

@@ -45,7 +45,9 @@ var/ordernum=0
layer = 4 layer = 4
/obj/plasticflaps/CanPass(atom/A, turf/T) /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 var/mob/living/M = A
if(!M.lying) // unless you're lying down if(!M.lying) // unless you're lying down
return 0 return 0

View File

@@ -113,6 +113,11 @@
#define NOREACT 16384 //Reagents dont' react inside this container. #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 // bitflags for clothing parts
#define HEAD 1 #define HEAD 1