Code Cleanup: Destroy() fixes part 1 + Misc Fixes (#1933)

In this PR:

Destroy() fixes backported from PR #1783.
JaniPDA fixes & improvements.
Chickens no longer consume their own eggs.
Language adding in setup is now 100% more sane.
Chemical dispensers now actually check that the user is still alive before renaming.
Ghosts are now marked as non-simulated atoms.
Non-simulated atoms no longer trigger proximity listeners.
Vendors no longer accept synthetic tools as stocking options.
Fixes #812.
Fixes #1877, Fixes #1929.
Fixes #1930.
Fixes #1152, Fixes #1917.
Fixes #1902.
Fixes #1165.
This commit is contained in:
Lohikar
2017-03-18 23:06:24 +02:00
committed by skull132
parent 905a338a98
commit 63eafb3643
37 changed files with 208 additions and 75 deletions
@@ -75,6 +75,9 @@
else
var/new_lang = input(user, "Select an additional language", "Character Generation", null) as null|anything in available_languages
if(new_lang)
pref.alternate_languages |= new_lang
if (pref.alternate_languages.len >= S.num_alternate_languages)
alert(user, "You have already selected the maximum number of alternate languages for this species!")
else
pref.alternate_languages |= new_lang
return TOPIC_REFRESH
return ..()
+11 -4
View File
@@ -32,12 +32,19 @@ log transactions
var/obj/item/weapon/card/held_card
var/editing_security_level = 0
var/view_screen = NO_SCREEN
var/datum/effect_system/sparks/spark_system
/obj/machinery/atm/New()
/obj/machinery/atm/initialize()
..()
machine_id = "[station_name()] RT #[num_financial_terminals++]"
spark_system = bind_spark(src, 5)
/obj/machinery/atm/Destroy()
authenticated_account = null
if (held_card)
held_card.forceMove(loc)
held_card = null
return ..()
/obj/machinery/atm/process()
if(stat & NOPOWER)
@@ -66,7 +73,7 @@ log transactions
//short out the machine, shoot sparks, spew money!
emagged = 1
spark_system.queue()
spark(src, 5, alldirs)
spawn_money(rand(100,500),src.loc)
//we don't want to grief people by locking their id in an emagged ATM
release_held_id(user)
+4
View File
@@ -55,6 +55,10 @@
RefreshParts()
/obj/machinery/mining/drill/Destroy()
QDEL_NULL(spark_system)
return ..()
/obj/machinery/mining/drill/process()
if(need_player_check)
@@ -13,6 +13,7 @@ var/global/list/image/ghost_sightless_images = list() //this is a list of images
blinded = 0
anchored = 1 // don't get pushed around
invisibility = INVISIBILITY_OBSERVER
simulated = FALSE
var/can_reenter_corpse
var/datum/hud/living/carbon/hud = null // hud
var/bootime = 0
+3
View File
@@ -52,6 +52,8 @@ var/list/cleanbot_types // Going to use this to generate a list of types once th
listener = new /obj/cleanbot_listener(src)
listener.cleanbot = src
janitorial_supplies |= src
if(radio_controller)
radio_controller.add_object(listener, beacon_freq, filter = RADIO_NAVBEACONS)
@@ -61,6 +63,7 @@ var/list/cleanbot_types // Going to use this to generate a list of types once th
patrol_path = null
target = null
ignorelist = null
janitorial_supplies -= src
/mob/living/bot/cleanbot/proc/handle_target()
if(target.clean_marked && target.clean_marked != src)
+1 -4
View File
@@ -17,13 +17,10 @@
germ_level++
/mob/living/carbon/Destroy()
qdel(ingested)
qdel(touching)
QDEL_NULL(touching)
// We don't qdel(bloodstr) because it's the same as qdel(reagents)
for(var/guts in internal_organs)
qdel(guts)
for(var/food in stomach_contents)
qdel(food)
return ..()
/mob/living/carbon/rejuvenate()
+14 -13
View File
@@ -39,20 +39,21 @@
var/obj/item/organ/external/head = get_organ("head")
var/mob/living/simple_animal/borer/B
for(var/I in head.implants)
if(istype(I,/mob/living/simple_animal/borer))
B = I
if(B)
if(!B.ckey && ckey && B.controlling)
B.ckey = ckey
B.controlling = 0
if(B.host_brain.ckey)
ckey = B.host_brain.ckey
B.host_brain.ckey = null
B.host_brain.name = "host brain"
B.host_brain.real_name = "host brain"
if (head)
for(var/I in head.implants)
if(istype(I,/mob/living/simple_animal/borer))
B = I
if(B)
if(!B.ckey && ckey && B.controlling)
B.ckey = ckey
B.controlling = 0
if(B.host_brain.ckey)
ckey = B.host_brain.ckey
B.host_brain.ckey = null
B.host_brain.name = "host brain"
B.host_brain.real_name = "host brain"
verbs -= /mob/living/carbon/proc/release_control
verbs -= /mob/living/carbon/proc/release_control
callHook("death", list(src, gibbed))
+24 -2
View File
@@ -81,8 +81,30 @@
human_mob_list -= src
for(var/organ in organs)
qdel(organ)
if (DS)
qdel(DS)//prevents the dionastats holding onto references and blocking GC
organs = null
internal_organs_by_name = null
internal_organs = null
organs_by_name = null
bad_internal_organs = null
bad_external_organs = null
QDEL_NULL(DS)
// qdel and null out our equipment.
QDEL_NULL(shoes)
QDEL_NULL(belt)
QDEL_NULL(gloves)
QDEL_NULL(glasses)
QDEL_NULL(head)
QDEL_NULL(l_ear)
QDEL_NULL(r_ear)
QDEL_NULL(wear_id)
QDEL_NULL(r_store)
QDEL_NULL(l_store)
QDEL_NULL(s_store)
QDEL_NULL(wear_suit)
// Do this last so the mob's stuff doesn't drop on del.
QDEL_NULL(w_uniform)
return ..()
/mob/living/carbon/human/Stat()
+8
View File
@@ -782,3 +782,11 @@ default behaviour is:
src << "<b>You are now \the [src]!</b>"
src << "<span class='notice'>Remember to stay in character for a mob of this type!</span>"
return 1
/mob/living/Destroy()
for (var/thing in stomach_contents)
qdel(thing)
stomach_contents = null
QDEL_NULL(ingested)
return ..()
@@ -248,6 +248,7 @@
connected_ai.connected_robots -= src
qdel(wires)
wires = null
QDEL_NULL(spark_system)
return ..()
/mob/living/silicon/robot/proc/set_module_sprites(var/list/new_sprites)
@@ -179,6 +179,7 @@
beg_for_food = 0
density = 0
mob_size = 0.75//just a rough estimate, the real value should be way lower
hunger_enabled = FALSE
/mob/living/simple_animal/chick/New()
..()
@@ -227,6 +228,7 @@ var/global/chicken_count = 0
holder_type = /obj/item/weapon/holder/chicken
density = 0
mob_size = 2
hunger_enabled = FALSE
/mob/living/simple_animal/chicken/New()
..()
@@ -256,14 +258,17 @@ var/global/chicken_count = 0
var/obj/item/weapon/reagent_containers/food/snacks/grown/G = O
if(G.seed && G.seed.kitchen_tag == "wheat")
if(!stat && eggsleft < 8)
user.visible_message("\blue [user] feeds [O] to [name]! It clucks happily.","\blue You feed [O] to [name]! It clucks happily.")
user.visible_message(
span("notice", "\The [user] feeds \the [O] to \the [name]! It clucks happily."),
span("notice", "You feed \the [O] to \the [name]! It clucks happily."),
"You hear a cluck.")
user.drop_item()
qdel(O)
eggsleft += rand(1, 4)
else
user << "\blue [name] doesn't seem hungry!"
user << "\The [name] doesn't seem hungry!"
else
user << "[name] doesn't seem interested in that."
user << "\The [name] doesn't seem interested in that."
else
..()
@@ -439,9 +439,8 @@
spark_system = bind_spark(src, 5)
/mob/living/simple_animal/hostile/bear/spatial/Destroy()
if (spark_system)
qdel(spark_system)
..()
QDEL_NULL(spark_system)
return ..()
//Called when we want to bypass ticks and attack immediately. For example in response to being shot
//This calls several procs and some duplicated code from the parent class to immediately put us in an assault state and lash out
+4
View File
@@ -28,6 +28,7 @@ var/list/organ_cache = list()
var/emp_coeff = 1 //coefficient for damages taken by EMP, if the organ is robotic.
/obj/item/organ/Destroy()
processing_objects -= src
if(!owner)
return ..()
@@ -44,6 +45,9 @@ var/list/organ_cache = list()
if(src in owner.contents)
owner.contents -= src
owner = null
QDEL_NULL(dna)
return ..()
/obj/item/organ/proc/update_health()
+2
View File
@@ -195,6 +195,8 @@
cell.forceMove(loc)
cell = null
QDEL_NULL(spark_system)
// Malf AI, removes the APC from AI's hacked APCs list.
if((hacker) && (hacker.hacked_apcs) && (src in hacker.hacked_apcs))
hacker.hacked_apcs -= src
@@ -33,6 +33,10 @@
..()
spark_system = bind_spark(src, 5, alldirs)
/obj/machinery/power/emitter/Destroy()
QDEL_NULL(spark_system)
return ..()
/obj/machinery/power/emitter/verb/rotate()
set name = "Rotate"
set category = "Object"
@@ -56,6 +60,7 @@
log_game("Emitter deleted at ([x],[y],[z])")
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z])","singulo")
qdel(wifi_receiver)
qdel(spark_system)
wifi_receiver = null
return ..()
@@ -36,6 +36,13 @@
set category = "Object"
set src in view(usr, 1)
if (!ishuman(usr))
return
if (usr.stat)
usr << "You cannot do that in your current state."
return
setLabel(L, usr)
/obj/item/weapon/reagent_containers/chem_disp_cartridge/proc/setLabel(L, mob/user = null)
+1 -1
View File
@@ -98,7 +98,7 @@
/obj/machinery/power/supermatter/Destroy()
qdel(radio)
QDEL_NULL(radio)
. = ..()
/obj/machinery/power/supermatter/proc/explode()