diff --git a/code/datums/diseases/advance/symptoms/dizzy.dm b/code/datums/diseases/advance/symptoms/dizzy.dm index 0a10a7bd066..14a01866ff4 100644 --- a/code/datums/diseases/advance/symptoms/dizzy.dm +++ b/code/datums/diseases/advance/symptoms/dizzy.dm @@ -33,5 +33,5 @@ Bonus M << "[pick("You feel dizzy.", "Your head starts spinning.")]" else M << "You are unable to look straight!" - M.make_dizzy(5) + M.Dizzy(5) return \ No newline at end of file diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 202dbf7ab76..0c0b676e32c 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -762,7 +762,7 @@ var/list/datum/dna/hivemind_bank = list() T << "You feel a small prick and your chest becomes tight." T.silent = 10 T.Paralyse(10) - T.make_jittery(1000) + T.Jitter(1000) if(T.reagents) T.reagents.add_reagent("lexorin", 40) feedback_add_details("changeling_powers","DTHS") return 1 @@ -785,4 +785,4 @@ var/list/datum/dna/hivemind_bank = list() changeling.absorbed_dna |= T.dna feedback_add_details("changeling_powers","ED") - return 1 \ No newline at end of file + return 1 diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index 82a1c6d17d4..c49bcdbdddc 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -26,7 +26,7 @@ /obj/item/weapon/melee/cultblade/pickup(mob/living/user as mob) if(!iscultist(user)) user << "\red An overwhelming feeling of dread comes over you as you pick up the cultist's sword. It would be wise to be rid of this blade quickly." - user.make_dizzy(120) + user.Dizzy(120) /obj/item/clothing/head/culthood diff --git a/code/game/gamemodes/vampire/vampire_powers.dm b/code/game/gamemodes/vampire/vampire_powers.dm index 18e7f97cfea..79a0966d860 100644 --- a/code/game/gamemodes/vampire/vampire_powers.dm +++ b/code/game/gamemodes/vampire/vampire_powers.dm @@ -220,7 +220,7 @@ C.ear_deaf = 20 C.stuttering = 20 C.Stun(8) - C.make_jittery(150) + C.Jitter(150) for(var/obj/structure/window/W in oview(3)) new W.shardtype(W.loc) if(W.reinf) new /obj/item/stack/rods(W.loc) diff --git a/code/game/mecha/combat/combat.dm b/code/game/mecha/combat/combat.dm index d75e62cc5fd..27a01a2a3a8 100644 --- a/code/game/mecha/combat/combat.dm +++ b/code/game/mecha/combat/combat.dm @@ -113,7 +113,7 @@ if(!istype(target, /obj) && !istype(target, /mob)) return if(istype(target, /mob)) var/mob/M = target - M.make_dizzy(3) + M.Dizzy(3) M.adjustBruteLoss(1) M.updatehealth() for (var/mob/V in viewers(src)) diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index 2773cff2fce..fd13ac64c84 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -148,7 +148,7 @@ M.Stun(10) M.Paralyse(4) else - M.make_jittery(500) + M.Jitter(500) ///else the mousetraps are useless if(istype(M, /mob/living/carbon/human)) var/mob/living/carbon/human/H = M diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 880b98d8552..b14055f28c5 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -19,7 +19,7 @@ /* 21st Sept 2010 Updated by Skie -- Still not perfect but better! Stuff you can't do: -Call proc /mob/proc/make_dizzy() for some player +Call proc /mob/proc/Dizzy() for some player Because if you select a player mob as owner it tries to do the proc for /mob/living/carbon/human/ instead. And that gives a run-time error. But you can call procs that are of type /mob/living/carbon/human/proc/ for that player. diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index dcfde83128f..2516d81ab6a 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -186,12 +186,12 @@ msg += "[t_He] [t_is] wearing \icon[wear_id] \a [wear_id].\n" //Jitters - if(is_jittery) - if(jitteriness >= 300) + switch(jitteriness) + if(300 to INFINITY) msg += "[t_He] [t_is] convulsing violently!\n" - else if(jitteriness >= 200) + if(200 to 300) msg += "[t_He] [t_is] extremely jittery.\n" - else if(jitteriness >= 100) + if(1 to 100) msg += "[t_He] [t_is] twitching ever so slightly.\n" //splints diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index f07920d3e21..63e6643f280 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -164,6 +164,7 @@ else return ONE_ATMOSPHERE - pressure_difference + /mob/living/carbon/human proc/handle_disabilities() @@ -175,7 +176,7 @@ continue O.show_message(text("\red [src] starts having a seizure!"), 1) Paralyse(10) - make_jittery(1000) + Jitter(1000) // If we have the gene for being crazy, have random events. if(dna.GetSEState(HALLUCINATIONBLOCK)) @@ -185,26 +186,19 @@ if (disabilities & COUGHING) if ((prob(5) && paralysis <= 1)) drop_item() - spawn( 0 ) - emote("cough") - return + emote("cough") if (disabilities & TOURETTES) if ((prob(10) && paralysis <= 1)) Stun(10) - spawn( 0 ) - switch(rand(1, 3)) - if(1) - emote("twitch") - if(2 to 3) - say("[prob(50) ? ";" : ""][pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS")]") - var/old_x = pixel_x - var/old_y = pixel_y - pixel_x += rand(-2,2) - pixel_y += rand(-1,1) - sleep(2) - pixel_x = old_x - pixel_y = old_y - return + switch(rand(1, 3)) + if(1) + emote("twitch") + if(2 to 3) + say("[prob(50) ? ";" : ""][pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS")]") + var/x_offset = pixel_x + rand(-2,2) + var/y_offset = pixel_y + rand(-1,1) + animate(src, pixel_x = x_offset, pixel_y = y_offset, time = 1) + animate(pixel_x = pixel_x, pixel_y = pixel_y, time = 1) if (disabilities & NERVOUS) if (prob(10)) stuttering = max(10, stuttering) @@ -1176,6 +1170,50 @@ else if(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs ear_damage = max(ear_damage-0.05, 0) + //Dizziness + if(dizziness) + var/client/C = client + var/pixel_x_diff = 0 + var/pixel_y_diff = 0 + var/temp + var/saved_dizz = dizziness + dizziness = max(dizziness-1, 0) + if(C) + var/oldsrc = src + var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 // This shit is annoying at high strength + src = null + spawn(0) + if(C) + temp = amplitude * sin(0.008 * saved_dizz * world.time) + pixel_x_diff += temp + C.pixel_x += temp + temp = amplitude * cos(0.008 * saved_dizz * world.time) + pixel_y_diff += temp + C.pixel_y += temp + sleep(3) + if(C) + temp = amplitude * sin(0.008 * saved_dizz * world.time) + pixel_x_diff += temp + C.pixel_x += temp + temp = amplitude * cos(0.008 * saved_dizz * world.time) + pixel_y_diff += temp + C.pixel_y += temp + sleep(3) + if(C) + C.pixel_x -= pixel_x_diff + C.pixel_y -= pixel_y_diff + src = oldsrc + + //Jitteryness + if(jitteriness) + var/amplitude = min(4, (jitteriness/100) + 1) + var/pixel_x_diff = rand(-amplitude, amplitude) + var/pixel_y_diff = rand(-amplitude/3, amplitude/3) + + animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = -1) + animate(pixel_x = pixel_x - pixel_x_diff, pixel_y = pixel_y - pixel_y_diff, time = 2) + jitteriness = max(jitteriness-1, 0) + //Other if(stunned) AdjustStunned(-1) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d64991d4c3b..4d3539afc09 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1,1261 +1,1194 @@ -/mob/Destroy()//This makes sure that mobs with clients/keys are not just deleted from the game. - mob_list -= src - dead_mob_list -= src - living_mob_list -= src - ghostize() - ..() - -/mob/New() - mob_list += src - if(stat == DEAD) - dead_mob_list += src - else - living_mob_list += src - ..() - -/mob/proc/Cell() - set category = "Admin" - set hidden = 1 - - if(!loc) return 0 - - var/datum/gas_mixture/environment = loc.return_air() - - var/t = "\blue Coordinates: [x],[y] \n" - t+= "\red Temperature: [environment.temperature] \n" - t+= "\blue Nitrogen: [environment.nitrogen] \n" - t+= "\blue Oxygen: [environment.oxygen] \n" - t+= "\blue Plasma : [environment.toxins] \n" - t+= "\blue Carbon Dioxide: [environment.carbon_dioxide] \n" - for(var/datum/gas/trace_gas in environment.trace_gases) - usr << "\blue [trace_gas.type]: [trace_gas.moles] \n" - - usr.show_message(t, 1) - -/mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2) - - if(!client) return - - if (type) - if(type & 1 && (sdisabilities & BLIND || blinded || paralysis) )//Vision related - if (!( alt )) - return - else - msg = alt - type = alt_type - if (type & 2 && (sdisabilities & DEAF || ear_deaf))//Hearing related - if (!( alt )) - return - else - msg = alt - type = alt_type - if ((type & 1 && sdisabilities & BLIND)) - return - // Added voice muffling for Issue 41. - if(stat == UNCONSCIOUS || sleeping > 0) - src << "... You can almost hear someone talking ..." - else - src << msg - return - -// Show a message to all mobs in sight of this one -// This would be for visible actions by the src mob -// message is the message output to anyone who can see e.g. "[src] does something!" -// self_message (optional) is what the src mob sees e.g. "You do something!" -// blind_message (optional) is what blind people will hear e.g. "You hear something!" - -/mob/visible_message(var/message, var/self_message, var/blind_message) - for(var/mob/M in viewers(src)) - var/msg = message - if(self_message && M==src) - msg = self_message - M.show_message( msg, 1, blind_message, 2) - -// Show a message to all mobs in sight of this atom -// Use for objects performing visible actions -// message is output to anyone who can see, e.g. "The [src] does something!" -// blind_message (optional) is what blind people will hear e.g. "You hear something!" -/atom/proc/visible_message(var/message, var/blind_message) - for(var/mob/M in viewers(src)) - M.show_message( message, 1, blind_message, 2) - -/mob/proc/findname(msg) - for(var/mob/M in mob_list) - if (M.real_name == text("[]", msg)) - return M - return 0 - -/mob/proc/movement_delay() - return 0 - -/mob/proc/Life() -// if(organStructure) -// organStructure.ProcessOrgans() - return - - -/mob/proc/restrained() - return - -//This proc is called whenever someone clicks an inventory ui slot. -/mob/proc/attack_ui(slot) - var/obj/item/W = get_active_hand() - - if(istype(W)) - equip_to_slot_if_possible(W, slot) - if(ishuman(src) && W == src:head) - src:update_hair() - -/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1, redraw_mob = 1) - if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning, redraw_mob)) - return 1 - else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning, redraw_mob)) - return 1 - return 0 - -//This is a SAFE proc. Use this instead of equip_to_splot()! -//set del_on_fail to have it delete W if it fails to equip -//set disable_warning to disable the 'you are unable to equip that' warning. -//unset redraw_mob to prevent the mob from being redrawn at the end. -/mob/proc/equip_to_slot_if_possible(obj/item/W as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1) - if(!istype(W)) return 0 - - if(!W.mob_can_equip(src, slot, disable_warning)) - if(del_on_fail) - del(W) - else - if(!disable_warning) - src << "\red You are unable to equip that." //Only print if del_on_fail is false - return 0 - - equip_to_slot(W, slot, redraw_mob) //This proc should not ever fail. - return 1 - -//This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't eqip need to be done before! Use mob_can_equip() for that task. -//In most cases you will want to use equip_to_slot_if_possible() -/mob/proc/equip_to_slot(obj/item/W as obj, slot) - return - -//This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such. -/mob/proc/equip_to_slot_or_del(obj/item/W as obj, slot) - return equip_to_slot_if_possible(W, slot, 1, 1, 0) - -// Convinience proc. Collects crap that fails to equip either onto the mob's back, or drops it. -// Used in job equipping so shit doesn't pile up at the start loc. -/mob/living/carbon/human/proc/equip_or_collect(var/obj/item/W, var/slot) - if(!equip_to_slot_or_del(W, slot)) - // Do I have a backpack? - var/obj/item/weapon/storage/B = back - - // Do I have a plastic bag? - if(!B) - B=is_in_hands(/obj/item/weapon/storage/bag/plasticbag) - - if(!B) - // Gimme one. - B=new /obj/item/weapon/storage/bag/plasticbag(null) // Null in case of failed equip. - if(!put_in_hands(B,slot_back)) - return // Fuck it - B.handle_item_insertion(W,1) - - -//The list of slots by priority. equip_to_appropriate_slot() uses this list. Doesn't matter if a mob type doesn't have a slot. -var/list/slot_equipment_priority = list( \ - slot_back,\ - slot_wear_id,\ - slot_wear_pda,\ - slot_w_uniform,\ - slot_wear_suit,\ - slot_wear_mask,\ - slot_head,\ - slot_shoes,\ - slot_gloves,\ - slot_l_ear,\ - slot_r_ear,\ - slot_glasses,\ - slot_belt,\ - slot_s_store,\ - slot_l_store,\ - slot_r_store\ - ) - -//puts the item "W" into an appropriate slot in a human's inventory -//returns 0 if it cannot, 1 if successful -/mob/proc/equip_to_appropriate_slot(obj/item/W) - if(!istype(W)) return 0 - - for(var/slot in slot_equipment_priority) - if(equip_to_slot_if_possible(W, slot, 0, 1, 1)) //del_on_fail = 0; disable_warning = 0; redraw_mob = 1 - return 1 - - return 0 - -/mob/proc/check_for_open_slot(obj/item/W) - if(!istype(W)) return 0 - var/openslot = 0 - for(var/slot in slot_equipment_priority) - if(W.mob_check_equip(src, slot, 1) == 1) - openslot = 1 - break - return openslot - -/obj/item/proc/mob_check_equip(M as mob, slot, disable_warning = 0) - if(!M) return 0 - if(!slot) return 0 - if(ishuman(M)) - //START HUMAN - var/mob/living/carbon/human/H = M - - switch(slot) - if(slot_l_hand) - if(H.l_hand) - return 0 - return 1 - if(slot_r_hand) - if(H.r_hand) - return 0 - return 1 - if(slot_wear_mask) - if( !(slot_flags & SLOT_MASK) ) - return 0 - if(H.wear_mask) - return 0 - return 1 - if(slot_back) - if( !(slot_flags & SLOT_BACK) ) - return 0 - if(H.back) - if(H.back.canremove) - return 2 - else - return 0 - return 1 - if(slot_wear_suit) - if( !(slot_flags & SLOT_OCLOTHING) ) - return 0 - if(H.wear_suit) - if(H.wear_suit.canremove) - return 2 - else - return 0 - return 1 - if(slot_gloves) - if( !(slot_flags & SLOT_GLOVES) ) - return 0 - if(H.gloves) - if(H.gloves.canremove) - return 2 - else - return 0 - return 1 - if(slot_shoes) - if( !(slot_flags & SLOT_FEET) ) - return 0 - if(H.shoes) - if(H.shoes.canremove) - return 2 - else - return 0 - return 1 - if(slot_belt) - if(!H.w_uniform) - if(!disable_warning) - H << "\red You need a jumpsuit before you can attach this [name]." - return 0 - if( !(slot_flags & SLOT_BELT) ) - return 0 - if(H.belt) - if(H.belt.canremove) - return 2 - else - return 0 - return 1 - if(slot_glasses) - if( !(slot_flags & SLOT_EYES) ) - return 0 - if(H.glasses) - if(H.glasses.canremove) - return 2 - else - return 0 - return 1 - if(slot_head) - if( !(slot_flags & SLOT_HEAD) ) - return 0 - if(H.head) - if(H.head.canremove) - return 2 - else - return 0 - return 1 - if(slot_l_ear) - if( !(slot_flags & slot_l_ear) ) - return 0 - if(H.l_ear) - if(H.l_ear.canremove) - return 2 - else - return 0 - return 1 - if(slot_r_ear) - if( !(slot_flags & slot_r_ear) ) - return 0 - if(H.r_ear) - if(H.r_ear.canremove) - return 2 - else - return 0 - return 1 - if(slot_w_uniform) - if( !(slot_flags & SLOT_ICLOTHING) ) - return 0 - if((M_FAT in H.mutations) && !(flags & ONESIZEFITSALL)) - return 0 - if(H.w_uniform) - if(H.w_uniform.canremove) - return 2 - else - return 0 - return 1 - if(slot_wear_id) - if(!H.w_uniform) - if(!disable_warning) - H << "\red You need a jumpsuit before you can attach this [name]." - return 0 - if( !(slot_flags & SLOT_ID) ) - return 0 - if(H.wear_id) - if(H.wear_id.canremove) - return 2 - else - return 0 - return 1 - if(slot_l_store) - if(H.l_store) - return 0 - if(!H.w_uniform) - if(!disable_warning) - H << "\red You need a jumpsuit before you can attach this [name]." - return 0 - if(slot_flags & SLOT_DENYPOCKET) - return - if( w_class <= 2 || (slot_flags & SLOT_POCKET) ) - return 1 - if(slot_r_store) - if(H.r_store) - return 0 - if(!H.w_uniform) - if(!disable_warning) - H << "\red You need a jumpsuit before you can attach this [name]." - return 0 - if(slot_flags & SLOT_DENYPOCKET) - return 0 - if( w_class <= 2 || (slot_flags & SLOT_POCKET) ) - return 1 - return 0 - if(slot_s_store) - if(!H.wear_suit) - if(!disable_warning) - H << "\red You need a suit before you can attach this [name]." - return 0 - if(!H.wear_suit.allowed) - if(!disable_warning) - usr << "You somehow have a suit with no defined allowed items for suit storage, stop that." - return 0 - if(src.w_class > 3) - if(!disable_warning) - usr << "The [name] is too big to attach." - return 0 - if( istype(src, /obj/item/device/pda) || istype(src, /obj/item/weapon/pen) || is_type_in_list(src, H.wear_suit.allowed) ) - if(H.s_store) - if(H.s_store.canremove) - return 2 - else - return 0 - else - return 1 - return 0 - if(slot_handcuffed) - if(H.handcuffed) - return 0 - if(!istype(src, /obj/item/weapon/handcuffs)) - return 0 - return 1 - if(slot_legcuffed) - if(H.legcuffed) - return 0 - if(!istype(src, /obj/item/weapon/legcuffs)) - return 0 - return 1 - if(slot_in_backpack) - if (H.back && istype(H.back, /obj/item/weapon/storage/backpack)) - var/obj/item/weapon/storage/backpack/B = H.back - if(B.contents.len < B.storage_slots && w_class <= B.max_w_class) - return 1 - return 0 - return 0 //Unsupported slot - //END HUMAN - -/mob/proc/reset_view(atom/A) - if (client) - if (istype(A, /atom/movable)) - client.perspective = EYE_PERSPECTIVE - client.eye = A - else - if (isturf(loc)) - client.eye = client.mob - client.perspective = MOB_PERSPECTIVE - else - client.perspective = EYE_PERSPECTIVE - client.eye = loc - return - - -/mob/proc/show_inv(mob/user as mob) - user.set_machine(src) - var/dat = {" -
[name]
-

