Hunts down some runtimes

cleans up some dogborg sleeper code too
This commit is contained in:
Poojawa
2018-03-17 19:38:03 -05:00
parent b479e5fc7a
commit c8365e6be7
7 changed files with 82 additions and 86 deletions
+2
View File
@@ -425,6 +425,8 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
//text files
#define BRAIN_DAMAGE_FILE "traumas.json"
#define ION_FILE "ion_laws.json"
#define PIRATE_NAMES_FILE "pirates.json"
//Fullscreen overlay resolution in tiles.
#define FULLSCREEN_OVERLAY_RESOLUTION_X 15
+1 -1
View File
@@ -327,7 +327,7 @@ SUBSYSTEM_DEF(vote)
return 1
/datum/action/vote/proc/remove_from_client()
if(owner.client)
if(owner && owner.client)
owner.client.player_details.player_actions -= src
else if(owner.ckey)
var/datum/player_details/P = GLOB.player_details[owner.ckey]
+6 -6
View File
@@ -52,7 +52,7 @@
owner.derpspeech = min(owner.derpspeech + 5, 25)
if(prob(3))
owner.emote("drool")
else if(owner.stat == CONSCIOUS && prob(3))
else if(owner && owner.stat == CONSCIOUS && prob(3))
owner.say(pick_list_replacements(BRAIN_DAMAGE_FILE, "brain_damage"))
..()
@@ -142,13 +142,13 @@
/datum/brain_trauma/mild/muscle_weakness/on_life()
var/fall_chance = 1
if(owner.m_intent == MOVE_INTENT_RUN)
if(owner && owner.m_intent == MOVE_INTENT_RUN)
fall_chance += 2
if(prob(fall_chance) && !owner.lying && !owner.buckled)
to_chat(owner, "<span class='warning'>Your leg gives out!</span>")
owner.Knockdown(35)
else if(owner.get_active_held_item())
else if(owner && owner.get_active_held_item())
var/drop_chance = 1
var/obj/item/I = owner.get_active_held_item()
drop_chance += I.w_class
@@ -171,11 +171,11 @@
if(prob(7))
switch(rand(1,5))
if(1)
if(owner.canmove && !isspaceturf(owner.loc))
if(owner && owner.canmove && !isspaceturf(owner.loc))
to_chat(owner, "<span class='warning'>Your leg spasms!</span>")
step(owner, pick(GLOB.cardinals))
if(2)
if(owner.incapacitated())
if(owner && owner.incapacitated())
return
var/obj/item/I = owner.get_active_held_item()
if(I)
@@ -207,7 +207,7 @@
owner.ClickOn(owner)
owner.a_intent = prev_intent
if(5)
if(owner.incapacitated())
if(owner && owner.incapacitated())
return
var/obj/item/I = owner.get_active_held_item()
var/list/turf/targets = list()
@@ -84,7 +84,7 @@
mood_change = -3
/datum/mood_event/brain_damage/add_effects()
var/damage_message = pick_list_replacements("brain_damage_lines.json", "brain_damage")
var/damage_message = pick_list_replacements("BRAIN_DAMAGE_FILE", "brain_damage")
description = "<span class='warning'>Hurr durr... [damage_message]</span>\n"
/datum/mood_event/hulk //Entire duration of having the hulk mutation
@@ -63,13 +63,12 @@
to_chat(user, "<span class='warning'>This person is incompatible with our equipment.</span>")
return
if(target.buckled)
to_chat(user, "<span class='warning'>The user is buckled and can not be put into your [src.name].</span>")
to_chat(user, "<span class='warning'>The user is buckled and can not be put into your [src].</span>")
return
if(patient)
to_chat(user, "<span class='warning'>Your [src.name] is already occupied.</span>")
to_chat(user, "<span class='warning'>Your [src] is already occupied.</span>")
return
testing("using sleeper/afterattack")
user.visible_message("<span class='warning'>[hound.name] is carefully inserting [target.name] into their [src.name].</span>", "<span class='notice'>You start placing [target] into your [src]...</span>")
user.visible_message("<span class='warning'>[hound.name] is carefully inserting [target.name] into their [src].</span>", "<span class='notice'>You start placing [target] into your [src]...</span>")
if(!patient && iscarbon(target) && !target.buckled && do_after (user, 50, target = target))
if(!in_range(src, target)) //Proximity is probably old news by now, do a new check.
@@ -109,8 +108,7 @@
go_out()
/obj/item/device/dogborg/sleeper/proc/go_out(var/target)
hound = src.loc
testing("go_out activated")
hound = loc
hound.setClickCooldown(50)
if(length(contents) > 0)
hound.visible_message("<span class='warning'>[hound.name] empties out their contents via their release port.</span>", "<span class='notice'>You empty your contents via your release port.</span>")
@@ -214,20 +212,16 @@
inject_chem(chem)
. = TRUE
if("cleaning")
testing("cleaning attempted")
if(!contents)
testing("cleaning has no contents")
to_chat(src, "Your [src] is already cleaned.")
return
if(patient)
to_chat(patient, "<span class='danger'>[hound.name]'s [src.name] fills with caustic enzymes around you!</span>")
testing("clean_cycle activated")
to_chat(patient, "<span class='danger'>[hound.name]'s [src] fills with caustic enzymes around you!</span>")
to_chat(src, "<span class='danger'>Cleaning process enabled.</span>")
clean_cycle()
. = TRUE
/obj/item/device/dogborg/sleeper/proc/update_gut()
testing("update_gut proc fired")
//Well, we HAD one, what happened to them?
if(patient in contents)
if(patient_laststat != patient.stat)
@@ -275,66 +269,63 @@
//Gurgleborg process
/obj/item/device/dogborg/sleeper/proc/clean_cycle()
testing("clean_cycle activated")
//Sanity
for(var/I in items_preserved)
if(!(I in contents))
items_preserved -= I
var/list/touchable_items = contents - items_preserved
if(cleaning_cycles)
testing("clean_cycle being used")
cleaning_cycles--
cleaning = TRUE
for(var/mob/living/carbon/human/T in (touchable_items))
if((T.status_flags & GODMODE) || !T.digestable)
src.items_preserved += T
items_preserved += T
else
T.adjustBruteLoss(2)
T.adjustFireLoss(3)
update_gut()
var/atom/target = pick(touchable_items)
if(iscarbon(target)) //Handle the target being a mob
var/mob/living/carbon/T = target
if(T.stat == DEAD && T.digestable) //Mob is now dead
message_admins("[key_name(hound)] has digested [key_name(T)] as a dogborg. ([hound ? "<a href='?_src_=holder;adminplayerobservecoodjump=1;X=[hound.x];Y=[hound.y];Z=[hound.z]'>JMP</a>" : "null"])")
to_chat(hound,"<span class='notice'>You feel your belly slowly churn around [T], breaking them down into a soft slurry to be used as power for your systems.</span>")
to_chat(T,"<span class='notice'>You feel [hound]'s belly slowly churn around your form, breaking you down into a soft slurry to be used as power for [hound]'s systems.</span>")
src.hound.cell.give(30000) //Fueeeeellll
T.stop_sound_channel(CHANNEL_PRED)
playsound(get_turf(hound),"death_pred",50,0,-6,0,channel=CHANNEL_PRED,ignore_walls = FALSE)
T.stop_sound_channel(CHANNEL_PRED)
T.playsound_local("death_prey",60)
for(var/belly in T.vore_organs)
var/obj/belly/B = belly
for(var/atom/movable/thing in B)
thing.forceMove(src)
if(ismob(thing))
to_chat(thing, "As [T] melts away around you, you find yourself in [hound]'s [name]")
for(var/obj/item/W in T)
if(!T.dropItemToGround(W))
qdel(W)
qdel(T)
update_gut()
//Handle the target being anything but a mob
else if(isobj(target))
var/obj/T = target
if(T.type in important_items) //If the object is in the items_preserved global list
src.items_preserved += T
//If the object is not one to preserve
else
qdel(T)
src.update_gut()
src.hound.cell.give(10)
if(contents)
var/atom/target = pick(touchable_items)
if(iscarbon(target)) //Handle the target being a mob
var/mob/living/carbon/T = target
if(T.stat == DEAD && T.digestable) //Mob is now dead
message_admins("[key_name(hound)] has digested [key_name(T)] as a dogborg. ([hound ? "<a href='?_src_=holder;adminplayerobservecoodjump=1;X=[hound.x];Y=[hound.y];Z=[hound.z]'>JMP</a>" : "null"])")
to_chat(hound,"<span class='notice'>You feel your belly slowly churn around [T], breaking them down into a soft slurry to be used as power for your systems.</span>")
to_chat(T,"<span class='notice'>You feel [hound]'s belly slowly churn around your form, breaking you down into a soft slurry to be used as power for [hound]'s systems.</span>")
hound.cell.give(30000) //Fueeeeellll
T.stop_sound_channel(CHANNEL_PRED)
playsound(get_turf(hound),"death_pred",50,0,-6,0,channel=CHANNEL_PRED,ignore_walls = FALSE)
T.stop_sound_channel(CHANNEL_PRED)
T.playsound_local("death_prey",60)
for(var/belly in T.vore_organs)
var/obj/belly/B = belly
for(var/atom/movable/thing in B)
thing.forceMove(src)
if(ismob(thing))
to_chat(thing, "As [T] melts away around you, you find yourself in [hound]'s [name]")
for(var/obj/item/W in T)
if(!T.dropItemToGround(W))
qdel(W)
qdel(T)
update_gut()
//Handle the target being anything but a mob
else if(isobj(target))
var/obj/T = target
if(T.type in important_items) //If the object is in the items_preserved global list
items_preserved += T
//If the object is not one to preserve
else
qdel(T)
update_gut()
hound.cell.give(10)
else
testing("clean_cycle finished and reset")
cleaning_cycles = initial(cleaning_cycles)
cleaning = FALSE
to_chat(hound, "<span class='notice'>Your [src.name] chimes it ends its self-cleaning cycle.</span>")//Belly is entirely empty
to_chat(hound, "<span class='notice'>Your [src] chimes it ends its self-cleaning cycle.</span>")//Belly is entirely empty
update_gut()
if(!length(contents))
to_chat(hound, "<span class='notice'>Your [src.name] is now clean. Ending self-cleaning cycle.</span>")
to_chat(hound, "<span class='notice'>Your [src] is now clean. Ending self-cleaning cycle.</span>")
cleaning = FALSE
update_gut()
return
@@ -354,19 +345,14 @@
return is_type_in_typecache(I, important_items)
/obj/item/device/dogborg/sleeper/proc/inject_chem(chem)
testing("inject chem triggered, checking power")
if(hound.cell.charge <= 800) //This is so borgs don't kill themselves with it. Remember, 750 charge used every injection.
to_chat(hound, "<span class='notice'>You don't have enough power to synthesize fluids.</span>")
return
testing("Has power, checking for overdose")
if(patient.reagents.get_reagent_amount(chem) + 10 >= 20) //Preventing people from accidentally killing themselves by trying to inject too many chemicals!
to_chat(hound, "<span class='notice'>Your stomach is currently too full of fluids to secrete more fluids of this kind.</span>")
return
testing("isn't overdosing, attempting to add_reagent")
patient.reagents.add_reagent(chem, 10)
testing("add_reagent")
src.hound.cell.use(750) //-750 charge per injection
testing("draining power")
hound.cell.use(750) //-750 charge per injection
var/units = round(patient.reagents.get_reagent_amount(chem))
to_chat(hound, "<span class='notice'>Injecting [units] unit\s of [chem] into occupant.</span>") //If they were immersed, the reagents wouldn't leave with them.
@@ -403,15 +389,15 @@
if(iscarbon(target))
var/mob/living/carbon/brigman = target
if (!brigman.devourable)
to_chat(user, "The target registers an error code. Unable to insert into [src.name].")
to_chat(user, "The target registers an error code. Unable to insert into [src].")
return
if(patient)
to_chat(user,"<span class='warning'>Your [src.name] is already occupied.</span>")
to_chat(user,"<span class='warning'>Your [src] is already occupied.</span>")
return
if(brigman.buckled)
to_chat(user,"<span class='warning'>[brigman] is buckled and can not be put into your [src.name].</span>")
to_chat(user,"<span class='warning'>[brigman] is buckled and can not be put into your [src].</span>")
return
user.visible_message("<span class='warning'>[hound.name] is ingesting [brigman] into their [src.name].</span>", "<span class='notice'>You start ingesting [brigman] into your [src.name]...</span>")
user.visible_message("<span class='warning'>[hound.name] is ingesting [brigman] into their [src].</span>", "<span class='notice'>You start ingesting [brigman] into your [src.name]...</span>")
if(do_after(user, 30, target = brigman) && !patient && !brigman.buckled)
if(!in_range(src, brigman)) //Proximity is probably old news by now, do a new check.
return //If they moved away, you can't eat them.
@@ -447,18 +433,15 @@
if(target.anchored)
return
if(length(contents) > (max_item_count - 1))
to_chat(user,"<span class='warning'>Your [src.name] is full. Eject or process contents to continue.</span>")
to_chat(user,"<span class='warning'>Your [src] is full. Eject or process contents to continue.</span>")
return
if(isobj(target))
testing("Checking target type")
if(CheckAccepted(target))
to_chat(user,"<span class='warning'>\The [target] registers an error code to your [src.name]</span>")
to_chat(user,"<span class='warning'>\The [target] registers an error code to your [src]</span>")
return
testing("Target not on the important list")
if(target_obj.w_class > WEIGHT_CLASS_NORMAL)
to_chat(user,"<span class='warning'>\The [target] is too large to fit into your [src.name]</span>")
to_chat(user,"<span class='warning'>\The [target] is too large to fit into your [src]</span>")
return
testing("Target not too large.")
user.visible_message("<span class='warning'>[hound.name] is ingesting [target.name] into their [src.name].</span>", "<span class='notice'>You start ingesting [target] into your [src.name]...</span>")
if(do_after(user, 15, target = target) && length(contents) < max_item_count)
if(!in_range(src, target)) //Proximity is probably old news by now, do a new check.
@@ -477,15 +460,15 @@
else if(iscarbon(target))
var/mob/living/carbon/trashman = target
if (!trashman.devourable)
to_chat(user, "<span class='warning'>\The [target] registers an error code to your [src.name]</span>")
to_chat(user, "<span class='warning'>[target] registers an error code to your [src]</span>")
return
if(patient)
to_chat(user,"<span class='warning'>Your [src.name] is already occupied.</span>")
to_chat(user,"<span class='warning'>Your [src] is already occupied.</span>")
return
if(trashman.buckled)
to_chat(user,"<span class='warning'>[trashman] is buckled and can not be put into your [src.name].</span>")
to_chat(user,"<span class='warning'>[trashman] is buckled and can not be put into your [src].</span>")
return
user.visible_message("<span class='warning'>[hound.name] is ingesting [trashman] into their [src.name].</span>", "<span class='notice'>You start ingesting [trashman] into your [src.name]...</span>")
user.visible_message("<span class='warning'>[hound.name] is ingesting [trashman] into their [src].</span>", "<span class='notice'>You start ingesting [trashman] into your [src.name]...</span>")
if(do_after(user, 30, target = trashman) && !patient && !trashman.buckled && length(contents) < max_item_count)
if(!in_range(src, trashman)) //Proximity is probably old news by now, do a new check.
return //If they moved away, you can't eat them.
@@ -254,6 +254,9 @@
if (!M.anchored && !M.pulledby && M.last_high_pressure_movement_air_cycle < SSair.times_fired)
M.experience_pressure_difference(pressure_difference, pressure_direction)
/turf/closed/proc/high_pressure_movements()
return
/atom/movable/var/pressure_resistance = 10
/atom/movable/var/last_high_pressure_movement_air_cycle = 0
@@ -324,19 +324,23 @@
// Verb for saving vore preferences to save file
//
/mob/living/proc/save_vore_prefs()
if(!(client || client.prefs_vr))
if(!client)
return FALSE
if(client && !client.prefs_vr)
return FALSE
if(!copy_to_prefs_vr())
return FALSE
if(!client.prefs_vr.save_vore())
if(client && !client.prefs_vr.save_vore())
return FALSE
return TRUE
/mob/living/proc/apply_vore_prefs()
if(!(client || client.prefs_vr))
if(!client)
return FALSE
if(!client.prefs_vr.load_vore())
if(client && !client.prefs_vr)
return FALSE
if(client && !client.prefs_vr.load_vore())
return FALSE
if(!copy_from_prefs_vr())
return FALSE
@@ -344,7 +348,9 @@
return TRUE
/mob/living/proc/copy_to_prefs_vr()
if(!client || !client.prefs_vr)
if(!client)
return FALSE
if(client && !client.prefs_vr)
src << "<span class='warning'>You attempted to save your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>"
return FALSE
@@ -367,7 +373,9 @@
// Proc for applying vore preferences, given bellies
//
/mob/living/proc/copy_from_prefs_vr()
if(!client || !client.prefs_vr)
if(!client)
return FALSE
if(client && !client.prefs_vr)
src << "<span class='warning'>You attempted to apply your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>"
return FALSE
@@ -433,7 +441,7 @@
if(src == stat)
return
src.setClickCooldown(50)
src.setClickCooldown(100)
src.visible_message("<span class='warning'>[src] licks [tasted]!</span>","<span class='notice'>You lick [tasted]. They taste rather like [tasted.get_taste_message()].</span>","<b>Slurp!</b>")