Bugfix/runtime cleanup (#4249)

Some RTs.

Fixes #4091
Fixes #4092
Fixes #4077
This commit is contained in:
Erki
2018-02-08 11:59:11 +02:00
committed by GitHub
parent 03a02e48c0
commit 20fc059ca7
11 changed files with 51 additions and 21 deletions

View File

@@ -17,7 +17,7 @@
if(item.can_view(U))
return 1
if(!antag_roles.len)
if(!LAZYLEN(antag_roles))
return 1
return 0

View File

@@ -40,8 +40,6 @@
A.push_data()
/datum/integrated_io/proc/get_data()
if(isnull(data))
return
if(isweakref(data))
return data.resolve()
return data

View File

@@ -1,7 +1,7 @@
/obj/item/integrated_circuit/logic
name = "logic gate"
desc = "This tiny chip will decide for you!"
extended_desc = "Logic circuits will treat a null, 0, and a \"\" string value as FALSE and anything else as TRUE."
extended_desc = "Logic circuits will treat a null, 0, and a \"\" string value as FALSE and anything else as TRUE. If inputs are of mismatching type, expect undocumented behaviour."
complexity = 3
outputs = list("result" = IC_PINTYPE_BOOLEAN)
activators = list("compare" = IC_PINTYPE_PULSE_IN)
@@ -22,7 +22,11 @@
/obj/item/integrated_circuit/logic/binary/do_work()
var/data1 = get_pin_data(IC_INPUT, 1)
var/data2 = get_pin_data(IC_INPUT, 2)
var/result = !!do_compare(data1, data2)
var/result = FALSE
if (comparable(data1, data2))
result = !!do_compare(data1, data2)
set_pin_data(IC_OUTPUT, 1, result)
push_data()
@@ -34,6 +38,18 @@
/obj/item/integrated_circuit/logic/binary/proc/do_compare(A, B)
return FALSE
/obj/item/integrated_circuit/logic/binary/proc/comparable(A, B)
if (isnum(A) && isnum(B))
. = TRUE
else if (istext(A) && istext(B))
. = TRUE
else if (islist(A) && islist(B))
. = TRUE
else if (isdatum(A) && isdatum(B))
. = TRUE
else
. = FALSE
/obj/item/integrated_circuit/logic/unary
inputs = list(
"A" = IC_PINTYPE_ANY

View File

@@ -291,7 +291,7 @@ var/list/cleanbot_types // Going to use this to generate a list of types once th
get_targets()
if("patrol")
should_patrol = !should_patrol
patrol_path = null
patrol_path = list()
if("freq")
var/freq = text2num(input("Select frequency for navigation beacons", "Frequnecy", num2text(beacon_freq / 10))) * 10
if (freq > 0)

View File

@@ -48,6 +48,9 @@
/obj/item/organ/parasite/kois/process()
..()
if (!owner)
return
if(prob(10) && !(owner.species.flags & NO_PAIN))
owner << "<span class='warning'>You feel a stinging pain in your abdomen!</span>"
owner.emote("me",1,"winces slightly.")

View File

@@ -94,7 +94,7 @@
if(href_list["togglep"])
if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE))
src.toggle_power()
src.toggle_power(usr)
else if(href_list["scan"])
src.part_scan()
@@ -212,11 +212,11 @@
return 0
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
/obj/machinery/particle_accelerator/control_box/proc/toggle_power(mob/user)
src.active = !src.active
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("PA Control Computer turned [active ?"ON":"OFF"] by [usr.ckey]([usr]) in ([x],[y],[z])",ckey=key_name(usr))
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [user ? user.key : "outside forces"]","singulo")
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [key_name(user, TRUE, highlight_special = TRUE)] in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("PA Control Computer turned [active ?"ON":"OFF"] by [key_name(user)] in ([x],[y],[z])",ckey=key_name(user))
if(src.active)
update_use_power(2)
for(var/obj/structure/particle_accelerator/part in connected_parts)

View File

@@ -10,7 +10,7 @@
/obj/aiming_overlay/proc/trigger(var/perm)
if((user.client.prefs.toggles_secondary & SAFETY_CHECK) && user.a_intent != I_HURT) //Check this first to save time.
if(user && user.client && (user.client.prefs.toggles_secondary & SAFETY_CHECK) && user.a_intent != I_HURT) //Check this first to save time.
user << "You refrain from firing, as you aren't on harm intent."
return
if(!owner || !aiming_with || !aiming_at || !locked)

View File

@@ -33,17 +33,16 @@
reagents.add_reagent("nutriment",nutriment_amt,nutriment_desc)
/obj/item/weapon/reagent_containers/food/snacks/proc/On_Consume(var/mob/M)
if(!usr) usr = M
if(!reagents.total_volume)
M.visible_message("<span class='notice'>[M] finishes eating \the [src].</span>","<span class='notice'>You finish eating \the [src].</span>")
usr.drop_from_inventory(src) //so icons update :[
M.drop_from_inventory(src) //so icons update :[
if(trash)
if(ispath(trash,/obj/item))
var/obj/item/TrashItem = new trash(usr)
usr.put_in_hands(TrashItem)
var/obj/item/TrashItem = new trash(M)
M.put_in_hands(TrashItem)
else if(istype(trash,/obj/item))
usr.put_in_hands(trash)
M.put_in_hands(trash)
qdel(src)
return
@@ -390,7 +389,9 @@
if(!src && !user.client)
user.custom_emote(1,"[pick("burps", "cries for more", "burps twice", "looks at the area where the food was")]")
qdel(src)
On_Consume(user)
if (reagents)
On_Consume(user)
//////////////////////////////////////////////////
////////////////////////////////////////////Snacks
@@ -4874,4 +4875,4 @@
bitesize = 5
center_of_mass = list("x"=16, "y"=16)
nutriment_desc = list("regret" = 6)
nutriment_amt = 6
nutriment_amt = 6

View File

@@ -166,6 +166,9 @@
explode()
/obj/structure/reagent_dispensers/fueltank/proc/explode()
if (QDELETED(src))
return
if (reagents.total_volume > 500)
explosion(src.loc,1,2,4)
else if (reagents.total_volume > 100)

View File

@@ -58,6 +58,9 @@
power = 0
return 0
var/turf/T = src.loc
if (!istype(T))
power = 0
return 0
var/obj/structure/cable/C = T.get_cable_node()
var/datum/powernet/PN
@@ -106,7 +109,7 @@
"You hear heavy droning fade out")
icon_state = "Shield_Gen"
src.active = 0
for(var/dir in list(1,2,4,8))
for(var/dir in list(1,2,4,8))
cleanup(dir)
/obj/machinery/shieldwallgen/proc/setup_field(var/NSEW = 0)

View File

@@ -28,7 +28,7 @@
if(get_dir(src, possible_gen) == src.dir)
possible_gen.owned_capacitor = src
break
/obj/machinery/shield_capacitor/emag_act(var/remaining_charges, var/mob/user)
if(prob(75))
src.locked = !src.locked
@@ -106,7 +106,13 @@
//see if we can connect to a power net.
var/datum/powernet/PN
var/turf/T = src.loc
if (!istype(T))
active = 0
return
var/obj/structure/cable/C = T.get_cable_node()
if (C)
PN = C.powernet