-
Head(Mask): [(wear_mask ? wear_mask : "Nothing")] -
Left Hand: [(l_hand ? l_hand : "Nothing")] -
Right Hand: [(r_hand ? r_hand : "Nothing")] -
Back: [(back ? back : "Nothing")] [((istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/weapon/tank) && !( internal )) ? text(" Set Internal", src) : "")] -
[(internal ? text("Remove Internal") : "")] -
Empty Pockets -
Refresh -
Close -
"} - user << browse(dat, text("window=mob[];size=325x500", name)) - onclose(user, "mob\ref[src]") - return - -/mob/proc/ret_grab(obj/effect/list_container/mobl/L as obj, flag) - if ((!( istype(l_hand, /obj/item/weapon/grab) ) && !( istype(r_hand, /obj/item/weapon/grab) ))) - if (!( L )) - return null - else - return L.container - else - if (!( L )) - L = new /obj/effect/list_container/mobl( null ) - L.container += src - L.master = src - if (istype(l_hand, /obj/item/weapon/grab)) - var/obj/item/weapon/grab/G = l_hand - if (!( L.container.Find(G.affecting) )) - L.container += G.affecting - if (G.affecting) - G.affecting.ret_grab(L, 1) - if (istype(r_hand, /obj/item/weapon/grab)) - var/obj/item/weapon/grab/G = r_hand - if (!( L.container.Find(G.affecting) )) - L.container += G.affecting - if (G.affecting) - G.affecting.ret_grab(L, 1) - if (!( flag )) - if (L.master == src) - var/list/temp = list( ) - temp += L.container - //L = null - del(L) - return temp - else - return L.container - return - -/mob/verb/mode() - set name = "Activate Held Object" - set category = "Object" - set src = usr - - if(istype(loc,/obj/mecha)) return - - if(hand) - var/obj/item/W = l_hand - if (W) - W.attack_self(src) - update_inv_l_hand() - else - var/obj/item/W = r_hand - if (W) - W.attack_self(src) - update_inv_r_hand() - if(next_move < world.time) - next_move = world.time + 2 - return - -/* -/mob/verb/dump_source() - - var/master = "
"
-	for(var/t in typesof(/area))
-		master += text("[]\n", t)
-		//Foreach goto(26)
-	src << browse(master)
-	return
-*/
-
-/mob/verb/memory()
-	set name = "Notes"
-	set category = "IC"
-	if(mind)
-		mind.show_memory(src)
-	else
-		src << "The game appears to have misplaced your mind datum, so we can't show you your notes."
-
-/mob/verb/add_memory(msg as message)
-	set name = "Add Note"
-	set category = "IC"
-
-	msg = copytext(msg, 1, MAX_MESSAGE_LEN)
-	msg = sanitize(msg)
-
-	if(mind)
-		mind.store_memory(msg)
-	else
-		src << "The game appears to have misplaced your mind datum, so we can't show you your notes."
-
-/mob/proc/store_memory(msg as message, popup, sane = 1)
-	msg = copytext(msg, 1, MAX_MESSAGE_LEN)
-
-	if (sane)
-		msg = sanitize(msg)
-
-	if (length(memory) == 0)
-		memory += msg
-	else
-		memory += "
[msg]" - - if (popup) - memory() - -/mob/proc/update_flavor_text() - set src in usr - if(usr != src) - usr << "No." - var/msg = input(usr,"Set the flavor text in your 'examine' verb. Can also be used for OOC notes about your character.","Flavor Text",html_decode(flavor_text)) as message|null - - if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) - - flavor_text = msg - -/mob/proc/warn_flavor_changed() - if(flavor_text && flavor_text != "") // don't spam people that don't use it! - src << "

