Lots of runtime fixes

This commit is contained in:
D3athrow
2015-05-04 20:38:51 -05:00
parent 3337a952a2
commit 920d05c9e0
24 changed files with 94 additions and 26 deletions

View File

@@ -124,7 +124,7 @@
//This happens when windows move or are constructed. We need to rebuild.
if((previously_open & d) && istype(unsim, /turf/simulated))
var/turf/simulated/sim = unsim
if(sim.zone == zone)
if(istype(zone) && sim.zone == zone)
zone.rebuild()
return

View File

@@ -130,6 +130,8 @@ var/list/exclude = list("inhand_states", "loc", "locs", "parent_type", "vars", "
vars[key] = initial(vars[key])
/proc/isInTypes(atom/Object, types)
if(!Object)
return 0
var/prototype = Object.type
Object = null

View File

@@ -165,6 +165,9 @@
i = L.len
else
i--
if(i < L.len || i > L.len)
warning("[__FILE__]L[__LINE__]: [i] is outside of bounds for list, ([L.len])")
return
return L[i]
/*

View File

@@ -169,9 +169,18 @@ datum/hud/New(mob/owner)
if(!mymob.client)
return 0
var/ui_style = ui_style2icon(mymob.client.prefs.UI_style)
var/ui_color = mymob.client.prefs.UI_style_color
var/ui_alpha = mymob.client.prefs.UI_style_alpha
var/ui_style
var/ui_color
var/ui_alpha
if(!mymob.client.prefs)
ui_sytle = ui_style2icon("Midnight")
ui_color = null
ui_alpha = 255
else
ui_style = ui_style2icon(mymob.client.prefs.UI_style)
ui_color = mymob.client.prefs.UI_style_color
ui_alpha = mymob.client.prefs.UI_style_alpha
if(ishuman(mymob))
human_hud(ui_style, ui_color, ui_alpha) // Pass the player the UI style chosen in preferences

View File

@@ -15,6 +15,19 @@
else
var/turf/targetloc = get_turf(A)
var/area/targetarea = get_area(A)
if(!targetloc)
if(!targetarea)
return
var/list/turfs = list()
for(var/area/Ar in A.related)
for(var/turf/T in Ar)
if(T.density)
continue
turfs.Add(T)
targetloc = pick_n_take(turfs)
if(!T)
return
if(targetarea && targetarea.anti_ethereal && !isAdminGhost(usr))
usr << "<span class='sinister'>A dark forcefield prevents you from entering the area.<span>"
else

View File

@@ -70,6 +70,8 @@ var/list/uplink_items = list()
return 0
var/obj/I = spawn_item(get_turf(user), U, user)
if(!I)
return 0
var/icon/tempimage = icon(I.icon, I.icon_state)
end_icons += tempimage
var/tempstate = end_icons.len

View File

@@ -69,7 +69,7 @@ var/global/list/ghdel_profiling = list()
var/mob/living/M = hit_atom
M.hitby(src)
log_attack("<font color='red'>[hit_atom] ([M.ckey]) was hit by [src] thrown by ([src.fingerprintslast])</font>")
log_attack("<font color='red'>[hit_atom] ([M ? M.ckey : "what"]) was hit by [src] thrown by ([src.fingerprintslast])</font>")
else if(isobj(hit_atom))
var/obj/O = hit_atom

View File

@@ -177,6 +177,12 @@
iconholder = 1
egun = 1
reqpower = 200
if(!eprojectile || !projectile)
projectile = /obj/item/projectile/energy/electrode// if it hasn't been emagged, it uses normal taser shots
eprojectile = /obj/item/projectile/beam//If it has, going to kill mode
iconholder = 1
egun = 1
reqpower = 200
Destroy()
// deletes its own cover with it

View File

@@ -51,7 +51,7 @@
if(isrobot(user))
var/mob/living/silicon/robot/R = user
if(material_type && R.cell.charge)
if(R && R.cell && material_type && R.cell.charge)
var/modifier = MAT_COST_COMMON
if(initial(active_material.perunit) < 3750)
modifier = MAT_COST_MEDIUM

View File

@@ -29,7 +29,7 @@
/obj/item/weapon/gift/New(var/W)
..()
w_class = W
w_class = W.w_class
/obj/item/weapon/gift/attack_self(mob/user as mob)
user.drop_item(src)

View File

@@ -19,6 +19,7 @@
var/breakouttime = 1200 //Deciseconds = 120s = 2 minutes
/obj/item/weapon/handcuffs/attack(mob/living/carbon/C as mob, mob/user as mob)
if(!istype(C)) return
if(istype(src, /obj/item/weapon/handcuffs/cyborg) && isrobot(user))
if(!C.handcuffed)
var/turf/p_loc = user.loc

View File

@@ -643,8 +643,7 @@
if(G.reagents.reagent_list.len>1)
user << "<span class='warning'>The mixture is rejected by the tool.</span>"
return
var/datum/reagent/R = G.reagents.reagent_list[1]
if(R.id != "sacid")
if(!has_reagent("sacid", 1))
user << "<span class='warning'>The tool is not compatible with that.</span>"
return
else

View File

@@ -17,10 +17,16 @@
var/obj/item/wielding = null
/obj/item/offhand/dropped(user)
if(!wielding)
qdel(src)
return null
return wielding.unwield(user)
/obj/item/offhand/unwield(user)
if(!wielding)
qdel(src)
return null
return wielding.unwield(user)
/obj/item/offhand/preattack(atom/target, mob/user, proximity_flag, click_parameters)
@@ -32,6 +38,9 @@
return 1
/obj/item/offhand/attack_self(mob/user)
if(!wielding)
qdel(src)
return null
return wielding.unwield(user)
/obj/item/offhand/proc/attach_to(var/obj/item/I)

View File

@@ -23,9 +23,15 @@
return junction
/atom/proc/isSmoothableNeighbor(atom/A)
if(!A)
WARNING("[__FILE__]L[__LINE__]: atom/isSmoothableNeighbor given bad atom")
return 0
return isInTypes(A, canSmoothWith)
/turf/simulated/wall/isSmoothableNeighbor(atom/A)
if(!A)
WARNING("[__FILE__]L[__LINE__]: turf/isSmoothableNeighbor given bad atom")
return 0
if(isInTypes(A, canSmoothWith))
// COLON OPERATORS ARE TERRIBLE BUT I HAVE NO CHOICE
if(src.mineral == A:mineral)

View File

@@ -208,6 +208,7 @@
playsound(src, 'sound/items/Welder.ogg', 100, 1)
if(do_after(user, 100))
if(!istype(src)) return
playsound(src, 'sound/items/Welder.ogg', 100, 1)
user.visible_message("<span class='warning'>[user] slices through \the [src]'s outer plating.</span>", \
"<span class='notice'>You slice through \the [src]'s outer plating.</span>", \

View File

@@ -146,12 +146,13 @@ proc/getFlatIcon(atom/A, dir, cache=1, exact=0) // 1 = use cache, 2 = override c
if(I:name == "damage layer")
var/mob/living/carbon/human/H = A
for(var/datum/organ/external/O in H.organs)
if(!(O.status & ORGAN_DESTROYED))
if(O.damage_state == "00") continue
var/icon/DI
DI = H.get_damage_icon_part(O.damage_state, O.icon_name, (H.species.blood_color == "#A10808" ? "" : H.species.blood_color))
add.Blend(DI,ICON_OVERLAY)
if(istype(H))
for(var/datum/organ/external/O in H.organs)
if(!(O.status & ORGAN_DESTROYED))
if(O.damage_state == "00") continue
var/icon/DI
DI = H.get_damage_icon_part(O.damage_state, O.icon_name, (H.species.blood_color == "#A10808" ? "" : H.species.blood_color))
add.Blend(DI,ICON_OVERLAY)
if(!exact && iscarbon(A))
var/mob/living/carbon/C = A

View File

@@ -161,6 +161,8 @@ function SetMusic(url, time, volume) {
// Tell the player to play something via JS.
proc/send_update()
if(!(!owner.prefs))
return
if(!(owner.prefs.toggles & SOUND_STREAMING) && url != "")
return // Nope.
MP_DEBUG("<span class='good'>Sending update to VLC ([url])...</span>")

View File

@@ -38,11 +38,12 @@
if (source_turf in view(src))
message = "<B>[message]</B>"
else
if (isnull(radio_freq))
if (!(client.prefs.toggles & CHAT_GHOSTEARS))
return
else
if (!(client.prefs.toggles & CHAT_GHOSTRADIO))
return
if(client && client.prefs)
if (isnull(radio_freq))
if (!(client.prefs.toggles & CHAT_GHOSTEARS))
return
else
if (!(client.prefs.toggles & CHAT_GHOSTRADIO))
return
src << "<a href='?src=\ref[src];follow=\ref[source]'>(Follow)</a> [message]"

View File

@@ -32,7 +32,7 @@
continue
if(findtext(message," snores.")) //Because we have so many sleeping people.
break
if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null)))
if(M.stat == DEAD && M.client && M.client.prefs && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null)))
M.show_message(message)

View File

@@ -1626,7 +1626,8 @@ var/global/list/organ_damage_overlays = list(
// Not on the station or mining?
var/turf/temp_turf = get_turf(remoteview_target)
if((temp_turf.z != 1 && temp_turf.z != 5) || remoteview_target.stat!=CONSCIOUS)
if(temp_turf && (temp_turf.z != 1 && temp_turf.z != 5) || remoteview_target.stat!=CONSCIOUS)
src << "<span class='warning'>Your psy-connection grows too faint to maintain!</span>"
isRemoteObserve = 0
if(!isRemoteObserve && client && !client.adminobs && !iscamera(client.eye))

View File

@@ -550,15 +550,18 @@
stop_pulling()
return
var/mob/living/M = pulling
if (!restrained())
var/diag = get_dir(src, pulling)
if ((diag - 1) & diag)
else
diag = null
if ((get_dist(src, pulling) > 1 || diag))
if(isturf(pulling.loc))
if(!istype(pulling) || !pulling)
WARNING("Pulling disappeared! pulling = [pulling] old pulling = [M]")
else if(isturf(pulling.loc))
if (isliving(pulling))
var/mob/living/M = pulling
M = pulling
var/ok = 1
if (locate(/obj/item/weapon/grab, M.grabbed_by))
if (prob(75))

View File

@@ -217,4 +217,4 @@ json_reader
die(json_token/T)
if(!T) T = get_token()
CRASH("Unexpected token: [T.value].")
CRASH("Unexpected token: [T.value] [json] index:[i] .")

View File

@@ -105,10 +105,12 @@ var/global/list/obj/machinery/mirror/mirror_list = list()
/obj/machinery/mirror/proc/kill_all_beams()
for(var/i=1;i<=4;i++)
if(i > emitted_beams.len) break
var/obj/effect/beam/beam = emitted_beams[i]
qdel(beam)
emitted_beams[i]=null
beam=null
emitted_beams.len = 4
/obj/machinery/mirror/proc/update_beams()
overlays.len = 0
@@ -167,6 +169,8 @@ var/global/list/obj/machinery/mirror/mirror_list = list()
// Emit beams.
if(emitted_beams.len < 4)
emitted_beams.len = 4
for(i=1;i<=4;i++)
var/cdir = cardinal[i]
var/list/dirdata = beam_dirs[i]

View File

@@ -97,6 +97,11 @@ var/list/obj/machinery/prism/prism_list = list()
/obj/machinery/prism/proc/update_beams()
overlays.len = 0
//testing("Beam count: [beams.len]")
if(!beams)
if(loc || !gcDestroyed)
beams = list()
else
return
if(beams.len>0)
var/newbeam=0
if(!beam)