Merge pull request #2090 from Markolie/fixesss

Radio examine/matter eater fix, GC testing move
This commit is contained in:
Fox-McCloud
2015-09-18 01:20:27 -04:00
7 changed files with 145 additions and 136 deletions
+63 -43
View File
@@ -240,13 +240,51 @@
action_icon_state = "genetic_eat"
var/list/types_allowed=list(/obj/item,/mob/living/simple_animal, /mob/living/carbon/human)
var/list/types_allowed = list(
/obj/item,
/mob/living/simple_animal/pet,
/mob/living/simple_animal/hostile,
/mob/living/simple_animal/parrot,
/mob/living/simple_animal/crab,
/mob/living/simple_animal/mouse,
/mob/living/carbon/human,
/mob/living/carbon/slime,
/mob/living/carbon/alien/larva,
/mob/living/simple_animal/slime,
/mob/living/simple_animal/adultslime,
/mob/living/simple_animal/tomato,
/mob/living/simple_animal/chick,
/mob/living/simple_animal/chicken,
/mob/living/simple_animal/lizard,
/mob/living/simple_animal/cow,
/mob/living/simple_animal/spiderbot
)
var/list/own_blacklist = list(
/obj/item/organ,
/obj/item/weapon/implant
)
/obj/effect/proc_holder/spell/targeted/eat/proc/doHeal(var/mob/user)
if(ishuman(user))
var/mob/living/carbon/human/H = user
for(var/name in H.organs_by_name)
var/obj/item/organ/external/affecting = null
if(!H.organs[name])
continue
affecting = H.organs[name]
if(!istype(affecting, /obj/item/organ/external))
continue
affecting.heal_damage(4, 0)
H.UpdateDamageIcon()
H.updatehealth()
/obj/effect/proc_holder/spell/targeted/eat/choose_targets(mob/user = usr)
var/list/targets = new /list()
var/list/possible_targets = new /list()
for(var/atom/movable/O in view_or_range(range, user, selection_type))
if((O in user) && is_type_in_list(O,own_blacklist))
continue
if(is_type_in_list(O,types_allowed))
possible_targets += O
@@ -258,75 +296,57 @@
perform(targets)
/obj/effect/proc_holder/spell/targeted/eat/proc/doHeal(var/mob/user)
if(ishuman(user))
var/mob/living/carbon/human/H=user
for(var/name in H.organs_by_name)
var/obj/item/organ/external/affecting = null
if(!H.organs[name])
continue
affecting = H.organs[name]
if(!istype(affecting, /obj/item/organ/external))
continue
affecting.heal_damage(4, 0)
H.UpdateDamageIcon()
H.updatehealth()
/obj/effect/proc_holder/spell/targeted/eat/cast(list/targets)
var/mob/user = usr
if(!targets.len)
usr << "<span class='notice'>No target found in range.</span>"
user << "<span class='notice'>No target found in range.</span>"
return
var/atom/movable/the_item = targets[1]
if(ishuman(the_item))
//My gender
var/m_his="his"
if(usr.gender==FEMALE)
m_his="her"
var/m_his = "his"
if(user.gender == FEMALE)
m_his = "her"
// Their gender
var/t_his="his"
if(the_item.gender==FEMALE)
t_his="her"
var/t_his = "his"
if(the_item.gender == FEMALE)
t_his = "her"
var/mob/living/carbon/human/H = the_item
var/obj/item/organ/external/limb = H.get_organ(usr.zone_sel.selecting)
var/obj/item/organ/external/limb = H.get_organ(user.zone_sel.selecting)
if(!istype(limb))
usr << "\red You can't eat this part of them!"
user << "<span class='warning'>You can't eat this part of them!</span>"
revert_cast()
return 0
if(istype(limb,/obj/item/organ/external/head))
// Bullshit, but prevents being unable to clone someone.
usr << "\red You try to put \the [limb] in your mouth, but [t_his] ears tickle your throat!"
user << "<span class='warning'>You try to put \the [limb] in your mouth, but [t_his] ears tickle your throat!</span>"
revert_cast()
return 0
if(istype(limb,/obj/item/organ/external/chest))
// Bullshit, but prevents being able to instagib someone.
usr << "\red You try to put their [limb] in your mouth, but it's too big to fit!"
user << "<span class='warning'>You try to put their [limb] in your mouth, but it's too big to fit!</span>"
revert_cast()
return 0
usr.visible_message("\red <b>[usr] begins stuffing [the_item]'s [limb.name] into [m_his] gaping maw!</b>")
user.visible_message("<span class='danger'>[user] begins stuffing [the_item]'s [limb.name] into [m_his] gaping maw!</span>")
var/oldloc = H.loc
if(!do_mob(usr,H,EAT_MOB_DELAY))
usr << "\red You were interrupted before you could eat [the_item]!"
if(!do_mob(user,H,EAT_MOB_DELAY))
user << "<span class='danger'>You were interrupted before you could eat [the_item]!</span>"
else
if(!limb || !H)
return
if(H.loc!=oldloc)
usr << "\red \The [limb] moved away from your mouth!"
if(H.loc != oldloc)
user << "<span class='danger'>\The [limb] moved away from your mouth!</span>"
return
usr.visible_message("\red [usr] [pick("chomps","bites")] off [the_item]'s [limb]!")
playsound(usr.loc, 'sound/items/eatfood.ogg', 50, 0)
var/obj/limb_obj=limb.droplimb(0,DROPLIMB_EDGE)
if(limb_obj)
var/obj/item/organ/external/chest=usr:get_organ("chest")
chest.implants += limb_obj
limb_obj.loc=usr
doHeal(usr)
user.visible_message("<span class='danger'>[user] [pick("chomps","bites")] off [the_item]'s [limb]!</span>")
playsound(user.loc, 'sound/items/eatfood.ogg', 50, 0)
limb.droplimb(0, DROPLIMB_EDGE)
doHeal(user)
else
usr.visible_message("\red [usr] eats \the [the_item].")
playsound(usr.loc, 'sound/items/eatfood.ogg', 50, 0)
user.visible_message("<span class='danger'>[user] eats \the [the_item].</span>")
playsound(user.loc, 'sound/items/eatfood.ogg', 50, 0)
qdel(the_item)
doHeal(usr)
doHeal(user)
return
////////////////////////////////////////////////////////////////////////
+3 -6
View File
@@ -118,7 +118,7 @@
src.loc = T
/obj/item/examine(mob/user)
/obj/item/examine(mob/user, var/distance = -1)
var/size
switch(src.w_class)
if(1.0)
@@ -131,11 +131,8 @@
size = "bulky"
if(5.0)
size = "huge"
else
//if ((CLUMSY in usr.mutations) && prob(50)) t = "funny-looking"
user << "This is a [src.blood_DNA ? "bloody " : ""]\icon[src][src.name]. It is a [size] item."
if(src.desc)
user << src.desc
return ..(user, distance, "", "It is a [size] item.")
/obj/item/attack_hand(mob/user as mob)
@@ -29,7 +29,7 @@
/obj/item/device/radio/headset/list_channels(var/mob/user)
return list_secure_channels()
/obj/item/device/radio/headset/examine(mob/user)
/obj/item/device/radio/headset/examine(mob/user, var/distance = -1)
if(!(..(user, 1) && radio_desc))
return
@@ -286,7 +286,6 @@
return ..(freq, level, 1)
/obj/item/device/radio/headset/attackby(obj/item/weapon/W as obj, mob/user as mob)
// ..()
user.set_machine(src)
if (!( istype(W, /obj/item/weapon/screwdriver) || (istype(W, /obj/item/device/encryptionkey/ ))))
return
@@ -294,20 +293,15 @@
if(istype(W, /obj/item/weapon/screwdriver))
if(keyslot1 || keyslot2)
for(var/ch_name in channels)
radio_controller.remove_object(src, radiochannels[ch_name])
secure_radio_connections[ch_name] = null
if(keyslot1)
var/turf/T = get_turf(user)
if(T)
keyslot1.loc = T
keyslot1 = null
if(keyslot2)
var/turf/T = get_turf(user)
if(T)
@@ -316,7 +310,6 @@
recalculateChannels()
user << "You pop out the encryption keys in the headset!"
else
user << "This headset doesn't have any encryption keys! How useless..."
@@ -329,15 +322,12 @@
user.drop_item()
W.loc = src
keyslot1 = W
else
user.drop_item()
W.loc = src
keyslot2 = W
recalculateChannels()
return
@@ -514,14 +514,14 @@ var/global/list/default_medbay_channels = list(
return get_mobs_in_view(canhear_range, src)
/obj/item/device/radio/examine(mob/user)
..(user)
/obj/item/device/radio/examine(mob/user, var/distance = -1)
. = ..(user, distance)
if ((in_range(src, user) || loc == user))
if (b_stat)
user.show_message("\blue \the [src] can be attached and modified!")
else
user.show_message("\blue \the [src] can not be modified or attached!")
return
return .
/obj/item/device/radio/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
..()
+3 -3
View File
@@ -53,9 +53,9 @@ var/global/nologevent = 0
body += "<br><br>\[ "
body += "<a href='?_src_=vars;Vars=\ref[M]'>VV</a> - "
body += "<a href='?src=\ref[src];traitor=\ref[M]'>TP</a> -"
body += "<a href='?src=\ref[usr];priv_msg=\ref[M]'>PM</a> -"
body += "<a href='?src=\ref[src];subtlemessage=\ref[M]'>SM</a> -"
body += "<a href='?src=\ref[src];traitor=\ref[M]'>TP</a> - "
body += "<a href='?src=\ref[usr];priv_msg=\ref[M]'>PM</a> - "
body += "<a href='?src=\ref[src];subtlemessage=\ref[M]'>SM</a> - "
body += "[admin_jump_link(M, src)]\] </b><br>"
body += "<b>Mob type</b> = [M.type]<br><br>"
@@ -181,72 +181,4 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
/proc/gcwarning(msg)
log_to_dd("## GC WARNING: [msg]")
#ifdef TESTING
/client/var/running_find_references
/datum/var/running_find_references
/datum/verb/find_references(remove_from_queue = TRUE as num)
set category = "Debug"
set name = "Find References"
set background = 1
set src in world
running_find_references = type
if(usr && usr.client)
if(usr.client.running_find_references)
testing("CANCELLED search for references to a [usr.client.running_find_references].")
usr.client.running_find_references = null
running_find_references = null
return
if(alert("Running this will create a lot of lag until it finishes. You can cancel it by running it again. Would you like to begin the search?", "Find References", "Yes", "No") == "No")
running_find_references = null
return
// Remove this object from the list of things to be auto-deleted.
if(remove_from_queue && garbageCollector && ("\ref[src]" in garbageCollector.queue))
garbageCollector.queue -= "\ref[src]"
if(usr && usr.client)
usr.client.running_find_references = type
testing("Beginning search for references to a [type].")
var/list/things = list()
for(var/client/thing)
things |= thing
for(var/datum/thing)
things |= thing
testing("Collected list of things in search for references to a [type]. ([things.len] Thing\s)")
for(var/datum/thing in things)
if(usr && usr.client && !usr.client.running_find_references) return
for(var/varname in thing.vars)
var/variable = thing.vars[varname]
if(variable == src)
testing("Found [src.type] \ref[src] in [thing.type]'s [varname] var.")
else if(islist(variable))
if(src in variable)
testing("Found [src.type] \ref[src] in [thing.type]'s [varname] list var.")
testing("Completed search for references to a [type].")
if(usr && usr.client)
usr.client.running_find_references = null
running_find_references = null
/client/verb/purge_all_destroyed_objects()
set category = "Debug"
if(garbageCollector)
while(garbageCollector.queue.len)
var/datum/o = locate(garbageCollector.queue[1])
if(istype(o) && o.gcDestroyed)
del(o)
garbageCollector.dels_count++
garbageCollector.queue.Cut(1, 2)
/datum/verb/qdel_then_find_references()
set category = "Debug"
set name = "qdel() then Find References"
set background = 1
set src in world
qdel(src)
if(!running_find_references)
find_references(remove_from_queue = FALSE)
#endif
@@ -121,3 +121,73 @@ var/global/list/ghdels_profiled = list()
dat +="<tr><td>[L[t]]</td><td>[t]</td></tr>"
dat += "</table>"
return dat
#ifdef TESTING
/client/var/running_find_references
/datum/var/running_find_references
/datum/verb/find_references(remove_from_queue = TRUE as num)
set category = "Debug"
set name = "Find References"
set background = 1
set src in world
running_find_references = type
if(usr && usr.client)
if(usr.client.running_find_references)
testing("CANCELLED search for references to a [usr.client.running_find_references].")
usr.client.running_find_references = null
running_find_references = null
return
if(alert("Running this will create a lot of lag until it finishes. You can cancel it by running it again. Would you like to begin the search?", "Find References", "Yes", "No") == "No")
running_find_references = null
return
// Remove this object from the list of things to be auto-deleted.
if(remove_from_queue && garbageCollector && ("\ref[src]" in garbageCollector.queue))
garbageCollector.queue -= "\ref[src]"
if(usr && usr.client)
usr.client.running_find_references = type
testing("Beginning search for references to a [type].")
var/list/things = list()
for(var/client/thing)
things |= thing
for(var/datum/thing)
things |= thing
testing("Collected list of things in search for references to a [type]. ([things.len] Thing\s)")
for(var/datum/thing in things)
if(usr && usr.client && !usr.client.running_find_references) return
for(var/varname in thing.vars)
var/variable = thing.vars[varname]
if(variable == src)
testing("Found [src.type] \ref[src] in [thing.type]'s [varname] var.")
else if(islist(variable))
if(src in variable)
testing("Found [src.type] \ref[src] in [thing.type]'s [varname] list var.")
testing("Completed search for references to a [type].")
if(usr && usr.client)
usr.client.running_find_references = null
running_find_references = null
/client/verb/purge_all_destroyed_objects()
set category = "Debug"
if(garbageCollector)
while(garbageCollector.queue.len)
var/datum/o = locate(garbageCollector.queue[1])
if(istype(o) && o.gcDestroyed)
del(o)
garbageCollector.dels_count++
garbageCollector.queue.Cut(1, 2)
/datum/verb/qdel_then_find_references()
set category = "Debug"
set name = "qdel() then Find References"
set background = 1
set src in world
qdel(src)
if(!running_find_references)
find_references(remove_from_queue = FALSE)
#endif