OOC Warning:

" - src << "Your flavor text is likely out of date! Change" - -/mob/proc/print_flavor_text() - if (flavor_text && flavor_text != "") - var/msg = replacetext(flavor_text, "\n", " ") - if(lentext(msg) <= 40) - return "\blue [msg]" - else - return "\blue [copytext(msg, 1, 37)]... More..." - -/* -/mob/verb/help() - set name = "Help" - src << browse('html/help.html', "window=help") - return -*/ -/* -/mob/verb/abandon_mob() - set name = "Respawn" - set category = "OOC" - - if (!( abandon_allowed )) - usr << "\blue Respawn is disabled." - return - if ((stat != 2 || !( ticker ))) - usr << "\blue You must be dead to use this!" - return - if (ticker.mode.name == "meteor" || ticker.mode.name == "epidemic") //BS12 EDIT - usr << "\blue Respawn is disabled." - return - else - var/deathtime = world.time - src.timeofdeath - var/deathtimeminutes = round(deathtime / 600) - var/pluralcheck = "minute" - if(deathtimeminutes == 0) - pluralcheck = "" - else if(deathtimeminutes == 1) - pluralcheck = " [deathtimeminutes] minute and" - else if(deathtimeminutes > 1) - pluralcheck = " [deathtimeminutes] minutes and" - var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10,1) - usr << "You have been dead for[pluralcheck] [deathtimeseconds] seconds." - if (deathtime < 18000) - usr << "You must wait 30 minutes to respawn!" - return - else - usr << "You can respawn now, enjoy your new life!" - - log_game("[usr.name]/[usr.key] used abandon mob.") - - usr << "\blue Make sure to play a different character, and please roleplay correctly!" - - if(!client) - log_game("[usr.key] AM failed due to disconnect.") - return - client.screen.Cut() - if(!client) - log_game("[usr.key] AM failed due to disconnect.") - return - - var/mob/new_player/M = new /mob/new_player() - if(!client) - log_game("[usr.key] AM failed due to disconnect.") - del(M) - return - - M.key = key -// M.Login() //wat - return -*/ -/mob/verb/observe() - set name = "Observe" - set category = "OOC" - var/is_admin = 0 - - if(client.holder && (client.holder.rights & R_ADMIN)) - is_admin = 1 - else if(stat != DEAD || istype(src, /mob/new_player)) - usr << "\blue You must be observing to use this!" - return - - if(is_admin && stat == DEAD) - is_admin = 0 - - var/list/names = list() - var/list/namecounts = list() - var/list/creatures = list() - - for(var/obj/O in world) //EWWWWWWWWWWWWWWWWWWWWWWWW ~needs to be optimised - if(!O.loc) - continue - if(istype(O, /obj/item/weapon/disk/nuclear)) - var/name = "Nuclear Disk" - if (names.Find(name)) - namecounts[name]++ - name = "[name] ([namecounts[name]])" - else - names.Add(name) - namecounts[name] = 1 - creatures[name] = O - - if(istype(O, /obj/machinery/singularity)) - var/name = "Singularity" - if (names.Find(name)) - namecounts[name]++ - name = "[name] ([namecounts[name]])" - else - names.Add(name) - namecounts[name] = 1 - creatures[name] = O - - if(istype(O, /obj/machinery/bot)) - var/name = "BOT: [O.name]" - if (names.Find(name)) - namecounts[name]++ - name = "[name] ([namecounts[name]])" - else - names.Add(name) - namecounts[name] = 1 - creatures[name] = O - - - for(var/mob/M in sortAtom(mob_list)) - var/name = M.name - if (names.Find(name)) - namecounts[name]++ - name = "[name] ([namecounts[name]])" - else - names.Add(name) - namecounts[name] = 1 - - creatures[name] = M - - - client.perspective = EYE_PERSPECTIVE - - var/eye_name = null - - var/ok = "[is_admin ? "Admin Observe" : "Observe"]" - eye_name = input("Please, select a player!", ok, null, null) as null|anything in creatures - - if (!eye_name) - return - - var/mob/mob_eye = creatures[eye_name] - - if(client && mob_eye) - client.eye = mob_eye - if (is_admin) - client.adminobs = 1 - if(mob_eye == client.mob || client.eye == client.mob) - client.adminobs = 0 - -/mob/verb/cancel_camera() - set name = "Cancel Camera View" - set category = "OOC" - reset_view(null) - unset_machine() - if(istype(src, /mob/living)) - if(src:cameraFollow) - src:cameraFollow = null - -/mob/Topic(href, href_list) - if(href_list["mach_close"]) - var/t1 = text("window=[href_list["mach_close"]]") - unset_machine() - src << browse(null, t1) - - if(href_list["flavor_more"]) - usr << browse(text("[][]", name, replacetext(flavor_text, "\n", "
")), text("window=[];size=500x200", name)) - onclose(usr, "[name]") - if(href_list["flavor_change"]) - update_flavor_text() - - -// ..() - return - - -/mob/proc/pull_damage() - if(ishuman(src)) - var/mob/living/carbon/human/H = src - if(H.health - H.halloss <= config.health_threshold_crit) - for(var/name in H.organs_by_name) - var/datum/organ/external/e = H.organs_by_name[name] - if((H.lying) && ((e.status & ORGAN_BROKEN && !(e.status & ORGAN_SPLINTED)) || e.status & ORGAN_BLEEDING) && (H.getBruteLoss() + H.getFireLoss() >= 100)) - return 1 - break - return 0 - -/mob/MouseDrop(mob/M as mob) - ..() - if(M != usr) return - if(usr == src) return - if(!Adjacent(usr)) return - if(istype(M,/mob/living/silicon/ai)) return - show_inv(usr) - - -/mob/verb/stop_pulling() - - set name = "Stop Pulling" - set category = "IC" - - if(pulling) - pulling.pulledby = null - pulling = null - -/mob/proc/start_pulling(var/atom/movable/AM) - - if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort! - return - - if (AM.anchored) - return - - var/mob/M = AM - if(ismob(AM)) - if(!iscarbon(src)) - M.LAssailant = null - else - M.LAssailant = usr - - if(pulling) - var/pulling_old = pulling - stop_pulling() - // Are we pulling the same thing twice? Just stop pulling. - if(pulling_old == AM) - return - - src.pulling = AM - AM.pulledby = src - - //Attempted fix for people flying away through space when cuffed and dragged. - if(ismob(AM)) - var/mob/pulled = AM - pulled.inertia_dir = 0 - -/mob/proc/can_use_hands() - return - -/mob/proc/is_active() - return (0 >= usr.stat) - -/mob/proc/see(message) - if(!is_active()) - return 0 - src << message - return 1 - -/mob/proc/show_viewers(message) - for(var/mob/M in viewers()) - M.see(message) - -/* -adds a dizziness amount to a mob -use this rather than directly changing var/dizziness -since this ensures that the dizzy_process proc is started -currently only humans get dizzy - -value of dizziness ranges from 0 to 1000 -below 100 is not dizzy -*/ -/mob/proc/make_dizzy(var/amount) - if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy - return - - dizziness = min(1000, dizziness + amount) // store what will be new value - // clamped to max 1000 - if(dizziness > 100 && !is_dizzy) - spawn(0) - dizzy_process() - - -/* -dizzy process - wiggles the client's pixel offset over time -spawned from make_dizzy(), will terminate automatically when dizziness gets <100 -note dizziness decrements automatically in the mob's Life() proc. -*/ -/mob/proc/dizzy_process() - is_dizzy = 1 - while(dizziness > 100) - if(client) - var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 - client.pixel_x = amplitude * sin(0.008 * dizziness * world.time) - client.pixel_y = amplitude * cos(0.008 * dizziness * world.time) - - sleep(1) - //endwhile - reset the pixel offsets to zero - is_dizzy = 0 - if(client) - client.pixel_x = 0 - client.pixel_y = 0 - -// jitteriness - copy+paste of dizziness - -/mob/proc/make_jittery(var/amount) - if(!istype(src, /mob/living/carbon/human)) // for the moment, only humans get dizzy - return - - jitteriness = min(1000, jitteriness + amount) // store what will be new value - // clamped to max 1000 - if(jitteriness > 100 && !is_jittery) - spawn(0) - jittery_process() - - -// Typo from the oriignal coder here, below lies the jitteriness process. So make of his code what you will, the previous comment here was just a copypaste of the above. -/mob/proc/jittery_process() - var/old_x = pixel_x - var/old_y = pixel_y - is_jittery = 1 - while(jitteriness > 100) -// var/amplitude = jitteriness*(sin(jitteriness * 0.044 * world.time) + 1) / 70 -// pixel_x = amplitude * sin(0.008 * jitteriness * world.time) -// pixel_y = amplitude * cos(0.008 * jitteriness * world.time) - - var/amplitude = min(4, jitteriness / 100) - pixel_x = rand(-amplitude, amplitude) - pixel_y = rand(-amplitude/3, amplitude/3) - - sleep(1) - //endwhile - reset the pixel offsets to zero - is_jittery = 0 - pixel_x = old_x - pixel_y = old_y - -/mob/Stat() - ..() - - if(statpanel("Status")) //not looking at that panel - - if(client && client.holder) - stat(null,"Location:\t([x], [y], [z])") - stat(null,"CPU:\t[world.cpu]") - stat(null,"Instances:\t[world.contents.len]") - - if(master_controller) - stat(null,"MasterController-[last_tick_duration] ([master_controller.processing?"On":"Off"]-[controller_iteration])") - stat(null,"Air-[master_controller.air_cost]\tSun-[master_controller.sun_cost]") - stat(null,"Mob-[master_controller.mobs_cost]\t#[mob_list.len]") - stat(null,"Dis-[master_controller.diseases_cost]\t#[active_diseases.len]") - stat(null,"Mch-[master_controller.machines_cost]\t#[machines.len]") - stat(null,"Obj-[master_controller.objects_cost]\t#[processing_objects.len]") - stat(null,"Net-[master_controller.networks_cost]\tPnet-[master_controller.powernets_cost]") - stat(null,"NanoUI-[master_controller.nano_cost]\t#[nanomanager.processing_uis.len]") - stat(null,"GC-[master_controller.gc_cost]\t#[garbage.queue.len]") - stat(null,"Tick-[master_controller.ticker_cost]\tALL-[master_controller.total_cost]") - else - stat(null,"MasterController-ERROR") - - if(listed_turf && client) - if(get_dist(listed_turf,src) > 1) - listed_turf = null - else - statpanel(listed_turf.name, null, listed_turf) - for(var/atom/A in listed_turf) - if(A.invisibility > see_invisible) - continue - statpanel(listed_turf.name, null, A) - - if(spell_list && spell_list.len) - for(var/obj/effect/proc_holder/spell/S in spell_list) - switch(S.charge_type) - if("recharge") - statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S) - if("charges") - statpanel(S.panel,"[S.charge_counter]/[S.charge_max]",S) - if("holdervar") - statpanel(S.panel,"[S.holder_var_type] [S.holder_var_amount]",S) - - if(listed_turf) - if(get_dist(listed_turf,src) > 1) - listed_turf = null - else - statpanel(listed_turf.name,listed_turf.name,listed_turf) - for(var/atom/A in listed_turf) - if(A.invisibility > see_invisible) - continue - statpanel(listed_turf.name,A.name,A) - - - -// facing verbs -/mob/proc/canface() - if(!canmove) return 0 - if(client.moving) return 0 - if(world.time < client.move_delay) return 0 - if(stat==2) return 0 - if(anchored) return 0 - if(monkeyizing) return 0 - if(restrained()) return 0 - return 1 - -//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it. -/mob/proc/update_canmove() - var/ko = weakened || paralysis || stat || (status_flags & FAKEDEATH) - if(ko || resting || buckled) - canmove = 0 - if(!lying) - if(resting) //Presuming that you're resting on a bed, which would look goofy lying the wrong way - lying = 90 - else - lying = pick(90, 270) //180 looks like shit since BYOND inverts rather than turns in that case - else if(stunned) - canmove = 0 - else - lying = 0 - canmove = 1 - if(buckled) - anchored = 1 - canmove = 0 - if( istype(buckled,/obj/structure/stool/bed/chair) ) - lying = 0 - else - lying = 1 - else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH)) - lying = 1 - canmove = 0 - else if( stunned ) -// lying = 0 - canmove = 0 - else - lying = !can_stand - canmove = has_limbs - - if(lying) - density = 0 - else - density = 1 - - //Temporarily moved here from the various life() procs - //I'm fixing stuff incrementally so this will likely find a better home. - //It just makes sense for now. ~Carn - - if(lying != lying_prev) - if(lying && !lying_prev) - fall(ko) - - if(update_icon) //forces a full overlay update - update_icon = 0 - regenerate_icons() - else if( lying != lying_prev ) - update_icons() - - return canmove - -/mob/proc/fall(var/forced) - drop_l_hand() - drop_r_hand() - -/mob/verb/eastface() - set hidden = 1 - if(!canface()) return 0 - dir = EAST - client.move_delay += movement_delay() - return 1 - - -/mob/verb/westface() - set hidden = 1 - if(!canface()) return 0 - dir = WEST - client.move_delay += movement_delay() - return 1 - - -/mob/verb/northface() - set hidden = 1 - if(!canface()) return 0 - dir = NORTH - client.move_delay += movement_delay() - return 1 - - -/mob/verb/southface() - set hidden = 1 - if(!canface()) return 0 - dir = SOUTH - client.move_delay += movement_delay() - return 1 - - -/mob/proc/IsAdvancedToolUser()//This might need a rename but it should replace the can this mob use things check - return 0 - - -/mob/proc/Stun(amount) - if(status_flags & CANSTUN) - stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun - return - -/mob/proc/SetStunned(amount) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned" - if(status_flags & CANSTUN) - stunned = max(amount,0) - return - -/mob/proc/AdjustStunned(amount) - if(status_flags & CANSTUN) - stunned = max(stunned + amount,0) - return - -/mob/proc/Weaken(amount) - if(status_flags & CANWEAKEN) - weakened = max(max(weakened,amount),0) - update_canmove() //updates lying, canmove and icons - return - -/mob/proc/SetWeakened(amount) - if(status_flags & CANWEAKEN) - weakened = max(amount,0) - update_canmove() //updates lying, canmove and icons - return - -/mob/proc/AdjustWeakened(amount) - if(status_flags & CANWEAKEN) - weakened = max(weakened + amount,0) - update_canmove() //updates lying, canmove and icons - return - -/mob/proc/Paralyse(amount) - if(status_flags & CANPARALYSE) - paralysis = max(max(paralysis,amount),0) - return - -/mob/proc/SetParalysis(amount) - if(status_flags & CANPARALYSE) - paralysis = max(amount,0) - return - -/mob/proc/AdjustParalysis(amount) - if(status_flags & CANPARALYSE) - paralysis = max(paralysis + amount,0) - return - -/mob/proc/Sleeping(amount) - sleeping = max(max(sleeping,amount),0) - return - -/mob/proc/SetSleeping(amount) - sleeping = max(amount,0) - return - -/mob/proc/AdjustSleeping(amount) - sleeping = max(sleeping + amount,0) - return - -/mob/proc/Resting(amount) - resting = max(max(resting,amount),0) - return - -/mob/proc/SetResting(amount) - resting = max(amount,0) - return - -/mob/proc/AdjustResting(amount) - resting = max(resting + amount,0) - return - -/mob/proc/get_species() - return "" - -/mob/proc/flash_weak_pain() - flick("weak_pain",pain) - -/mob/proc/get_visible_implants(var/class = 0) - var/list/visible_implants = list() - for(var/obj/item/O in embedded) - if(O.w_class > class) - visible_implants += O - return visible_implants - -mob/proc/yank_out_object() - set category = "Object" - set name = "Yank out object" - set desc = "Remove an embedded item at the cost of bleeding and pain." - set src in view(1) - - if(!isliving(usr) || usr.next_move > world.time) - return - usr.next_move = world.time + 20 - - if(usr.stat == 1) - usr << "You are unconcious and cannot do that!" - return - - if(usr.restrained()) - usr << "You are restrained and cannot do that!" - return - - var/mob/S = src - var/mob/U = usr - var/list/valid_objects = list() - var/self = null - - if(S == U) - self = 1 // Removing object from yourself. - - valid_objects = get_visible_implants(1) - if(!valid_objects.len) - if(self) - src << "You have nothing stuck in your body that is large enough to remove." - else - U << "[src] has nothing stuck in their wounds that is large enough to remove." - return - - var/obj/item/weapon/selection = input("What do you want to yank out?", "Embedded objects") in valid_objects - - if(self) - src << "You attempt to get a good grip on the [selection] in your body." - else - U << "You attempt to get a good grip on the [selection] in [S]'s body." - - if(!do_after(U, 80)) - return - if(!selection || !S || !U) - return - - if(self) - visible_message("[src] rips [selection] out of their body.","You rip [selection] out of your body.") - else - visible_message("[usr] rips [selection] out of [src]'s body.","[usr] rips [selection] out of your body.") - valid_objects = get_visible_implants(0) - if(valid_objects.len == 1) //Yanking out last object - removing verb. - src.verbs -= /mob/proc/yank_out_object - - if(istype(src,/mob/living/carbon/human)) - - var/mob/living/carbon/human/H = src - var/datum/organ/external/affected - - for(var/datum/organ/external/organ in H.organs) //Grab the organ holding the implant. - for(var/obj/item/weapon/O in organ.implants) - if(O == selection) - affected = organ - - affected.implants -= selection - H.shock_stage+=10 - H.bloody_hands(S) - - if(prob(10)) //I'M SO ANEMIC I COULD JUST -DIE-. - var/datum/wound/internal_bleeding/I = new (15) - affected.wounds += I - H.custom_pain("Something tears wetly in your [affected] as [selection] is pulled free!", 1) - - selection.loc = get_turf(src) - - for(var/obj/item/weapon/O in pinned) - if(O == selection) - pinned -= O - if(!pinned.len) - anchored = 0 - return 1 - - - -/mob/verb/respawn() - set name = "Respawn as NPC" - set category = "OOC" - - if((usr in respawnable_list) && (stat==2 || istype(usr,/mob/dead/observer))) - var/list/creatures = list("Mouse") - for(var/mob/living/L in living_mob_list) - if(safe_respawn(L.type)) - if(!L.key) - creatures += L - var/picked = input("Please select an NPC to respawn as", "Respawn as NPC") as null|anything in creatures - switch(picked) - if("Mouse") - respawnable_list -= usr - become_mouse() - spawn(5) - respawnable_list += usr - else - var/mob/living/NPC = picked - if(istype(NPC) && !NPC.key) - respawnable_list -= usr - NPC.key = key - spawn(5) - respawnable_list += usr - else -// message_admins("Failed to check type") - else - usr << "You are not dead or you have given up your right to be respawned!" - return - - -/mob/proc/become_mouse() - if(usr in respawnable_list) - var/timedifference = world.time - client.time_died_as_mouse - if(client.time_died_as_mouse && timedifference <= mouse_respawn_time * 600) - var/timedifference_text - timedifference_text = time2text(mouse_respawn_time * 600 - timedifference,"mm:ss") - src << "You may only spawn again as a mouse more than [mouse_respawn_time] minutes after your death. You have [timedifference_text] left." - return - - //find a viable mouse candidate - var/mob/living/simple_animal/mouse/host - var/obj/machinery/atmospherics/unary/vent_pump/vent_found - var/list/found_vents = list() - for(var/obj/machinery/atmospherics/unary/vent_pump/v in world) - if(!v.welded && v.z == src.z) - found_vents.Add(v) - if(found_vents.len) - vent_found = pick(found_vents) - host = new /mob/living/simple_animal/mouse(vent_found.loc) - else - src << "Unable to find any unwelded vents to spawn mice at." - - if(host) - host.ckey = src.ckey - host << "You are now a mouse. Try to avoid interaction with players, and do not give hints away that you are more than a simple rodent." - else - usr << "You are not dead or you have given up your right to be respawned!" - return +/mob/Destroy()//This makes sure that mobs with clients/keys are not just deleted from the game. + mob_list -= src + dead_mob_list -= src + living_mob_list -= src + ghostize() + ..() + +/mob/New() + mob_list += src + if(stat == DEAD) + dead_mob_list += src + else + living_mob_list += src + ..() + +/mob/proc/Cell() + set category = "Admin" + set hidden = 1 + + if(!loc) return 0 + + var/datum/gas_mixture/environment = loc.return_air() + + var/t = "\blue Coordinates: [x],[y] \n" + t+= "\red Temperature: [environment.temperature] \n" + t+= "\blue Nitrogen: [environment.nitrogen] \n" + t+= "\blue Oxygen: [environment.oxygen] \n" + t+= "\blue Plasma : [environment.toxins] \n" + t+= "\blue Carbon Dioxide: [environment.carbon_dioxide] \n" + for(var/datum/gas/trace_gas in environment.trace_gases) + usr << "\blue [trace_gas.type]: [trace_gas.moles] \n" + + usr.show_message(t, 1) + +/mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2) + + if(!client) return + + if (type) + if(type & 1 && (sdisabilities & BLIND || blinded || paralysis) )//Vision related + if (!( alt )) + return + else + msg = alt + type = alt_type + if (type & 2 && (sdisabilities & DEAF || ear_deaf))//Hearing related + if (!( alt )) + return + else + msg = alt + type = alt_type + if ((type & 1 && sdisabilities & BLIND)) + return + // Added voice muffling for Issue 41. + if(stat == UNCONSCIOUS || sleeping > 0) + src << "... You can almost hear someone talking ..." + else + src << msg + return + +// Show a message to all mobs in sight of this one +// This would be for visible actions by the src mob +// message is the message output to anyone who can see e.g. "[src] does something!" +// self_message (optional) is what the src mob sees e.g. "You do something!" +// blind_message (optional) is what blind people will hear e.g. "You hear something!" + +/mob/visible_message(var/message, var/self_message, var/blind_message) + for(var/mob/M in viewers(src)) + var/msg = message + if(self_message && M==src) + msg = self_message + M.show_message( msg, 1, blind_message, 2) + +// Show a message to all mobs in sight of this atom +// Use for objects performing visible actions +// message is output to anyone who can see, e.g. "The [src] does something!" +// blind_message (optional) is what blind people will hear e.g. "You hear something!" +/atom/proc/visible_message(var/message, var/blind_message) + for(var/mob/M in viewers(src)) + M.show_message( message, 1, blind_message, 2) + +/mob/proc/findname(msg) + for(var/mob/M in mob_list) + if (M.real_name == text("[]", msg)) + return M + return 0 + +/mob/proc/movement_delay() + return 0 + +/mob/proc/Life() +// if(organStructure) +// organStructure.ProcessOrgans() + return + + +/mob/proc/restrained() + return + +//This proc is called whenever someone clicks an inventory ui slot. +/mob/proc/attack_ui(slot) + var/obj/item/W = get_active_hand() + + if(istype(W)) + equip_to_slot_if_possible(W, slot) + if(ishuman(src) && W == src:head) + src:update_hair() + +/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1, redraw_mob = 1) + if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning, redraw_mob)) + return 1 + else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning, redraw_mob)) + return 1 + return 0 + +//This is a SAFE proc. Use this instead of equip_to_splot()! +//set del_on_fail to have it delete W if it fails to equip +//set disable_warning to disable the 'you are unable to equip that' warning. +//unset redraw_mob to prevent the mob from being redrawn at the end. +/mob/proc/equip_to_slot_if_possible(obj/item/W as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1) + if(!istype(W)) return 0 + + if(!W.mob_can_equip(src, slot, disable_warning)) + if(del_on_fail) + del(W) + else + if(!disable_warning) + src << "\red You are unable to equip that." //Only print if del_on_fail is false + return 0 + + equip_to_slot(W, slot, redraw_mob) //This proc should not ever fail. + return 1 + +//This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't eqip need to be done before! Use mob_can_equip() for that task. +//In most cases you will want to use equip_to_slot_if_possible() +/mob/proc/equip_to_slot(obj/item/W as obj, slot) + return + +//This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such. +/mob/proc/equip_to_slot_or_del(obj/item/W as obj, slot) + return equip_to_slot_if_possible(W, slot, 1, 1, 0) + +// Convinience proc. Collects crap that fails to equip either onto the mob's back, or drops it. +// Used in job equipping so shit doesn't pile up at the start loc. +/mob/living/carbon/human/proc/equip_or_collect(var/obj/item/W, var/slot) + if(!equip_to_slot_or_del(W, slot)) + // Do I have a backpack? + var/obj/item/weapon/storage/B = back + + // Do I have a plastic bag? + if(!B) + B=is_in_hands(/obj/item/weapon/storage/bag/plasticbag) + + if(!B) + // Gimme one. + B=new /obj/item/weapon/storage/bag/plasticbag(null) // Null in case of failed equip. + if(!put_in_hands(B,slot_back)) + return // Fuck it + B.handle_item_insertion(W,1) + + +//The list of slots by priority. equip_to_appropriate_slot() uses this list. Doesn't matter if a mob type doesn't have a slot. +var/list/slot_equipment_priority = list( \ + slot_back,\ + slot_wear_id,\ + slot_wear_pda,\ + slot_w_uniform,\ + slot_wear_suit,\ + slot_wear_mask,\ + slot_head,\ + slot_shoes,\ + slot_gloves,\ + slot_l_ear,\ + slot_r_ear,\ + slot_glasses,\ + slot_belt,\ + slot_s_store,\ + slot_l_store,\ + slot_r_store\ + ) + +//puts the item "W" into an appropriate slot in a human's inventory +//returns 0 if it cannot, 1 if successful +/mob/proc/equip_to_appropriate_slot(obj/item/W) + if(!istype(W)) return 0 + + for(var/slot in slot_equipment_priority) + if(equip_to_slot_if_possible(W, slot, 0, 1, 1)) //del_on_fail = 0; disable_warning = 0; redraw_mob = 1 + return 1 + + return 0 + +/mob/proc/check_for_open_slot(obj/item/W) + if(!istype(W)) return 0 + var/openslot = 0 + for(var/slot in slot_equipment_priority) + if(W.mob_check_equip(src, slot, 1) == 1) + openslot = 1 + break + return openslot + +/obj/item/proc/mob_check_equip(M as mob, slot, disable_warning = 0) + if(!M) return 0 + if(!slot) return 0 + if(ishuman(M)) + //START HUMAN + var/mob/living/carbon/human/H = M + + switch(slot) + if(slot_l_hand) + if(H.l_hand) + return 0 + return 1 + if(slot_r_hand) + if(H.r_hand) + return 0 + return 1 + if(slot_wear_mask) + if( !(slot_flags & SLOT_MASK) ) + return 0 + if(H.wear_mask) + return 0 + return 1 + if(slot_back) + if( !(slot_flags & SLOT_BACK) ) + return 0 + if(H.back) + if(H.back.canremove) + return 2 + else + return 0 + return 1 + if(slot_wear_suit) + if( !(slot_flags & SLOT_OCLOTHING) ) + return 0 + if(H.wear_suit) + if(H.wear_suit.canremove) + return 2 + else + return 0 + return 1 + if(slot_gloves) + if( !(slot_flags & SLOT_GLOVES) ) + return 0 + if(H.gloves) + if(H.gloves.canremove) + return 2 + else + return 0 + return 1 + if(slot_shoes) + if( !(slot_flags & SLOT_FEET) ) + return 0 + if(H.shoes) + if(H.shoes.canremove) + return 2 + else + return 0 + return 1 + if(slot_belt) + if(!H.w_uniform) + if(!disable_warning) + H << "\red You need a jumpsuit before you can attach this [name]." + return 0 + if( !(slot_flags & SLOT_BELT) ) + return 0 + if(H.belt) + if(H.belt.canremove) + return 2 + else + return 0 + return 1 + if(slot_glasses) + if( !(slot_flags & SLOT_EYES) ) + return 0 + if(H.glasses) + if(H.glasses.canremove) + return 2 + else + return 0 + return 1 + if(slot_head) + if( !(slot_flags & SLOT_HEAD) ) + return 0 + if(H.head) + if(H.head.canremove) + return 2 + else + return 0 + return 1 + if(slot_l_ear) + if( !(slot_flags & slot_l_ear) ) + return 0 + if(H.l_ear) + if(H.l_ear.canremove) + return 2 + else + return 0 + return 1 + if(slot_r_ear) + if( !(slot_flags & slot_r_ear) ) + return 0 + if(H.r_ear) + if(H.r_ear.canremove) + return 2 + else + return 0 + return 1 + if(slot_w_uniform) + if( !(slot_flags & SLOT_ICLOTHING) ) + return 0 + if((M_FAT in H.mutations) && !(flags & ONESIZEFITSALL)) + return 0 + if(H.w_uniform) + if(H.w_uniform.canremove) + return 2 + else + return 0 + return 1 + if(slot_wear_id) + if(!H.w_uniform) + if(!disable_warning) + H << "\red You need a jumpsuit before you can attach this [name]." + return 0 + if( !(slot_flags & SLOT_ID) ) + return 0 + if(H.wear_id) + if(H.wear_id.canremove) + return 2 + else + return 0 + return 1 + if(slot_l_store) + if(H.l_store) + return 0 + if(!H.w_uniform) + if(!disable_warning) + H << "\red You need a jumpsuit before you can attach this [name]." + return 0 + if(slot_flags & SLOT_DENYPOCKET) + return + if( w_class <= 2 || (slot_flags & SLOT_POCKET) ) + return 1 + if(slot_r_store) + if(H.r_store) + return 0 + if(!H.w_uniform) + if(!disable_warning) + H << "\red You need a jumpsuit before you can attach this [name]." + return 0 + if(slot_flags & SLOT_DENYPOCKET) + return 0 + if( w_class <= 2 || (slot_flags & SLOT_POCKET) ) + return 1 + return 0 + if(slot_s_store) + if(!H.wear_suit) + if(!disable_warning) + H << "\red You need a suit before you can attach this [name]." + return 0 + if(!H.wear_suit.allowed) + if(!disable_warning) + usr << "You somehow have a suit with no defined allowed items for suit storage, stop that." + return 0 + if(src.w_class > 3) + if(!disable_warning) + usr << "The [name] is too big to attach." + return 0 + if( istype(src, /obj/item/device/pda) || istype(src, /obj/item/weapon/pen) || is_type_in_list(src, H.wear_suit.allowed) ) + if(H.s_store) + if(H.s_store.canremove) + return 2 + else + return 0 + else + return 1 + return 0 + if(slot_handcuffed) + if(H.handcuffed) + return 0 + if(!istype(src, /obj/item/weapon/handcuffs)) + return 0 + return 1 + if(slot_legcuffed) + if(H.legcuffed) + return 0 + if(!istype(src, /obj/item/weapon/legcuffs)) + return 0 + return 1 + if(slot_in_backpack) + if (H.back && istype(H.back, /obj/item/weapon/storage/backpack)) + var/obj/item/weapon/storage/backpack/B = H.back + if(B.contents.len < B.storage_slots && w_class <= B.max_w_class) + return 1 + return 0 + return 0 //Unsupported slot + //END HUMAN + +/mob/proc/reset_view(atom/A) + if (client) + if (istype(A, /atom/movable)) + client.perspective = EYE_PERSPECTIVE + client.eye = A + else + if (isturf(loc)) + client.eye = client.mob + client.perspective = MOB_PERSPECTIVE + else + client.perspective = EYE_PERSPECTIVE + client.eye = loc + return + + +/mob/proc/show_inv(mob/user as mob) + user.set_machine(src) + var/dat = {" +
[name]
+

+
Head(Mask): [(wear_mask ? wear_mask : "Nothing")] +
Left Hand: [(l_hand ? l_hand : "Nothing")] +
Right Hand: [(r_hand ? r_hand : "Nothing")] +
Back: [(back ? back : "Nothing")] [((istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/weapon/tank) && !( internal )) ? text(" Set Internal", src) : "")] +
[(internal ? text("Remove Internal") : "")] +
Empty Pockets +
Refresh +
Close +
"} + user << browse(dat, text("window=mob[];size=325x500", name)) + onclose(user, "mob\ref[src]") + return + +/mob/proc/ret_grab(obj/effect/list_container/mobl/L as obj, flag) + if ((!( istype(l_hand, /obj/item/weapon/grab) ) && !( istype(r_hand, /obj/item/weapon/grab) ))) + if (!( L )) + return null + else + return L.container + else + if (!( L )) + L = new /obj/effect/list_container/mobl( null ) + L.container += src + L.master = src + if (istype(l_hand, /obj/item/weapon/grab)) + var/obj/item/weapon/grab/G = l_hand + if (!( L.container.Find(G.affecting) )) + L.container += G.affecting + if (G.affecting) + G.affecting.ret_grab(L, 1) + if (istype(r_hand, /obj/item/weapon/grab)) + var/obj/item/weapon/grab/G = r_hand + if (!( L.container.Find(G.affecting) )) + L.container += G.affecting + if (G.affecting) + G.affecting.ret_grab(L, 1) + if (!( flag )) + if (L.master == src) + var/list/temp = list( ) + temp += L.container + //L = null + del(L) + return temp + else + return L.container + return + +/mob/verb/mode() + set name = "Activate Held Object" + set category = "Object" + set src = usr + + if(istype(loc,/obj/mecha)) return + + if(hand) + var/obj/item/W = l_hand + if (W) + W.attack_self(src) + update_inv_l_hand() + else + var/obj/item/W = r_hand + if (W) + W.attack_self(src) + update_inv_r_hand() + if(next_move < world.time) + next_move = world.time + 2 + return + +/* +/mob/verb/dump_source() + + var/master = "
"
+	for(var/t in typesof(/area))
+		master += text("[]\n", t)
+		//Foreach goto(26)
+	src << browse(master)
+	return
+*/
+
+/mob/verb/memory()
+	set name = "Notes"
+	set category = "IC"
+	if(mind)
+		mind.show_memory(src)
+	else
+		src << "The game appears to have misplaced your mind datum, so we can't show you your notes."
+
+/mob/verb/add_memory(msg as message)
+	set name = "Add Note"
+	set category = "IC"
+
+	msg = copytext(msg, 1, MAX_MESSAGE_LEN)
+	msg = sanitize(msg)
+
+	if(mind)
+		mind.store_memory(msg)
+	else
+		src << "The game appears to have misplaced your mind datum, so we can't show you your notes."
+
+/mob/proc/store_memory(msg as message, popup, sane = 1)
+	msg = copytext(msg, 1, MAX_MESSAGE_LEN)
+
+	if (sane)
+		msg = sanitize(msg)
+
+	if (length(memory) == 0)
+		memory += msg
+	else
+		memory += "
[msg]" + + if (popup) + memory() + +/mob/proc/update_flavor_text() + set src in usr + if(usr != src) + usr << "No." + var/msg = input(usr,"Set the flavor text in your 'examine' verb. Can also be used for OOC notes about your character.","Flavor Text",html_decode(flavor_text)) as message|null + + if(msg != null) + msg = copytext(msg, 1, MAX_MESSAGE_LEN) + msg = html_encode(msg) + + flavor_text = msg + +/mob/proc/warn_flavor_changed() + if(flavor_text && flavor_text != "") // don't spam people that don't use it! + src << "

OOC Warning:

" + src << "Your flavor text is likely out of date! Change" + +/mob/proc/print_flavor_text() + if (flavor_text && flavor_text != "") + var/msg = replacetext(flavor_text, "\n", " ") + if(lentext(msg) <= 40) + return "\blue [msg]" + else + return "\blue [copytext(msg, 1, 37)]... More..." + +/* +/mob/verb/help() + set name = "Help" + src << browse('html/help.html', "window=help") + return +*/ +/* +/mob/verb/abandon_mob() + set name = "Respawn" + set category = "OOC" + + if (!( abandon_allowed )) + usr << "\blue Respawn is disabled." + return + if ((stat != 2 || !( ticker ))) + usr << "\blue You must be dead to use this!" + return + if (ticker.mode.name == "meteor" || ticker.mode.name == "epidemic") //BS12 EDIT + usr << "\blue Respawn is disabled." + return + else + var/deathtime = world.time - src.timeofdeath + var/deathtimeminutes = round(deathtime / 600) + var/pluralcheck = "minute" + if(deathtimeminutes == 0) + pluralcheck = "" + else if(deathtimeminutes == 1) + pluralcheck = " [deathtimeminutes] minute and" + else if(deathtimeminutes > 1) + pluralcheck = " [deathtimeminutes] minutes and" + var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10,1) + usr << "You have been dead for[pluralcheck] [deathtimeseconds] seconds." + if (deathtime < 18000) + usr << "You must wait 30 minutes to respawn!" + return + else + usr << "You can respawn now, enjoy your new life!" + + log_game("[usr.name]/[usr.key] used abandon mob.") + + usr << "\blue Make sure to play a different character, and please roleplay correctly!" + + if(!client) + log_game("[usr.key] AM failed due to disconnect.") + return + client.screen.Cut() + if(!client) + log_game("[usr.key] AM failed due to disconnect.") + return + + var/mob/new_player/M = new /mob/new_player() + if(!client) + log_game("[usr.key] AM failed due to disconnect.") + del(M) + return + + M.key = key +// M.Login() //wat + return +*/ +/mob/verb/observe() + set name = "Observe" + set category = "OOC" + var/is_admin = 0 + + if(client.holder && (client.holder.rights & R_ADMIN)) + is_admin = 1 + else if(stat != DEAD || istype(src, /mob/new_player)) + usr << "\blue You must be observing to use this!" + return + + if(is_admin && stat == DEAD) + is_admin = 0 + + var/list/names = list() + var/list/namecounts = list() + var/list/creatures = list() + + for(var/obj/O in world) //EWWWWWWWWWWWWWWWWWWWWWWWW ~needs to be optimised + if(!O.loc) + continue + if(istype(O, /obj/item/weapon/disk/nuclear)) + var/name = "Nuclear Disk" + if (names.Find(name)) + namecounts[name]++ + name = "[name] ([namecounts[name]])" + else + names.Add(name) + namecounts[name] = 1 + creatures[name] = O + + if(istype(O, /obj/machinery/singularity)) + var/name = "Singularity" + if (names.Find(name)) + namecounts[name]++ + name = "[name] ([namecounts[name]])" + else + names.Add(name) + namecounts[name] = 1 + creatures[name] = O + + if(istype(O, /obj/machinery/bot)) + var/name = "BOT: [O.name]" + if (names.Find(name)) + namecounts[name]++ + name = "[name] ([namecounts[name]])" + else + names.Add(name) + namecounts[name] = 1 + creatures[name] = O + + + for(var/mob/M in sortAtom(mob_list)) + var/name = M.name + if (names.Find(name)) + namecounts[name]++ + name = "[name] ([namecounts[name]])" + else + names.Add(name) + namecounts[name] = 1 + + creatures[name] = M + + + client.perspective = EYE_PERSPECTIVE + + var/eye_name = null + + var/ok = "[is_admin ? "Admin Observe" : "Observe"]" + eye_name = input("Please, select a player!", ok, null, null) as null|anything in creatures + + if (!eye_name) + return + + var/mob/mob_eye = creatures[eye_name] + + if(client && mob_eye) + client.eye = mob_eye + if (is_admin) + client.adminobs = 1 + if(mob_eye == client.mob || client.eye == client.mob) + client.adminobs = 0 + +/mob/verb/cancel_camera() + set name = "Cancel Camera View" + set category = "OOC" + reset_view(null) + unset_machine() + if(istype(src, /mob/living)) + if(src:cameraFollow) + src:cameraFollow = null + +/mob/Topic(href, href_list) + if(href_list["mach_close"]) + var/t1 = text("window=[href_list["mach_close"]]") + unset_machine() + src << browse(null, t1) + + if(href_list["flavor_more"]) + usr << browse(text("[][]", name, replacetext(flavor_text, "\n", "
")), text("window=[];size=500x200", name)) + onclose(usr, "[name]") + if(href_list["flavor_change"]) + update_flavor_text() + + +// ..() + return + + +/mob/proc/pull_damage() + if(ishuman(src)) + var/mob/living/carbon/human/H = src + if(H.health - H.halloss <= config.health_threshold_crit) + for(var/name in H.organs_by_name) + var/datum/organ/external/e = H.organs_by_name[name] + if((H.lying) && ((e.status & ORGAN_BROKEN && !(e.status & ORGAN_SPLINTED)) || e.status & ORGAN_BLEEDING) && (H.getBruteLoss() + H.getFireLoss() >= 100)) + return 1 + break + return 0 + +/mob/MouseDrop(mob/M as mob) + ..() + if(M != usr) return + if(usr == src) return + if(!Adjacent(usr)) return + if(istype(M,/mob/living/silicon/ai)) return + show_inv(usr) + + +/mob/verb/stop_pulling() + + set name = "Stop Pulling" + set category = "IC" + + if(pulling) + pulling.pulledby = null + pulling = null + +/mob/proc/start_pulling(var/atom/movable/AM) + + if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort! + return + + if (AM.anchored) + return + + var/mob/M = AM + if(ismob(AM)) + if(!iscarbon(src)) + M.LAssailant = null + else + M.LAssailant = usr + + if(pulling) + var/pulling_old = pulling + stop_pulling() + // Are we pulling the same thing twice? Just stop pulling. + if(pulling_old == AM) + return + + src.pulling = AM + AM.pulledby = src + + //Attempted fix for people flying away through space when cuffed and dragged. + if(ismob(AM)) + var/mob/pulled = AM + pulled.inertia_dir = 0 + +/mob/proc/can_use_hands() + return + +/mob/proc/is_active() + return (0 >= usr.stat) + +/mob/proc/see(message) + if(!is_active()) + return 0 + src << message + return 1 + +/mob/proc/show_viewers(message) + for(var/mob/M in viewers()) + M.see(message) + +/mob/Stat() + ..() + + if(statpanel("Status")) //not looking at that panel + + if(client && client.holder) + stat(null,"Location:\t([x], [y], [z])") + stat(null,"CPU:\t[world.cpu]") + stat(null,"Instances:\t[world.contents.len]") + + if(master_controller) + stat(null,"MasterController-[last_tick_duration] ([master_controller.processing?"On":"Off"]-[controller_iteration])") + stat(null,"Air-[master_controller.air_cost]\tSun-[master_controller.sun_cost]") + stat(null,"Mob-[master_controller.mobs_cost]\t#[mob_list.len]") + stat(null,"Dis-[master_controller.diseases_cost]\t#[active_diseases.len]") + stat(null,"Mch-[master_controller.machines_cost]\t#[machines.len]") + stat(null,"Obj-[master_controller.objects_cost]\t#[processing_objects.len]") + stat(null,"Net-[master_controller.networks_cost]\tPnet-[master_controller.powernets_cost]") + stat(null,"NanoUI-[master_controller.nano_cost]\t#[nanomanager.processing_uis.len]") + stat(null,"GC-[master_controller.gc_cost]\t#[garbage.queue.len]") + stat(null,"Tick-[master_controller.ticker_cost]\tALL-[master_controller.total_cost]") + else + stat(null,"MasterController-ERROR") + + if(listed_turf && client) + if(get_dist(listed_turf,src) > 1) + listed_turf = null + else + statpanel(listed_turf.name, null, listed_turf) + for(var/atom/A in listed_turf) + if(A.invisibility > see_invisible) + continue + statpanel(listed_turf.name, null, A) + + if(spell_list && spell_list.len) + for(var/obj/effect/proc_holder/spell/S in spell_list) + switch(S.charge_type) + if("recharge") + statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S) + if("charges") + statpanel(S.panel,"[S.charge_counter]/[S.charge_max]",S) + if("holdervar") + statpanel(S.panel,"[S.holder_var_type] [S.holder_var_amount]",S) + + if(listed_turf) + if(get_dist(listed_turf,src) > 1) + listed_turf = null + else + statpanel(listed_turf.name,listed_turf.name,listed_turf) + for(var/atom/A in listed_turf) + if(A.invisibility > see_invisible) + continue + statpanel(listed_turf.name,A.name,A) + + + +// facing verbs +/mob/proc/canface() + if(!canmove) return 0 + if(client.moving) return 0 + if(world.time < client.move_delay) return 0 + if(stat==2) return 0 + if(anchored) return 0 + if(monkeyizing) return 0 + if(restrained()) return 0 + return 1 + +//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it. +/mob/proc/update_canmove() + var/ko = weakened || paralysis || stat || (status_flags & FAKEDEATH) + if(ko || resting || buckled) + canmove = 0 + if(!lying) + if(resting) //Presuming that you're resting on a bed, which would look goofy lying the wrong way + lying = 90 + else + lying = pick(90, 270) //180 looks like shit since BYOND inverts rather than turns in that case + else if(stunned) + canmove = 0 + else + lying = 0 + canmove = 1 + if(buckled) + anchored = 1 + canmove = 0 + if( istype(buckled,/obj/structure/stool/bed/chair) ) + lying = 0 + else + lying = 1 + else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH)) + lying = 1 + canmove = 0 + else if( stunned ) +// lying = 0 + canmove = 0 + else + lying = !can_stand + canmove = has_limbs + + if(lying) + density = 0 + else + density = 1 + + //Temporarily moved here from the various life() procs + //I'm fixing stuff incrementally so this will likely find a better home. + //It just makes sense for now. ~Carn + + if(lying != lying_prev) + if(lying && !lying_prev) + fall(ko) + + if(update_icon) //forces a full overlay update + update_icon = 0 + regenerate_icons() + else if( lying != lying_prev ) + update_icons() + + return canmove + +/mob/proc/fall(var/forced) + drop_l_hand() + drop_r_hand() + +/mob/verb/eastface() + set hidden = 1 + if(!canface()) return 0 + dir = EAST + client.move_delay += movement_delay() + return 1 + + +/mob/verb/westface() + set hidden = 1 + if(!canface()) return 0 + dir = WEST + client.move_delay += movement_delay() + return 1 + + +/mob/verb/northface() + set hidden = 1 + if(!canface()) return 0 + dir = NORTH + client.move_delay += movement_delay() + return 1 + + +/mob/verb/southface() + set hidden = 1 + if(!canface()) return 0 + dir = SOUTH + client.move_delay += movement_delay() + return 1 + + +/mob/proc/IsAdvancedToolUser()//This might need a rename but it should replace the can this mob use things check + return 0 + + +/mob/proc/Jitter(amount) + jitteriness = max(jitteriness,amount,0) + +/mob/proc/Dizzy(amount) + dizziness = max(dizziness,amount,0) + +/mob/proc/Stun(amount) + if(status_flags & CANSTUN) + stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun + return + +/mob/proc/SetStunned(amount) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned" + if(status_flags & CANSTUN) + stunned = max(amount,0) + return + +/mob/proc/AdjustStunned(amount) + if(status_flags & CANSTUN) + stunned = max(stunned + amount,0) + return + +/mob/proc/Weaken(amount) + if(status_flags & CANWEAKEN) + weakened = max(max(weakened,amount),0) + update_canmove() //updates lying, canmove and icons + return + +/mob/proc/SetWeakened(amount) + if(status_flags & CANWEAKEN) + weakened = max(amount,0) + update_canmove() //updates lying, canmove and icons + return + +/mob/proc/AdjustWeakened(amount) + if(status_flags & CANWEAKEN) + weakened = max(weakened + amount,0) + update_canmove() //updates lying, canmove and icons + return + +/mob/proc/Paralyse(amount) + if(status_flags & CANPARALYSE) + paralysis = max(max(paralysis,amount),0) + return + +/mob/proc/SetParalysis(amount) + if(status_flags & CANPARALYSE) + paralysis = max(amount,0) + return + +/mob/proc/AdjustParalysis(amount) + if(status_flags & CANPARALYSE) + paralysis = max(paralysis + amount,0) + return + +/mob/proc/Sleeping(amount) + sleeping = max(max(sleeping,amount),0) + return + +/mob/proc/SetSleeping(amount) + sleeping = max(amount,0) + return + +/mob/proc/AdjustSleeping(amount) + sleeping = max(sleeping + amount,0) + return + +/mob/proc/Resting(amount) + resting = max(max(resting,amount),0) + return + +/mob/proc/SetResting(amount) + resting = max(amount,0) + return + +/mob/proc/AdjustResting(amount) + resting = max(resting + amount,0) + return + +/mob/proc/get_species() + return "" + +/mob/proc/flash_weak_pain() + flick("weak_pain",pain) + +/mob/proc/get_visible_implants(var/class = 0) + var/list/visible_implants = list() + for(var/obj/item/O in embedded) + if(O.w_class > class) + visible_implants += O + return visible_implants + +mob/proc/yank_out_object() + set category = "Object" + set name = "Yank out object" + set desc = "Remove an embedded item at the cost of bleeding and pain." + set src in view(1) + + if(!isliving(usr) || usr.next_move > world.time) + return + usr.next_move = world.time + 20 + + if(usr.stat == 1) + usr << "You are unconcious and cannot do that!" + return + + if(usr.restrained()) + usr << "You are restrained and cannot do that!" + return + + var/mob/S = src + var/mob/U = usr + var/list/valid_objects = list() + var/self = null + + if(S == U) + self = 1 // Removing object from yourself. + + valid_objects = get_visible_implants(1) + if(!valid_objects.len) + if(self) + src << "You have nothing stuck in your body that is large enough to remove." + else + U << "[src] has nothing stuck in their wounds that is large enough to remove." + return + + var/obj/item/weapon/selection = input("What do you want to yank out?", "Embedded objects") in valid_objects + + if(self) + src << "You attempt to get a good grip on the [selection] in your body." + else + U << "You attempt to get a good grip on the [selection] in [S]'s body." + + if(!do_after(U, 80)) + return + if(!selection || !S || !U) + return + + if(self) + visible_message("[src] rips [selection] out of their body.","You rip [selection] out of your body.") + else + visible_message("[usr] rips [selection] out of [src]'s body.","[usr] rips [selection] out of your body.") + valid_objects = get_visible_implants(0) + if(valid_objects.len == 1) //Yanking out last object - removing verb. + src.verbs -= /mob/proc/yank_out_object + + if(istype(src,/mob/living/carbon/human)) + + var/mob/living/carbon/human/H = src + var/datum/organ/external/affected + + for(var/datum/organ/external/organ in H.organs) //Grab the organ holding the implant. + for(var/obj/item/weapon/O in organ.implants) + if(O == selection) + affected = organ + + affected.implants -= selection + H.shock_stage+=10 + H.bloody_hands(S) + + if(prob(10)) //I'M SO ANEMIC I COULD JUST -DIE-. + var/datum/wound/internal_bleeding/I = new (15) + affected.wounds += I + H.custom_pain("Something tears wetly in your [affected] as [selection] is pulled free!", 1) + + selection.loc = get_turf(src) + + for(var/obj/item/weapon/O in pinned) + if(O == selection) + pinned -= O + if(!pinned.len) + anchored = 0 + return 1 + + + +/mob/verb/respawn() + set name = "Respawn as NPC" + set category = "OOC" + + if((usr in respawnable_list) && (stat==2 || istype(usr,/mob/dead/observer))) + var/list/creatures = list("Mouse") + for(var/mob/living/L in living_mob_list) + if(safe_respawn(L.type)) + if(!L.key) + creatures += L + var/picked = input("Please select an NPC to respawn as", "Respawn as NPC") as null|anything in creatures + switch(picked) + if("Mouse") + respawnable_list -= usr + become_mouse() + spawn(5) + respawnable_list += usr + else + var/mob/living/NPC = picked + if(istype(NPC) && !NPC.key) + respawnable_list -= usr + NPC.key = key + spawn(5) + respawnable_list += usr + else +// message_admins("Failed to check type") + else + usr << "You are not dead or you have given up your right to be respawned!" + return + + +/mob/proc/become_mouse() + if(usr in respawnable_list) + var/timedifference = world.time - client.time_died_as_mouse + if(client.time_died_as_mouse && timedifference <= mouse_respawn_time * 600) + var/timedifference_text + timedifference_text = time2text(mouse_respawn_time * 600 - timedifference,"mm:ss") + src << "You may only spawn again as a mouse more than [mouse_respawn_time] minutes after your death. You have [timedifference_text] left." + return + + //find a viable mouse candidate + var/mob/living/simple_animal/mouse/host + var/obj/machinery/atmospherics/unary/vent_pump/vent_found + var/list/found_vents = list() + for(var/obj/machinery/atmospherics/unary/vent_pump/v in world) + if(!v.welded && v.z == src.z) + found_vents.Add(v) + if(found_vents.len) + vent_found = pick(found_vents) + host = new /mob/living/simple_animal/mouse(vent_found.loc) + else + src << "Unable to find any unwelded vents to spawn mice at." + + if(host) + host.ckey = src.ckey + host << "You are now a mouse. Try to avoid interaction with players, and do not give hints away that you are more than a simple rodent." + else + usr << "You are not dead or you have given up your right to be respawned!" + return diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index d954f367644..c763a7b6f91 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -99,8 +99,6 @@ var/bodytemperature = 310.055 //98.7 F var/drowsyness = 0.0//Carbon var/dizziness = 0//Carbon - var/is_dizzy = 0 - var/is_jittery = 0 var/jitteriness = 0//Carbon var/charges = 0.0 var/nutrition = 400.0//Carbon @@ -226,4 +224,4 @@ var/list/active_genes=list() - var/last_movement = -100 // Last world.time the mob actually moved of its own accord. + var/last_movement = -100 // Last world.time the mob actually moved of its own accord. \ No newline at end of file diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index bb5294d9877..b506ffcd450 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -1475,7 +1475,7 @@ datum on_mob_life(var/mob/living/M as mob) if(!M) M = holder.my_atom - M.make_dizzy(1) + M.Dizzy(1) if(!M.confused) M.confused = 1 M.confused = max(M.confused, 20) holder.remove_reagent(src.id, 0.5 * REAGENTS_METABOLISM) @@ -1906,8 +1906,8 @@ datum M.status_flags &= ~DISFIGURED if(35 to INFINITY) M.adjustToxLoss(1) - M.make_dizzy(5) - M.make_jittery(5) + M.Dizzy(5) + M.Jitter(5) ..() return @@ -2036,7 +2036,7 @@ datum on_mob_life(var/mob/living/M as mob) if(!data) data = 1 data++ - M.make_dizzy(5) + M.Dizzy(5) M.jitteriness = max(M.jitteriness-5,0) if(data >= 25) if (!M.stuttering) M.stuttering = 1 @@ -2464,18 +2464,18 @@ datum switch(data) if(1 to 5) if (!M.stuttering) M.stuttering = 1 - M.make_dizzy(5) + M.Dizzy(5) if(prob(10)) M.emote(pick("twitch","giggle")) if(5 to 10) if (!M.stuttering) M.stuttering = 1 - M.make_jittery(10) - M.make_dizzy(10) + M.Jitter(10) + M.Dizzy(10) M.druggy = max(M.druggy, 35) if(prob(20)) M.emote(pick("twitch","giggle")) if (10 to INFINITY) if (!M.stuttering) M.stuttering = 1 - M.make_jittery(20) - M.make_dizzy(20) + M.Jitter(20) + M.Dizzy(20) M.druggy = max(M.druggy, 40) if(prob(30)) M.emote(pick("twitch","giggle")) holder.remove_reagent(src.id, 0.2) @@ -2731,6 +2731,7 @@ datum if(M.getToxLoss() && prob(20)) M.adjustToxLoss(-1) return + carrotjuice name = "Carrot juice" id = "carrotjuice" @@ -2860,7 +2861,7 @@ datum on_mob_life(var/mob/living/M as mob) ..() - M.make_jittery(5) + M.Jitter(5) if(adj_temp > 0 && holder.has_reagent("frostoil")) holder.remove_reagent("frostoil", 10*REAGENTS_METABOLISM) @@ -2916,12 +2917,13 @@ datum M.adjustToxLoss(-1) return - icetea - name = "Iced Tea" - id = "icetea" - description = "No relation to a certain rap artist/ actor." - color = "#104038" // rgb: 16, 64, 56 - adj_temp = -5 + + icetea + name = "Iced Tea" + id = "icetea" + description = "No relation to a certain rap artist/ actor." + color = "#104038" // rgb: 16, 64, 56 + adj_temp = -5 kahlua name = "Kahlua" @@ -2934,7 +2936,7 @@ datum on_mob_life(var/mob/living/M as mob) ..() - M.make_jittery(5) + M.Jitter(5) return cold @@ -2981,7 +2983,7 @@ datum adj_sleepy = -2 on_mob_life(var/mob/living/M as mob) - M.make_jittery(20) + M.Jitter(20) M.druggy = max(M.druggy, 30) M.dizziness +=5 M.drowsyness = 0 @@ -3075,7 +3077,7 @@ datum on_mob_life(var/mob/living/M as mob) ..() - M.make_jittery(5) + M.Jitter(5) return hippies_delight @@ -3092,18 +3094,18 @@ datum switch(data) if(1 to 5) if (!M.stuttering) M.stuttering = 1 - M.make_dizzy(10) + M.Dizzy(10) if(prob(10)) M.emote(pick("twitch","giggle")) if(5 to 10) if (!M.stuttering) M.stuttering = 1 - M.make_jittery(20) - M.make_dizzy(20) + M.Jitter(20) + M.Dizzy(20) M.druggy = max(M.druggy, 45) if(prob(20)) M.emote(pick("twitch","giggle")) if (10 to INFINITY) if (!M.stuttering) M.stuttering = 1 - M.make_jittery(40) - M.make_dizzy(40) + M.Jitter(40) + M.Dizzy(40) M.druggy = max(M.druggy, 60) if(prob(30)) M.emote(pick("twitch","giggle")) holder.remove_reagent(src.id, 0.2) @@ -3164,7 +3166,6 @@ datum if (istype(L)) L.take_damage(0.1, 1) H.adjustToxLoss(0.1) - holder.remove_reagent(src.id, 0.4) ..() return @@ -3327,7 +3328,7 @@ datum // M:sleeping = max(0,M.sleeping-2) if (M.bodytemperature > 310) M.bodytemperature = max(310, M.bodytemperature-5) - M.make_jittery(1) + M.Jitter(1) return diff --git a/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_hurt.dm b/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_hurt.dm index 5cf460049dd..466c9565da8 100644 --- a/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_hurt.dm +++ b/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_hurt.dm @@ -16,7 +16,7 @@ C.adjustBrainLoss(rand(5,25) * weakness) C.radiation += 25 * weakness C.nutrition -= min(50 * weakness, C.nutrition) - C.make_dizzy(6 * weakness) + C.Dizzy(6 * weakness) C.weakened += 6 * weakness /datum/artifact_effect/hurt/DoEffectAura()