mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
## Main Additions and Modifications This PR adds in a quite a few new things. ### Overview **WT-550 "Enhancements"** - made available via research. These modifications retain the full-auto capability of the WT-550 to varying degrees. Additionally a compressed WT550 magazine is available via research. It contains 40 weaker bullets compared to the normal magazine's 20. It is only allowed to contain compressed bullets to avoid cheesing, and requires bluespace to fabricate. It is designed as a sustained dps ammunition as opposed to a high dps ammunition **WT-550-B** - Shoots in bursts with decent recoil and slightly higher dps. **WT-550-C** - Shoots slower but has a higher damage and projectile velocity along with a scope. **Sawn-off WT-550** - Is smaller but has egregious recoil and spread. **.38 BR** - A simple but slightly less powerful alternative to the NT-38 battle rifle. Craftable via a kit obtained from research. **Stunstaff** - A weapon that is available via crafting and functions as an alternative to a baton and riot shield. A heroic variant exists within the code but the recipe can only be learned from a book that sometimes spawns in the armory contraband closet. **Advanced Energy SMG** - A hybrid of a disabler SMG, laser carbine, and advanced energy gun. Does exactly what you think it does. Obtainable via crafting. **Stingballer** - A rifle that rapidly shoots stingballs. Direct damage is lesser than a stingbang. Purchasable from cargo. **Security Juggernaut Suit** - A heavily armoured suit that severely cripples your mobility in exchange for very high protection. Crafting kit is printable from a technode. **Horizon Beam Rifle** - Damage is now 110 with 35 armor piercing, and a demo mod of 2. Upon contact with walls, it destroys them like how a pulse laser does. ### Crafting WT-550 weapons can all be made with just the gun and the kit. The sawn-off WT550 can be made by taking a saw to the WT550. The .38 BR requires an NT-38 battle rifle along with a multitool and a screwdriver. The Advanced Energy SMG requires a disabler smg, laser carbine, and an advanced energy gun. The Stunstaff requires two security batons, some plasteel and some cable, along with a welder and wrench. The Heroic Stunstaff requires some other ingredients. The Security Juggernaut suit requires a full toolbox of tools as well as the armor plates, a full coil of cable, a pair of magboots, a swat helmet, a swat suit, and two seclites. Stingbangs can be prepared into stingball canisters with a screwdriver and some wirecutters. Each contains 25 rounds are are used to fill the stingballer. ### Cargo **Stingballer** - Armory crate - Contains one stingballer. - 4500 credits. **Grenade Launcher** - Armory crate - Contains one grenade launcher and a box of flashbangs. - 15000 credits. **Kiboko Grenade Launcher** - Armory crate - Contains one Kiboko grenade launcher. - 7500 credits. ### R&D The **"Ballisitic Research"** technode has been removed and dragon's breath shells have been moved to the illegal technology node. The node remains within the code though if more exotic ammunition is developed and requires an additional research node for it. New **"Advanced Ballistics"** technode contains the part kits for the WT-550 modifications and NT-BR simplification kit and requires Exotic Ammunition to research. New **"Advanced Armor"** technode contains the Security Juggernaut Plates and requires Riot Suppression and Gas Compression to research. ### Code Adds to the buckling system where if something has TRAIT_NO_BUCKLE, it cannot be buckled at all. Adds to the vehicle system where if something has TRAIT_NO_VEHICLE, it will be flung off the vehicle it attempts to move the vehicle themselves. Adds to the chair system where if something has TRAIT_NO_VEHICLE, it will destroy the chair. Adds to the movement system where if something has TRAIT_LARGE_CLOTHES, TRAIT_BULKY_CLOTHES, or TRAIT_HUGE_CLOTHES, it will incur a 3, 4, and 5 move speed multiplier when pulling that thing. If anyone can help me do this more modular, please reach out, I have no clue how. Edits the equipment slowdown system to properly apply a special slowdown that cannot be negated by anything. Requires the TRUE_IMMUTABLE_SLOW bubber_obj_flag to be present. IMMUTABLE_SLOW is still required for red potion immunity. ### Other Misc. Changes The WT-551 has been effectively rendered impossible to get. This decision stems from the fact that the WT-550 and the WT-551 were functionally identical when used in-game. Instances of the 551 have been replaced with the 550. Skyrat's renaming of /tg/ bullets has been completely removed. Some descriptions have been kept and altered because they were kinda neat. .460 Ceres -> .45 .416 Stabilis -> .50 BMG 8mm Usurpator -> 4.6x30mm .454 Trucidator -> .50 Action Express .277 Aestus -> .223 ## Statistics For New Additions **Stunstaff** <img width="32" height="32" alt="image" src="https://github.com/user-attachments/assets/0e1c2a1a-20ba-47a9-91f1-e63ca11b5e43" /> - Two-handed, bulky. Fits on the back and an armor vest. - 65 stamina damage - 20 stun armour penetration - 14 force - 8 throw force - 50 block chance - 20 effective block vs tackles - 10 effective block vs projectiles **Heroic Stunstaff** - 24 stamina damage - 0.5 second stun - 4 times the cell charge consumption - No cooldown between stuns - 35 stun armor penetration - 15 force - 10 throw force - 75% throw stun chance - Can be thrown like a boomerang - 75 block chance - 30 effective block vs tackles - 50 effective block vs projectiles **WT-550-B** <img width="32" height="32" alt="image" src="https://github.com/user-attachments/assets/56fea4dd-9b0c-4e06-93a7-b0389f3d32c9" /> - Bulky sized, small weapon weight, dual wielding. - 2 round burst every 0.5 seconds - 0.25 recoil - 3 spread - Can be suppressed **WT-550-C** <img width="48" height="32" alt="image" src="https://github.com/user-attachments/assets/bd80570d-3e70-463d-8b6b-7cefcb1d54e6" /> - Bulky sized, heavy weapon weight, no dual wielding. - Half fire rate of normal WT (0.6 compared to 0.3) - 1.5x damage multiplier - 1.5x projectile speed multiplier - +5 projectile wound bonus - Can be Suppressed - Mediocre Scope **Sawn-off WT-550** <img width="32" height="32" alt="image" src="https://github.com/user-attachments/assets/6d786022-2d93-42da-9dcc-fe6dfadbbce1" /> - Normal sized, light weapon weight, dual wielding - 10 spread - 20 dual wielded spread - Sawn-off recoil (high) **Compressed WT-550 magazine** - 40 capacity - 12 damage (20 for normal rounds) **Stingballer** <img width="32" height="32" alt="image" src="https://github.com/user-attachments/assets/de30bda5-9e0b-44da-8097-ca9827d3d8c8" /> - Bulky sized, normal weapon weight, no dual wielding. - 8 rounds per second - 7.5 spread - 50 round capacity - 1.5 damage - 4 stamina damage - Embed chance at close range - Bouncy projectile - Low effective range **.38 Battle Rifle** <img width="48" height="32" alt="image" src="https://github.com/user-attachments/assets/24a9a257-97fe-4313-ba39-93d17230f1b4" /> - Overall same statistics as the NT-38 Battle Rifle except for - 1.0x damage multiplier (compared to 1.2x) - 1.0x projectile speed multiplier (compared to 1.2x) - 25.0% faster rate of fire (1.5 compared to 2) - No degradation mechanics - No scope **Advanced Energy SMG** <img width="32" height="32" alt="image" src="https://github.com/user-attachments/assets/2671009a-a994-4054-92ff-4db2959501e8" /> - Bulky Size, no dual wielding. - 0.8x damage multiplier (12 on kill, 12 on disable) - 1.2x projectile speed multiplier - 40 shots on kill, 40 shots on disable - Charges about half as fast as the regular advanced energy gun. - Same fire rate as the disabler SMG - 2 spread **Security Juggernaut Suit** <img width="32" height="32" alt="image" src="https://github.com/user-attachments/assets/5de0a084-4a07-4d8f-88a3-d9996de41010" /> - Built in helmet - Helmet protects head from flashes, loud noises, impacts and pepperspray - Full temperature and pressure protection - Helmet has powerful flashlight mounted - Takes 12 seconds to put on, 15 to put on someone else - Slows you down everywhere - Slows you down when in-hand - Slows down someone who's dragging you - Prevents aggressive grabs against you when worn - Prevents combat-mode pushing against you when worn - Prevents shove knockdowns when worn - Prevents gravity effects when worn - Prevents buckling when worn - Cannot be red potion'd. - Does NOT protect against batons or knockdown. Current Armor values: - melee = 80 - bullet = 80 - laser = 70 - energy = 60 - bomb = 100 - bio = 100 - fire = 100 - acid = 100 - wound = 30 ## Why It's Good For The Game This PR adds in quite a few items that fill certain role archetypes within security while allowing them to still use equipment that security would already have. ## Proof Of Testing Testing overall has been completed. Testing left to do: - [x] Cargo Orders ## Changelog 🆑 add: Added a bunch of alternative additional weapon and equipment upgrade options to security, allowing a little bit of difference in the late-game arsenal or general armament. add: Adds the WT-550-B and WT-550-C, upgrades to the classic autorifle. add: The WT550 can now also be sawn-off. add: Adds the Stingballer, a close range weapon that rapidly shoots stingballs. add: Adds the Stunstaff, an aura-farming alternative to the classic baton and shield. add: Adds the Advanced Energy SMG, an a modified AEG that gains rapid-fire capabilites. add: Adds the Security Juggernaut suit, an impossibly slow suit that hinders your movement but has some of the best armour you'll ever see. add: Adds the .38 battle rifle, a simplified NT-38 Battle Rifle. Lacks the combat improvements, but does not degrade. balance: The Horizon Beam Rifle's performance has been tweaked. Damage is now 110, with 35 armor penetration and a demolition mod of 2, as well as the ability to destroy walls like pulse rifles. add: The Kiboko and pneumatic grenade launcher can be bought from cargo now. del: The WT-551 has be completely removed and replaced with the WT-550 del: Any instances of Skyrat's ammunition naming system have been wiped. Please report any inconsistencies you may find. /🆑 --------- Co-authored-by: Cabbage <supredoode@gmail.com> Co-authored-by: Mathilde <146444134+ibexgoetia@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
1758 lines
62 KiB
Plaintext
1758 lines
62 KiB
Plaintext
/**
|
|
* Delete a mob
|
|
*
|
|
* Removes mob from the following global lists
|
|
* * GLOB.mob_list
|
|
* * GLOB.dead_mob_list
|
|
* * GLOB.alive_mob_list
|
|
* * GLOB.all_clockwork_mobs
|
|
*
|
|
* Unsets the focus var
|
|
*
|
|
* Clears alerts for this mob
|
|
*
|
|
* Resets all the observers perspectives to the tile this mob is on
|
|
*
|
|
* qdels any client colours in place on this mob
|
|
*
|
|
* Clears any refs to the mob inside its current location
|
|
*
|
|
* Ghostizes the client attached to this mob
|
|
*
|
|
* If our mind still exists, clear its current var to prevent harddels
|
|
*
|
|
* Parent call
|
|
*/
|
|
/mob/Destroy()
|
|
if(client)
|
|
stack_trace("Mob with client has been deleted.")
|
|
else if(ckey && !IS_FAKE_KEY(ckey)) // FUCK YOU AGHOST CODE FUCK YOU
|
|
stack_trace("Mob without client but with associated ckey, [ckey], has been deleted.")
|
|
|
|
persistent_client?.set_mob(null)
|
|
|
|
remove_from_mob_list()
|
|
remove_from_dead_mob_list()
|
|
remove_from_alive_mob_list()
|
|
remove_from_mob_suicide_list()
|
|
focus = null
|
|
if(length(progressbars))
|
|
stack_trace("[src] destroyed with elements in its progressbars list")
|
|
progressbars = null
|
|
for (var/alert in alerts)
|
|
clear_alert(alert, TRUE)
|
|
if(observers?.len)
|
|
for(var/mob/dead/observe as anything in observers)
|
|
observe.reset_perspective(null)
|
|
|
|
qdel(hud_used)
|
|
QDEL_LIST(client_colours)
|
|
ghostize(can_reenter_corpse = FALSE) //False, since we're deleting it currently
|
|
if(mind?.current == src) //Let's just be safe yeah? This will occasionally be cleared, but not always. Can't do it with ghostize without changing behavior
|
|
mind.set_current(null)
|
|
|
|
if(mock_client)
|
|
mock_client.mob = null
|
|
|
|
return ..()
|
|
|
|
/mob/New()
|
|
// This needs to happen IMMEDIATELY. I'm sorry :(
|
|
GenerateTag()
|
|
return ..()
|
|
|
|
/**
|
|
* Intialize a mob
|
|
*
|
|
* Sends global signal COMSIG_GLOB_MOB_CREATED
|
|
*
|
|
* Adds to global lists
|
|
* * GLOB.mob_list
|
|
* * GLOB.dead_mob_list - if mob is dead
|
|
* * GLOB.alive_mob_list - if the mob is alive
|
|
*
|
|
* Other stuff:
|
|
* * Sets the mob focus to itself
|
|
* * Generates huds
|
|
* * If there are any global alternate apperances apply them to this mob
|
|
* * set a random nutrition level
|
|
* * Intialize the movespeed of the mob
|
|
*/
|
|
/mob/Initialize(mapload)
|
|
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_CREATED, src)
|
|
add_to_mob_list()
|
|
if(stat == DEAD)
|
|
add_to_dead_mob_list()
|
|
else
|
|
add_to_alive_mob_list()
|
|
update_incapacitated()
|
|
set_focus(src)
|
|
prepare_huds()
|
|
for(var/datum/atom_hud/alternate_appearance/alt_hud as anything in GLOB.active_alternate_appearances)
|
|
alt_hud.apply_to_new_mob(src)
|
|
|
|
set_nutrition(rand(NUTRITION_LEVEL_START_MIN, NUTRITION_LEVEL_START_MAX))
|
|
. = ..()
|
|
setup_hud_traits()
|
|
update_config_movespeed()
|
|
initialize_actionspeed()
|
|
update_movespeed(TRUE)
|
|
become_hearing_sensitive()
|
|
log_mob_tag("TAG: [tag] CREATED: [key_name(src)] \[[type]\]")
|
|
|
|
/**
|
|
* Generate the tag for this mob
|
|
*
|
|
* This is simply "mob_"+ a global incrementing counter that goes up for every mob
|
|
*/
|
|
/mob/GenerateTag()
|
|
. = ..()
|
|
tag = "mob_[next_mob_id++]"
|
|
|
|
/// Assigns a (c)key to this mob.
|
|
/mob/proc/PossessByPlayer(ckey)
|
|
SHOULD_NOT_OVERRIDE(TRUE)
|
|
if(isnull(ckey))
|
|
return
|
|
|
|
if(!istext(ckey))
|
|
CRASH("Tried to assign a mob a non-text ckey, wtf?!")
|
|
|
|
src.ckey = ckey(ckey)
|
|
|
|
/mob/serialize_list(list/options, list/semvers)
|
|
. = ..()
|
|
|
|
.["tag"] = tag
|
|
.["name"] = name
|
|
.["ckey"] = ckey
|
|
.["key"] = key
|
|
|
|
SET_SERIALIZATION_SEMVER(semvers, "1.0.0")
|
|
return .
|
|
|
|
/**
|
|
* set every hud image in the given category active so other people with the given hud can see it.
|
|
* Arguments:
|
|
* * hud_category - the index in our active_hud_list corresponding to an image now being shown.
|
|
* * update_huds - if FALSE we will just put the hud_category into active_hud_list without actually updating the atom_hud datums subscribed to it
|
|
* * exclusive_hud - if given a reference to an atom_hud, will just update that hud instead of all global ones attached to that category.
|
|
* This is because some atom_hud subtypes arent supposed to work via global categories, updating normally would affect all of these which we dont want.
|
|
*/
|
|
/atom/proc/set_hud_image_active(hud_category, update_huds = TRUE, datum/atom_hud/exclusive_hud)
|
|
if(!istext(hud_category) || !hud_list?[hud_category] || active_hud_list?[hud_category])
|
|
return FALSE
|
|
|
|
LAZYSET(active_hud_list, hud_category, hud_list[hud_category])
|
|
|
|
if(!update_huds)
|
|
return TRUE
|
|
|
|
if(exclusive_hud)
|
|
exclusive_hud.add_single_hud_category_on_atom(src, hud_category)
|
|
else
|
|
for(var/datum/atom_hud/hud_to_update as anything in GLOB.huds_by_category[hud_category])
|
|
hud_to_update.add_single_hud_category_on_atom(src, hud_category)
|
|
|
|
return TRUE
|
|
|
|
///sets every hud image in the given category inactive so no one can see it
|
|
/atom/proc/set_hud_image_inactive(hud_category, update_huds = TRUE, datum/atom_hud/exclusive_hud)
|
|
if(!istext(hud_category))
|
|
return FALSE
|
|
|
|
if(!update_huds)
|
|
LAZYREMOVE(active_hud_list, hud_category)
|
|
return TRUE
|
|
|
|
if(exclusive_hud)
|
|
exclusive_hud.remove_single_hud_category_on_atom(src, hud_category)
|
|
else
|
|
for(var/datum/atom_hud/hud_to_update as anything in GLOB.huds_by_category[hud_category])
|
|
hud_to_update.remove_single_hud_category_on_atom(src, hud_category)
|
|
|
|
LAZYREMOVE(active_hud_list, hud_category)
|
|
|
|
return TRUE
|
|
|
|
/**
|
|
* Prepare the huds for this atom
|
|
*
|
|
* Goes through hud_possible list and adds the images to the hud_list variable (if not already cached)
|
|
*/
|
|
/atom/proc/prepare_huds()
|
|
if(hud_list) // I choose to be lenient about people calling this proc more then once
|
|
return
|
|
hud_list = list()
|
|
for(var/hud in hud_possible)
|
|
var/hint = hud_possible[hud]
|
|
|
|
if(hint == HUD_LIST_LIST)
|
|
hud_list[hud] = list()
|
|
|
|
else
|
|
var/image/I = image('modular_zubbers/icons/mob/huds/hud.dmi', src, "") // BUBBER EDIT - Original path 'icons/mob/huds/hud.dmi'
|
|
I.appearance_flags = RESET_COLOR|PIXEL_SCALE|KEEP_APART
|
|
hud_list[hud] = I
|
|
set_hud_image_active(hud, update_huds = FALSE) //by default everything is active. but dont add it to huds to keep control.
|
|
|
|
/**
|
|
* Some kind of debug verb that gives atmosphere environment details
|
|
*/
|
|
/mob/proc/Cell()
|
|
set category = "Admin"
|
|
set hidden = TRUE
|
|
|
|
if(!loc)
|
|
return
|
|
|
|
var/datum/gas_mixture/environment = loc.return_air()
|
|
|
|
var/t = "[span_notice("Coordinates: [x],[y] ")]\n"
|
|
t += "[span_danger("Temperature: [environment.temperature] ")]\n"
|
|
for(var/id in environment.gases)
|
|
var/gas = environment.gases[id]
|
|
if(gas[MOLES])
|
|
t+="[span_notice("[gas[GAS_META][META_GAS_NAME]]: [gas[MOLES]] ")]\n"
|
|
|
|
to_chat(usr, t)
|
|
|
|
/**
|
|
* Return the desc of this mob for a photo
|
|
*/
|
|
/mob/proc/get_photo_description(obj/item/camera/camera)
|
|
return "a ... thing?"
|
|
|
|
/**
|
|
* Show a message to this mob (visual or audible)
|
|
*/
|
|
/mob/proc/show_message(msg, type, alt_msg, alt_type, avoid_highlighting = FALSE)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
|
|
if(!client)
|
|
return FALSE
|
|
|
|
msg = copytext_char(msg, 1, MAX_MESSAGE_LEN)
|
|
|
|
// Return TRUE if we sent the original msg, otherwise return FALSE
|
|
. = TRUE
|
|
if(type)
|
|
if(type & MSG_VISUAL && is_blind())//Vision related
|
|
if(!alt_msg)
|
|
return FALSE
|
|
else
|
|
msg = alt_msg
|
|
type = alt_type
|
|
. = FALSE
|
|
|
|
if(type & MSG_AUDIBLE && HAS_TRAIT(src, TRAIT_DEAF))//Hearing related
|
|
if(!alt_msg)
|
|
return FALSE
|
|
else
|
|
msg = alt_msg
|
|
type = alt_type
|
|
. = FALSE
|
|
if(type & MSG_VISUAL && is_blind())
|
|
return FALSE
|
|
// voice muffling
|
|
if(stat == UNCONSCIOUS || stat == HARD_CRIT)
|
|
if(type & MSG_AUDIBLE) //audio
|
|
to_chat(src, "<I>... You can almost hear something ...</I>")
|
|
return FALSE
|
|
to_chat(src, msg, avoid_highlighting = avoid_highlighting)
|
|
return .
|
|
|
|
/**
|
|
* Generate a visible message from this atom
|
|
*
|
|
* Show a message to all player mobs who sees this atom
|
|
*
|
|
* Show a message to the src mob (if the src is a mob)
|
|
*
|
|
* Use for atoms performing visible actions
|
|
*
|
|
* message is output to anyone who can see, e.g. `"The [src] does something!"`
|
|
*
|
|
* Vars:
|
|
* * message is the message output to anyone who can see.
|
|
* * 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!"
|
|
* * vision_distance (optional) define how many tiles away the message can be seen.
|
|
* * ignored_mobs (optional) doesn't show any message to any mob in this list.
|
|
* * visible_message_flags (optional) is the type of message being sent.
|
|
*/
|
|
/atom/proc/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs, visible_message_flags = NONE, separation = " ", pref_to_check) // SKYRAT EDIT ADDITION - separation, pref checks
|
|
var/turf/T = get_turf(src)
|
|
if(!T)
|
|
return
|
|
|
|
if(!islist(ignored_mobs))
|
|
ignored_mobs = list(ignored_mobs)
|
|
var/list/hearers = mob_only_listeners(get_hearers_in_view(vision_distance, src)) //caches the hearers and then removes ignored mobs.
|
|
hearers -= ignored_mobs
|
|
|
|
//SKYRAT EDIT ADDITION BEGIN - AI QoL
|
|
for(var/mob/eye/camera/ai/ai_eye in hearers)
|
|
if(ai_eye.ai?.client && !(ai_eye.ai.stat == DEAD))
|
|
hearers -= ai_eye
|
|
hearers |= ai_eye.ai
|
|
|
|
for(var/obj/effect/overlay/holo_pad_hologram/holo in hearers)
|
|
if(holo.Impersonation?.client)
|
|
hearers |= holo.Impersonation
|
|
//SKYRAT EDIT ADDITION END - AI QoL
|
|
|
|
var/raw_msg = message
|
|
if(visible_message_flags & WITH_EMPHASIS_MESSAGE)
|
|
message = apply_message_emphasis(message)
|
|
if(visible_message_flags & EMOTE_MESSAGE)
|
|
message = span_emote("<b>[src]</b>[separation][message]") // SKYRAT EDIT - Better emotes
|
|
|
|
for(var/mob/hearing_mob as anything in hearers)
|
|
if(!hearing_mob?.client)
|
|
continue
|
|
if(self_message && hearing_mob == src)
|
|
continue
|
|
// SKYRAT EDIT ADDITION - Emote pref checks
|
|
if(pref_to_check && !hearing_mob.client?.prefs.read_preference(pref_to_check))
|
|
continue
|
|
// SKYRAT EDIT END
|
|
|
|
//This entire if/else chain could be in two lines but isn't for readibilties sake.
|
|
var/msg = message
|
|
var/msg_type = MSG_VISUAL
|
|
|
|
if(hearing_mob.see_invisible < invisibility)//if src is invisible to M
|
|
msg = blind_message
|
|
msg_type = MSG_AUDIBLE
|
|
else if(T != loc && T != src) //if src is inside something and not a turf.
|
|
// BUBBER EDIT Start - Prey hear each other in bellies + pred always hears prey
|
|
if(istype(loc, /obj/vore_belly))
|
|
if(hearing_mob.loc != loc && hearing_mob != loc.loc)
|
|
msg = blind_message
|
|
msg_type = MSG_AUDIBLE
|
|
// BUBBER EDIT End
|
|
else if(hearing_mob != loc) // Only give the blind message to hearers that aren't the location
|
|
msg = blind_message
|
|
msg_type = MSG_AUDIBLE
|
|
else if(!HAS_TRAIT(hearing_mob, TRAIT_HEAR_THROUGH_DARKNESS) && hearing_mob.lighting_cutoff < LIGHTING_CUTOFF_HIGH && T.is_softly_lit() && !in_range(T,hearing_mob)) //if it is too dark, unless we're right next to them.
|
|
msg = blind_message
|
|
msg_type = MSG_AUDIBLE
|
|
if(!msg)
|
|
continue
|
|
|
|
if(visible_message_flags & EMOTE_MESSAGE && runechat_prefs_check(hearing_mob, visible_message_flags) && !hearing_mob.is_blind())
|
|
hearing_mob.create_chat_message(src, raw_message = raw_msg, runechat_flags = visible_message_flags)
|
|
|
|
hearing_mob.show_message(msg, msg_type, blind_message, MSG_AUDIBLE)
|
|
|
|
///Adds the functionality to self_message.
|
|
/mob/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs, visible_message_flags = NONE, separation = " ", pref_to_check) // SKYRAT EDIT ADDITION - Better emotes, pref checks
|
|
. = ..()
|
|
if(!self_message)
|
|
return
|
|
var/raw_self_message = self_message
|
|
var/self_runechat = FALSE
|
|
var/block_self_highlight = (visible_message_flags & BLOCK_SELF_HIGHLIGHT_MESSAGE)
|
|
if(visible_message_flags & WITH_EMPHASIS_MESSAGE)
|
|
self_message = apply_message_emphasis(self_message)
|
|
if(visible_message_flags & EMOTE_MESSAGE)
|
|
self_message = span_emote("<b>[src]</b> [self_message]") // May make more sense as "You do x"
|
|
|
|
if(visible_message_flags & ALWAYS_SHOW_SELF_MESSAGE)
|
|
to_chat(src, self_message, avoid_highlighting = block_self_highlight)
|
|
self_runechat = TRUE
|
|
else
|
|
self_runechat = show_message(self_message, MSG_VISUAL, blind_message, MSG_AUDIBLE, avoid_highlighting = block_self_highlight)
|
|
|
|
if(self_runechat && (visible_message_flags & EMOTE_MESSAGE) && runechat_prefs_check(src, visible_message_flags))
|
|
create_chat_message(src, raw_message = raw_self_message, runechat_flags = visible_message_flags)
|
|
|
|
/**
|
|
* Show a message to all mobs in earshot of this atom
|
|
*
|
|
* Use for objects performing audible actions
|
|
*
|
|
* vars:
|
|
* * message is the message output to anyone who can hear.
|
|
* * deaf_message (optional) is what deaf people will see.
|
|
* * hearing_distance (optional) is the range, how many tiles away the message can be heard.
|
|
* * self_message (optional) is what the src mob hears.
|
|
* * audible_message_flags (optional) is the type of message being sent.
|
|
*/
|
|
/atom/proc/audible_message(message, deaf_message, hearing_distance = DEFAULT_MESSAGE_RANGE, self_message, audible_message_flags = NONE, separation = " ", pref_to_check) // SKYRAT EDIT ADDITION - Better emotes, pref checks
|
|
var/list/hearers = mob_only_listeners(get_hearers_in_view(hearing_distance, src))
|
|
//SKYRAT EDIT ADDITION BEGIN - AI QoL
|
|
for(var/mob/eye/camera/ai/ai_eye in hearers)
|
|
if(ai_eye.ai?.client && !(ai_eye.ai.stat == DEAD))
|
|
hearers -= ai_eye
|
|
hearers |= ai_eye.ai
|
|
|
|
for(var/obj/effect/overlay/holo_pad_hologram/holo in hearers)
|
|
if(holo.Impersonation?.client)
|
|
hearers |= holo.Impersonation
|
|
//SKYRAT EDIT ADDITION END - AI QoL
|
|
var/raw_msg = message
|
|
if(audible_message_flags & WITH_EMPHASIS_MESSAGE)
|
|
message = apply_message_emphasis(message)
|
|
if(audible_message_flags & EMOTE_MESSAGE)
|
|
message = span_emote("<b>[src]</b>[separation][message]") //SKYRAT EDIT CHANGE
|
|
for(var/mob/hearing_mob as anything in hearers)
|
|
if(!hearing_mob?.client)
|
|
continue
|
|
if(self_message && hearing_mob == src)
|
|
continue
|
|
if(audible_message_flags & EMOTE_MESSAGE && runechat_prefs_check(hearing_mob, audible_message_flags) && !HAS_TRAIT(hearing_mob, TRAIT_DEAF))
|
|
hearing_mob.create_chat_message(src, raw_message = raw_msg, runechat_flags = audible_message_flags)
|
|
hearing_mob.show_message(message, MSG_AUDIBLE, deaf_message, MSG_VISUAL)
|
|
|
|
/**
|
|
* Show a message to all mobs in earshot of this one
|
|
*
|
|
* This would be for audible actions by the src mob
|
|
*
|
|
* vars:
|
|
* * message is the message output to anyone who can hear.
|
|
* * self_message (optional) is what the src mob hears.
|
|
* * deaf_message (optional) is what deaf people will see.
|
|
* * hearing_distance (optional) is the range, how many tiles away the message can be heard.
|
|
*/
|
|
/mob/audible_message(message, deaf_message, hearing_distance = DEFAULT_MESSAGE_RANGE, self_message, audible_message_flags = NONE, separation = " ", pref_to_check) // SKYRAT EDIT ADDITION - Better emotes, pref checks
|
|
. = ..()
|
|
if(!self_message)
|
|
return
|
|
var/raw_self_message = self_message
|
|
var/self_runechat = FALSE
|
|
var/block_self_highlight = (audible_message_flags & BLOCK_SELF_HIGHLIGHT_MESSAGE)
|
|
if(audible_message_flags & WITH_EMPHASIS_MESSAGE)
|
|
self_message = apply_message_emphasis(self_message)
|
|
if(audible_message_flags & EMOTE_MESSAGE)
|
|
self_message = span_emote("<b>[src]</b> [self_message]")
|
|
|
|
if(audible_message_flags & ALWAYS_SHOW_SELF_MESSAGE)
|
|
to_chat(src, self_message, avoid_highlighting = block_self_highlight)
|
|
self_runechat = TRUE
|
|
else
|
|
self_runechat = show_message(self_message, MSG_AUDIBLE, deaf_message, MSG_VISUAL, avoid_highlighting = block_self_highlight)
|
|
|
|
if(self_runechat && (audible_message_flags & EMOTE_MESSAGE) && runechat_prefs_check(src, audible_message_flags))
|
|
create_chat_message(src, raw_message = raw_self_message, runechat_flags = audible_message_flags)
|
|
|
|
/// Gets a linked mob, letting atoms act as proxies for actions that rely on hearing sensitivity.
|
|
/// For example, AIs hearing around their holopads, and dullahans hearing around their heads.
|
|
/// Normal say messages are handled by Hear(), this is for other visible/audible messages
|
|
/atom/movable/proc/get_listening_mob()
|
|
return
|
|
|
|
/obj/effect/overlay/holo_pad_hologram/get_listening_mob()
|
|
return Impersonation
|
|
|
|
/obj/item/dullahan_relay/get_listening_mob()
|
|
return owner
|
|
|
|
/mob/get_listening_mob()
|
|
return src
|
|
|
|
///Returns the client runechat visible messages preference according to the message type.
|
|
/atom/proc/runechat_prefs_check(mob/target, visible_message_flags = NONE)
|
|
if(!target.client?.prefs.read_preference(/datum/preference/toggle/enable_runechat))
|
|
return FALSE
|
|
if (!target.client?.prefs.read_preference(/datum/preference/toggle/enable_runechat_non_mobs))
|
|
return FALSE
|
|
if(visible_message_flags & EMOTE_MESSAGE && !target.client.prefs.read_preference(/datum/preference/toggle/see_rc_emotes))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/mob/runechat_prefs_check(mob/target, visible_message_flags = NONE)
|
|
if(!target.client?.prefs.read_preference(/datum/preference/toggle/enable_runechat))
|
|
return FALSE
|
|
if(visible_message_flags & EMOTE_MESSAGE && !target.client.prefs.read_preference(/datum/preference/toggle/see_rc_emotes))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/mob/dead/observer/runechat_prefs_check(mob/target, visible_message_flags = NONE)
|
|
if(!..())
|
|
return FALSE
|
|
if(!target.client?.prefs.read_preference(/datum/preference/toggle/enable_runechat_ghosts))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
///Get the item on the mob in the storage slot identified by the id passed in
|
|
/mob/proc/get_item_by_slot(slot_id) as /obj/item
|
|
return null
|
|
|
|
/// Gets what slot the item on the mob is held in.
|
|
/// Returns null if the item isn't in any slots on our mob.
|
|
/// Does not check if the passed item is null, which may result in unexpected outcoms.
|
|
/mob/proc/get_slot_by_item(obj/item/looking_for)
|
|
if(looking_for in held_items)
|
|
return ITEM_SLOT_HANDS
|
|
|
|
return null
|
|
|
|
/// Called whenever anything that modifes incapacitated is ran, updates it and sends a signal if it changes
|
|
/// Returns TRUE if anything changed, FALSE otherwise
|
|
/mob/proc/update_incapacitated()
|
|
SIGNAL_HANDLER
|
|
var/old_incap = incapacitated
|
|
incapacitated = build_incapacitated()
|
|
if(old_incap == incapacitated)
|
|
return FALSE
|
|
|
|
SEND_SIGNAL(src, COMSIG_MOB_INCAPACITATE_CHANGED, old_incap, incapacitated)
|
|
return TRUE
|
|
|
|
/// Returns an updated incapacitated bitflag. If a flag is set it means we're incapacitated in that case
|
|
/mob/proc/build_incapacitated()
|
|
return NONE
|
|
|
|
/**
|
|
* This proc is called whenever someone clicks an inventory ui slot.
|
|
*
|
|
* Mostly tries to put the item into the slot if possible, or call attack hand
|
|
* on the item in the slot if the users active hand is empty
|
|
*/
|
|
/mob/proc/attack_ui(slot, params)
|
|
var/obj/item/W = get_active_held_item()
|
|
|
|
if(istype(W))
|
|
if(equip_to_slot_if_possible(W, slot,0,0,0))
|
|
return TRUE
|
|
|
|
if(!W)
|
|
// Activate the item
|
|
var/obj/item/I = get_item_by_slot(slot)
|
|
if(istype(I))
|
|
var/list/modifiers = params2list(params)
|
|
I.attack_hand(src, modifiers)
|
|
|
|
return FALSE
|
|
|
|
/**
|
|
* Reset the attached clients perspective (viewpoint)
|
|
*
|
|
* reset_perspective(null) set eye to common default : mob on turf, loc otherwise
|
|
* reset_perspective(thing) set the eye to the thing (if it's equal to current default reset to mob perspective)
|
|
*/
|
|
/mob/proc/reset_perspective(atom/new_eye)
|
|
SHOULD_CALL_PARENT(TRUE)
|
|
if(!client)
|
|
return
|
|
|
|
if(new_eye)
|
|
if(ismovable(new_eye))
|
|
//Set the new eye unless it's us
|
|
if(new_eye != src)
|
|
client.perspective = EYE_PERSPECTIVE
|
|
client.set_eye(new_eye)
|
|
else
|
|
client.set_eye(client.mob)
|
|
client.perspective = MOB_PERSPECTIVE
|
|
|
|
else if(isturf(new_eye))
|
|
//Set to the turf unless it's our current turf
|
|
if(new_eye != loc)
|
|
client.perspective = EYE_PERSPECTIVE
|
|
client.set_eye(new_eye)
|
|
else
|
|
client.set_eye(client.mob)
|
|
client.perspective = MOB_PERSPECTIVE
|
|
else
|
|
return TRUE //no setting eye to stupid things like areas or whatever
|
|
else
|
|
//Reset to common defaults: mob if on turf, otherwise current loc
|
|
if(isturf(loc))
|
|
client.set_eye(client.mob)
|
|
client.perspective = MOB_PERSPECTIVE
|
|
else
|
|
client.perspective = EYE_PERSPECTIVE
|
|
client.set_eye(loc)
|
|
/// Signal sent after the eye has been successfully updated, with the client existing.
|
|
SEND_SIGNAL(src, COMSIG_MOB_RESET_PERSPECTIVE)
|
|
return TRUE
|
|
|
|
/**
|
|
* Examine a mob
|
|
*
|
|
* mob verbs are faster than object verbs. See
|
|
* [this byond forum post](https://secure.byond.com/forum/?post=1326139&page=2#comment8198716)
|
|
* for why this isn't atom/verb/examine()
|
|
*/
|
|
/mob/verb/examinate(atom/examinify as mob|obj|turf in view()) //It used to be oview(12), but I can't really say why
|
|
set name = "Examine"
|
|
|
|
DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(run_examinate), examinify))
|
|
|
|
/mob/proc/run_examinate(atom/examinify, force_examinate_more = FALSE)
|
|
if(QDELETED(examinify)) // since this can run async we might have had the atom get qdeleted already
|
|
return
|
|
|
|
if(isturf(examinify) && !(sight & SEE_TURFS) && !(examinify in view(client ? client.view : world.view, src)))
|
|
// shift-click catcher may issue examinate() calls for out-of-sight turfs
|
|
return
|
|
|
|
var/turf/examine_turf = get_turf(examinify)
|
|
if(is_blind()) //blind people see things differently (through touch)
|
|
if(!blind_examine_check(examinify))
|
|
return
|
|
else if(examine_turf && !(examine_turf.luminosity || examine_turf.dynamic_lumcount) && \
|
|
get_dist(src, examine_turf) > 1 && \
|
|
!has_nightvision()) // If you aren't blind, it's in darkness (that you can't see) and farther then next to you
|
|
return
|
|
|
|
face_atom(examinify)
|
|
var/result_combined
|
|
var/removes_double_click = client?.prefs.read_preference(/datum/preference/toggle/remove_double_click)
|
|
if(client)
|
|
LAZYINITLIST(client.recent_examines)
|
|
var/ref_to_atom = REF(examinify)
|
|
var/examine_time = client.recent_examines[ref_to_atom]
|
|
if(force_examinate_more || (examine_time && (world.time - examine_time < EXAMINE_MORE_WINDOW) && !removes_double_click))
|
|
var/list/result = examinify.examine_more(src)
|
|
if(!length(result))
|
|
result += span_notice("<i>You examine [examinify] closer, but find nothing of interest...</i>")
|
|
result_combined = boxed_message(jointext(result, "<br>"))
|
|
result_combined = replacetext(result_combined, "<hr><br>", "<hr>") // BUBBER EDIT ADDITION - bit of a hack here to make sure we don't get linebreaks coming after headers
|
|
|
|
else
|
|
client.recent_examines[ref_to_atom] = world.time // set to when we last normal examine'd them
|
|
addtimer(CALLBACK(src, PROC_REF(clear_from_recent_examines), ref_to_atom), RECENT_EXAMINE_MAX_WINDOW)
|
|
handle_eye_contact(examinify)
|
|
|
|
if(!result_combined)
|
|
var/list/result = examinify.examine(src)
|
|
var/atom_title = examinify.examine_title(src, thats = TRUE)
|
|
var/examine_headshot = examinify.get_chat_examine_headshot(src)
|
|
examining(examinify, result)
|
|
var/alist/overrides = alist()
|
|
SEND_SIGNAL(src, COMSIG_MOB_EXAMINING, examinify, result, overrides)
|
|
if (length(overrides))
|
|
result = overrides[max(overrides)]
|
|
if(removes_double_click)
|
|
result += span_notice("<i>You can <a href=byond://?src=[REF(src)];run_examinate=[REF(examinify)]>examine</a> [examinify] closer...</i>")
|
|
if(examine_headshot)
|
|
result.Insert(1, examine_headshot)
|
|
if(atom_title)
|
|
result_combined = fieldset_block("[atom_title].", jointext(result, "<br>"), "boxed_message")
|
|
else
|
|
result_combined = boxed_message(jointext(result, "<br>"))
|
|
result_combined = replacetext(result_combined, "<hr><br>", "<hr>") // BUBBER EDIT ADDITION - bit of a hack here to make sure we don't get linebreaks coming after headers, as well as properly adding the examine_block
|
|
|
|
to_chat(src, span_infoplain(result_combined))
|
|
SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, examinify)
|
|
|
|
/// Handles adding examine messages for the target that are specific to this mob, e.g. a blood worm examining how much blood a living target has.
|
|
/mob/proc/examining(atom/target, list/result)
|
|
SHOULD_NOT_SLEEP(TRUE)
|
|
return
|
|
|
|
/mob/Topic(href, list/href_list)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
if(href_list["run_examinate"])
|
|
var/atom/examined_atom = locate(href_list["run_examinate"])
|
|
//run_examinate only early returns this check for turfs for some reason.
|
|
if(examined_atom in view(client ? client.view : world.view, src))
|
|
run_examinate(examined_atom, force_examinate_more = TRUE)
|
|
|
|
/mob/proc/blind_examine_check(atom/examined_thing)
|
|
return TRUE //The non-living will always succeed at this check.
|
|
|
|
|
|
/mob/living/blind_examine_check(atom/examined_thing)
|
|
//need to be next to something and awake
|
|
if(!Adjacent(examined_thing) || incapacitated)
|
|
to_chat(src, span_warning("Something is there, but you can't see it!"))
|
|
return FALSE
|
|
|
|
//you can examine things you're holding directly, but you can't examine other things if your hands are full
|
|
/// the item in our active hand
|
|
var/obj/item/active_item = get_active_held_item()
|
|
var/boosted = FALSE
|
|
if(active_item)
|
|
if(HAS_TRAIT(active_item, TRAIT_BLIND_TOOL))
|
|
boosted = TRUE
|
|
else if(active_item != examined_thing)
|
|
to_chat(src, span_warning("Your hands are too full to examine this!"))
|
|
return FALSE
|
|
|
|
//you can only initiate exaimines if you have a hand, it's not disabled, and only as many examines as you have hands
|
|
/// our active hand, to check if it's disabled/detached
|
|
var/obj/item/bodypart/active_hand = has_active_hand()? get_active_hand() : null
|
|
if(!active_hand || active_hand.bodypart_disabled || do_after_count() >= usable_hands)
|
|
to_chat(src, span_warning("You don't have a free hand to examine this!"))
|
|
return FALSE
|
|
|
|
//you can only queue up one examine on something at a time
|
|
if(DOING_INTERACTION_WITH_TARGET(src, examined_thing))
|
|
return FALSE
|
|
|
|
to_chat(src, span_notice("You start feeling around for something..."))
|
|
visible_message(span_notice(" [name] begins feeling around for \the [examined_thing.name]..."))
|
|
|
|
/// how long it takes for the blind person to find the thing they're examining
|
|
var/examine_delay_length = rand(1 SECONDS, 2 SECONDS)
|
|
if(boosted)
|
|
examine_delay_length = 0.5 SECONDS
|
|
if(client?.recent_examines && client?.recent_examines[ref(examined_thing)]) //easier to find things we just touched
|
|
examine_delay_length = 0.33 SECONDS
|
|
else if(isobj(examined_thing))
|
|
examine_delay_length *= 1.5
|
|
else if(ismob(examined_thing) && examined_thing != src)
|
|
examine_delay_length *= 2
|
|
|
|
if(examine_delay_length > 0 && !do_after(src, examine_delay_length, target = examined_thing))
|
|
to_chat(src, span_notice("You can't get a good feel for what is there."))
|
|
return FALSE
|
|
|
|
//now we touch the thing we're examining
|
|
/// our current intent, so we can go back to it after touching
|
|
var/previous_combat_mode = combat_mode
|
|
set_combat_mode(FALSE)
|
|
INVOKE_ASYNC(examined_thing, TYPE_PROC_REF(/atom, attack_hand), src)
|
|
set_combat_mode(previous_combat_mode)
|
|
return TRUE
|
|
|
|
|
|
/mob/proc/clear_from_recent_examines(ref_to_clear)
|
|
SIGNAL_HANDLER
|
|
if(!client)
|
|
return
|
|
LAZYREMOVE(client.recent_examines, ref_to_clear)
|
|
|
|
/**
|
|
* handle_eye_contact() is called when we examine() something. If we examine an alive mob with a mind who has examined us in the last 2 seconds within 5 tiles, we make eye contact!
|
|
*
|
|
* Note that if either party has their face obscured, the other won't get the notice about the eye contact
|
|
* Also note that examine_more() doesn't proc this or extend the timer, just because it's simpler this way and doesn't lose much.
|
|
* The nice part about relying on examining is that we don't bother checking visibility, because we already know they were both visible to each other within the last second, and the one who triggers it is currently seeing them
|
|
*/
|
|
/mob/proc/handle_eye_contact(mob/living/examined_mob)
|
|
return
|
|
|
|
/mob/living/handle_eye_contact(mob/living/examined_mob)
|
|
if(!istype(examined_mob) || src == examined_mob || examined_mob.stat >= UNCONSCIOUS || !client || is_blind())
|
|
return
|
|
|
|
var/imagined_eye_contact = FALSE
|
|
if(!LAZYACCESS(examined_mob.client?.recent_examines, src))
|
|
// even if you haven't looked at them recently, if you have the shift eyes trait, they may still imagine the eye contact
|
|
if(HAS_TRAIT(examined_mob, TRAIT_SHIFTY_EYES) && prob(10 - get_dist(src, examined_mob)))
|
|
imagined_eye_contact = TRUE
|
|
else
|
|
return
|
|
|
|
if(get_dist(src, examined_mob) > EYE_CONTACT_RANGE)
|
|
return
|
|
|
|
// check to see if their face is blocked or, if not, a signal blocks it
|
|
if(examined_mob.can_eye_contact() && SEND_SIGNAL(src, COMSIG_MOB_EYECONTACT, examined_mob, TRUE) != COMSIG_BLOCK_EYECONTACT)
|
|
var/obj/item/clothing/eye_cover = examined_mob.is_eyes_covered()
|
|
if (!eye_cover || (!eye_cover.tint && !eye_cover.flash_protect))
|
|
var/msg = span_smallnotice("You make eye contact with [examined_mob].")
|
|
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), src, msg), 0.3 SECONDS) // so the examine signal has time to fire and this will print after
|
|
|
|
if(!imagined_eye_contact && can_eye_contact() && !examined_mob.is_blind() && SEND_SIGNAL(examined_mob, COMSIG_MOB_EYECONTACT, src, FALSE) != COMSIG_BLOCK_EYECONTACT)
|
|
var/obj/item/clothing/eye_cover = is_eyes_covered()
|
|
if (!eye_cover || (!eye_cover.tint && !eye_cover.flash_protect))
|
|
var/msg = span_smallnotice("[src] makes eye contact with you.")
|
|
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(to_chat), examined_mob, msg), 0.3 SECONDS)
|
|
|
|
/// Checks if we can make eye contact or someone can make eye contact with us
|
|
/mob/living/proc/can_eye_contact()
|
|
return TRUE
|
|
|
|
/mob/living/carbon/can_eye_contact()
|
|
return !(obscured_slots & HIDEFACE)
|
|
|
|
/**
|
|
* Called by using Activate Held Object with an empty hand/limb
|
|
*
|
|
* Does nothing by default. The intended use is to allow limbs to call their
|
|
* own attack_self procs. It is up to the individual mob to override this
|
|
* parent and actually use it.
|
|
*/
|
|
/mob/proc/limb_attack_self()
|
|
return
|
|
|
|
///Can this mob resist (default FALSE)
|
|
/mob/proc/can_resist()
|
|
return FALSE //overridden in living.dm
|
|
|
|
#define SPIN_PROC_TRAIT "trait_from_spin()"
|
|
|
|
///Spin this mob around it's central axis
|
|
/mob/proc/spin(spintime, speed)
|
|
set waitfor = 0
|
|
var/D = dir
|
|
if((spintime < 1) || (speed < 1) || !spintime || !speed)
|
|
return
|
|
|
|
ADD_TRAIT(src, TRAIT_SPINNING, SPIN_PROC_TRAIT)
|
|
while(spintime >= speed)
|
|
sleep(speed)
|
|
switch(D)
|
|
if(NORTH)
|
|
D = EAST
|
|
if(SOUTH)
|
|
D = WEST
|
|
if(EAST)
|
|
D = SOUTH
|
|
if(WEST)
|
|
D = NORTH
|
|
setDir(D)
|
|
spintime -= speed
|
|
REMOVE_TRAIT(src, TRAIT_SPINNING, SPIN_PROC_TRAIT)
|
|
|
|
#undef SPIN_PROC_TRAIT
|
|
|
|
///Update the pulling hud icon
|
|
/mob/proc/update_pull_hud_icon()
|
|
hud_used?.screen_objects[HUD_MOB_PULL]?.update_appearance()
|
|
|
|
///Update the resting hud icon
|
|
/mob/proc/update_rest_hud_icon()
|
|
if(!hud_used)
|
|
return FALSE
|
|
hud_used.screen_objects[HUD_MOB_REST]?.update_appearance()
|
|
return TRUE
|
|
|
|
/**
|
|
* Verb to activate the object in your held hand
|
|
*
|
|
* Calls attack self on the item and updates the inventory hud for hands
|
|
*/
|
|
/mob/proc/mode()
|
|
DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(execute_mode)))
|
|
|
|
///proc version to finish /mob/verb/mode() execution. used in case the proc needs to be queued for the tick after its first called
|
|
/mob/proc/execute_mode()
|
|
if(ismecha(loc))
|
|
return
|
|
|
|
if(incapacitated)
|
|
return
|
|
|
|
var/obj/item/I = get_active_held_item()
|
|
if(I)
|
|
I.attack_self(src)
|
|
update_held_items()
|
|
return
|
|
|
|
limb_attack_self()
|
|
|
|
/**
|
|
* Allows you to respawn, abandoning your current mob
|
|
*
|
|
* This sends you back to the lobby creating a new dead mob
|
|
*
|
|
* Only works if flag/allow_respawn is allowed in config
|
|
*/
|
|
/mob/verb/abandon_mob()
|
|
set name = "Respawn"
|
|
set category = "OOC"
|
|
|
|
switch(CONFIG_GET(flag/allow_respawn))
|
|
if(RESPAWN_FLAG_NEW_CHARACTER)
|
|
if(tgui_alert(usr, "Note, respawning is only allowed as another character. If you don't have another free slot you may not be able to respawn.", "Respawn", list("Ok", "Nevermind")) != "Ok")
|
|
return
|
|
|
|
if(RESPAWN_FLAG_FREE)
|
|
pass() // Normal respawn
|
|
|
|
if(RESPAWN_FLAG_DISABLED)
|
|
if (!check_rights_for(usr.client, R_ADMIN))
|
|
to_chat(usr, span_boldnotice("Respawning is not enabled!"))
|
|
return
|
|
if (tgui_alert(usr, "Respawning is currently disabled, do you want to use your permissions to circumvent it?", "Respawn", list("Yes", "No")) != "Yes")
|
|
return
|
|
|
|
if (stat != DEAD)
|
|
to_chat(usr, span_boldnotice("You must be dead to use this!"))
|
|
return
|
|
|
|
if(!check_respawn_delay())
|
|
return
|
|
|
|
//SKYRAT EDIT ADDITION
|
|
if(ckey)
|
|
if(is_banned_from(ckey, BAN_RESPAWN))
|
|
to_chat(usr, "<span class='boldnotice'>You are respawn banned, you can't respawn!</span>")
|
|
return
|
|
//SKYRAT EDIT END
|
|
|
|
usr.log_message("used the respawn button.", LOG_GAME)
|
|
|
|
to_chat(usr, span_boldnotice("Please roleplay correctly!"))
|
|
|
|
if(!client)
|
|
usr.log_message("respawn failed due to disconnect.", LOG_GAME)
|
|
return
|
|
client.screen.Cut()
|
|
client.screen += client.void
|
|
if(!client)
|
|
usr.log_message("respawn failed due to disconnect.", LOG_GAME)
|
|
return
|
|
|
|
var/mob/dead/new_player/M = new /mob/dead/new_player()
|
|
if(!client)
|
|
usr.log_message("respawn failed due to disconnect.", LOG_GAME)
|
|
qdel(M)
|
|
return
|
|
|
|
M.PossessByPlayer(key)
|
|
|
|
/// Checks if the mob can respawn yet according to the respawn delay
|
|
/mob/proc/check_respawn_delay(override_delay = 0)
|
|
if(!override_delay && !CONFIG_GET(number/respawn_delay))
|
|
return TRUE
|
|
//BUBBER EDIT 30 minute grace period
|
|
var/respawn_grace_period = CONFIG_GET(number/respawn_grace_period)
|
|
if(world.time < respawn_grace_period)
|
|
return TRUE
|
|
//BUBBER EDIT END
|
|
|
|
var/death_time = world.time - persistent_client.time_of_death
|
|
|
|
var/required_delay = override_delay || CONFIG_GET(number/respawn_delay)
|
|
|
|
if(death_time < required_delay)
|
|
if(!check_rights_for(usr.client, R_ADMIN))
|
|
to_chat(usr, "You have been dead for [DisplayTimeText(death_time, 1)].")
|
|
to_chat(usr, span_warning("You must wait [DisplayTimeText(required_delay, 1)] to respawn!"))
|
|
return FALSE
|
|
if(tgui_alert(usr, "You have been dead for [DisplayTimeText(death_time, 1)] out of required [DisplayTimeText(required_delay, 1)]. Do you want to use your permissions to circumvent it?", "Respawn", list("Yes", "No")) != "Yes")
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/**
|
|
* Sometimes helps if the user is stuck in another perspective or camera
|
|
*/
|
|
/mob/verb/cancel_camera()
|
|
set name = "Cancel Camera View"
|
|
set category = "OOC"
|
|
reset_perspective(null)
|
|
|
|
/**
|
|
* Helpful for when a players uplink window gets glitched to above their screen.
|
|
* preventing them from moving the UPLINK window.
|
|
*/
|
|
/mob/verb/reset_ui_positions_for_mob()
|
|
set name = "Reset UI Positions"
|
|
set category = "OOC"
|
|
SStgui.reset_ui_position(src)
|
|
|
|
//suppress the .click/dblclick macros so people can't use them to identify the location of items or aimbot
|
|
/mob/verb/DisClick(argu = null as anything, sec = "" as text, number1 = 0 as num , number2 = 0 as num)
|
|
set name = ".click"
|
|
set hidden = TRUE
|
|
set category = null
|
|
return
|
|
|
|
/mob/verb/DisDblClick(argu = null as anything, sec = "" as text, number1 = 0 as num , number2 = 0 as num)
|
|
set name = ".dblclick"
|
|
set hidden = TRUE
|
|
set category = null
|
|
return
|
|
|
|
/// Adds this list to the output to the stat browser
|
|
/mob/proc/get_status_tab_items()
|
|
. = list("") //we want to offset unique stuff from standard stuff
|
|
SEND_SIGNAL(src, COMSIG_MOB_GET_STATUS_TAB_ITEMS, .)
|
|
return .
|
|
|
|
|
|
/mob/proc/swap_hand(held_index, silent = FALSE)
|
|
SHOULD_NOT_OVERRIDE(TRUE) // Override perform_hand_swap instead
|
|
|
|
var/obj/item/held_item = get_active_held_item()
|
|
if(SEND_SIGNAL(src, COMSIG_MOB_SWAPPING_HANDS, held_item) & COMPONENT_BLOCK_SWAP)
|
|
if (!silent)
|
|
to_chat(src, span_warning("Your other hand is too busy holding [held_item]."))
|
|
return FALSE
|
|
|
|
var/result = perform_hand_swap(held_index)
|
|
if (result)
|
|
SEND_SIGNAL(src, COMSIG_MOB_SWAP_HANDS, get_active_held_item(), held_item)
|
|
|
|
return result
|
|
|
|
/// Performs the actual ritual of swapping hands, such as setting the held index variables
|
|
/mob/proc/perform_hand_swap(held_index)
|
|
PROTECTED_PROC(TRUE)
|
|
if (!HAS_TRAIT(src, TRAIT_CAN_HOLD_ITEMS))
|
|
return FALSE
|
|
|
|
if(!held_index)
|
|
held_index = (active_hand_index % held_items.len) + 1
|
|
|
|
if(!isnum(held_index))
|
|
CRASH("You passed [held_index] into swap_hand instead of a number. WTF man")
|
|
|
|
var/previous_index = active_hand_index
|
|
active_hand_index = held_index
|
|
hud_used?.update_inventory_slot(ITEM_SLOT_HANDS, previous_index)
|
|
hud_used?.update_inventory_slot(ITEM_SLOT_HANDS, held_index)
|
|
return TRUE
|
|
|
|
/mob/proc/activate_hand(selected_hand)
|
|
if (!HAS_TRAIT(src, TRAIT_CAN_HOLD_ITEMS))
|
|
return
|
|
|
|
if(!selected_hand)
|
|
selected_hand = active_hand_index
|
|
else if(istext(selected_hand))
|
|
selected_hand = LOWER_TEXT(selected_hand)
|
|
if(selected_hand == "right" || selected_hand == "r")
|
|
selected_hand = 2
|
|
if(selected_hand == "left" || selected_hand == "l")
|
|
selected_hand = 1
|
|
|
|
if(selected_hand != active_hand_index)
|
|
swap_hand(selected_hand)
|
|
|
|
// _queue_verb requires a client, so when we don't have it (AI controlled mob) we don't use it
|
|
client ? mode() : execute_mode()
|
|
|
|
/mob/proc/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) //For sec bot threat assessment
|
|
return 0
|
|
|
|
///Get the ghost of this mob (from the mind)
|
|
/mob/proc/get_ghost(even_if_they_cant_reenter, ghosts_with_clients)
|
|
if(mind)
|
|
return mind.get_ghost(even_if_they_cant_reenter, ghosts_with_clients)
|
|
|
|
///Force get the ghost from the mind
|
|
/mob/proc/grab_ghost(force)
|
|
if(mind)
|
|
return mind.grab_ghost(force = force)
|
|
|
|
///Notify a ghost that its body is being revived
|
|
/mob/proc/notify_revival(message = "Someone is trying to revive you. Re-enter your corpse if you want to be revived!", sound = 'sound/effects/genetics.ogg', atom/source = null, flashwindow = TRUE)
|
|
var/mob/dead/observer/ghost = get_ghost()
|
|
if(ghost)
|
|
ghost.send_revival_notification(message, sound, source, flashwindow)
|
|
return ghost
|
|
|
|
/**
|
|
* Checks to see if the mob can cast normal magic spells.
|
|
*
|
|
* args:
|
|
* * magic_flags (optional) A bitfield with the type of magic being cast (see flags at: /datum/component/anti_magic)
|
|
**/
|
|
/mob/proc/can_cast_magic(magic_flags = MAGIC_RESISTANCE)
|
|
if(magic_flags == NONE) // magic with the NONE flag can always be cast
|
|
return TRUE
|
|
|
|
var/restrict_magic_flags = SEND_SIGNAL(src, COMSIG_MOB_RESTRICT_MAGIC, magic_flags)
|
|
return restrict_magic_flags == NONE
|
|
|
|
/**
|
|
* Checks to see if the mob can block magic
|
|
*
|
|
* args:
|
|
* * casted_magic_flags (optional) A bitfield with the types of magic resistance being checked (see flags at: /datum/component/anti_magic)
|
|
* * charge_cost (optional) The cost of charge to block a spell that will be subtracted from the protection used
|
|
**/
|
|
/mob/proc/can_block_magic(casted_magic_flags = MAGIC_RESISTANCE, charge_cost = 1)
|
|
if(casted_magic_flags == NONE) // magic with the NONE flag is immune to blocking
|
|
return FALSE
|
|
|
|
// A list of all things which are providing anti-magic to us
|
|
var/list/antimagic_sources = list()
|
|
var/is_magic_blocked = FALSE
|
|
|
|
if(SEND_SIGNAL(src, COMSIG_MOB_RECEIVE_MAGIC, casted_magic_flags, charge_cost, antimagic_sources) & COMPONENT_MAGIC_BLOCKED)
|
|
is_magic_blocked = TRUE
|
|
if(HAS_TRAIT(src, TRAIT_ANTIMAGIC))
|
|
is_magic_blocked = TRUE
|
|
if((casted_magic_flags & MAGIC_RESISTANCE_HOLY) && HAS_TRAIT(src, TRAIT_HOLY))
|
|
is_magic_blocked = TRUE
|
|
|
|
if(is_magic_blocked && charge_cost > 0 && !HAS_TRAIT(src, TRAIT_RECENTLY_BLOCKED_MAGIC))
|
|
on_block_magic_effects(casted_magic_flags, antimagic_sources)
|
|
|
|
return is_magic_blocked
|
|
|
|
/// Called whenever a magic effect with a charge cost is blocked and we haven't recently blocked magic.
|
|
/mob/proc/on_block_magic_effects(magic_flags, list/antimagic_sources)
|
|
return
|
|
|
|
/mob/living/on_block_magic_effects(magic_flags, list/antimagic_sources)
|
|
ADD_TRAIT(src, TRAIT_RECENTLY_BLOCKED_MAGIC, MAGIC_TRAIT)
|
|
addtimer(TRAIT_CALLBACK_REMOVE(src, TRAIT_RECENTLY_BLOCKED_MAGIC, MAGIC_TRAIT), 6 SECONDS)
|
|
|
|
var/mutable_appearance/antimagic_effect
|
|
var/antimagic_color
|
|
var/atom/antimagic_source = length(antimagic_sources) ? pick(antimagic_sources) : src
|
|
|
|
if(magic_flags & MAGIC_RESISTANCE)
|
|
visible_message(
|
|
span_warning("[src] pulses red as [ismob(antimagic_source) ? p_they() : antimagic_source] absorbs magic energy!"),
|
|
span_userdanger("An intense magical aura pulses around [ismob(antimagic_source) ? "you" : antimagic_source] as it dissipates into the air!"),
|
|
)
|
|
antimagic_effect = mutable_appearance('icons/effects/effects.dmi', "shield-red", MOB_SHIELD_LAYER)
|
|
antimagic_color = LIGHT_COLOR_BLOOD_MAGIC
|
|
playsound(src, 'sound/effects/magic/magic_block.ogg', 50, TRUE)
|
|
|
|
else if(magic_flags & MAGIC_RESISTANCE_HOLY)
|
|
visible_message(
|
|
span_warning("[src] starts to glow as [ismob(antimagic_source) ? p_they() : antimagic_source] emits a halo of light!"),
|
|
span_userdanger("A feeling of warmth washes over [ismob(antimagic_source) ? "you" : antimagic_source] as rays of light surround your body and protect you!"),
|
|
)
|
|
antimagic_effect = mutable_appearance('icons/mob/effects/genetics.dmi', "servitude", -MUTATIONS_LAYER)
|
|
antimagic_color = LIGHT_COLOR_HOLY_MAGIC
|
|
playsound(src, 'sound/effects/magic/magic_block_holy.ogg', 50, TRUE)
|
|
|
|
else if(magic_flags & MAGIC_RESISTANCE_MIND)
|
|
visible_message(
|
|
span_warning("[src] forehead shines as [ismob(antimagic_source) ? p_they() : antimagic_source] repulses magic from their mind!"),
|
|
span_userdanger("A feeling of cold splashes on [ismob(antimagic_source) ? "you" : antimagic_source] as your forehead reflects magic usering your mind!"),
|
|
)
|
|
antimagic_effect = mutable_appearance('icons/mob/effects/genetics.dmi', "telekinesishead", MOB_SHIELD_LAYER)
|
|
antimagic_color = LIGHT_COLOR_DARK_BLUE
|
|
playsound(src, 'sound/effects/magic/magic_block_mind.ogg', 50, TRUE)
|
|
|
|
mob_light(range = 2, power = 2, color = antimagic_color, duration = 5 SECONDS)
|
|
add_overlay(antimagic_effect)
|
|
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, cut_overlay), antimagic_effect), 5 SECONDS)
|
|
|
|
/**
|
|
* Buckle a living mob to this mob. Also turns you to face the other mob
|
|
*
|
|
* You can buckle on mobs if you're next to them since most are dense
|
|
*/
|
|
/mob/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE, buckle_mob_flags= NONE)
|
|
if(M.buckled)
|
|
return FALSE
|
|
return ..(M, force, check_loc, buckle_mob_flags)
|
|
|
|
///Can the mob interact() with an atom?
|
|
/mob/proc/can_interact_with(atom/A, treat_mob_as_adjacent)
|
|
if(isAdminGhostAI(src))
|
|
return TRUE
|
|
//Return early. we do not need to check that we are on adjacent turfs (i.e we are inside a closet)
|
|
if (treat_mob_as_adjacent && src == A.loc)
|
|
return TRUE
|
|
if (Adjacent(A))
|
|
return TRUE
|
|
var/datum/dna/mob_dna = has_dna()
|
|
if(mob_dna?.check_mutation(/datum/mutation/telekinesis) && tkMaxRangeCheck(src, A))
|
|
return TRUE
|
|
var/obj/item/item_in_hand = get_active_held_item()
|
|
if(istype(item_in_hand, /obj/item/machine_remote))
|
|
return TRUE
|
|
|
|
//range check
|
|
if(!interaction_range) // If you don't have extra length, GO AWAY
|
|
return FALSE
|
|
var/turf/our_turf = get_turf(src)
|
|
var/turf/their_turf = get_turf(A)
|
|
if (!our_turf || !their_turf)
|
|
return FALSE
|
|
return ISINRANGE(their_turf.x, our_turf.x - interaction_range, our_turf.x + interaction_range) && ISINRANGE(their_turf.y, our_turf.y - interaction_range, our_turf.y + interaction_range)
|
|
|
|
/**
|
|
* Checks whether a mob can perform an action to interact with an object
|
|
*
|
|
* The default behavior checks if the mob is:
|
|
* * Directly adjacent (1-tile radius)
|
|
* * Standing up (not resting)
|
|
* * Allows telekinesis to be used to skip adjacent checks (if they have DNA mutation)
|
|
* *
|
|
* action_bitflags: (see code/__DEFINES/mobs.dm)
|
|
* * NEED_GRAVITY - If gravity must be present to perform action (can't use pens without gravity)
|
|
* * NEED_LITERACY - If reading is required to perform action (can't read a book if you are illiterate)
|
|
* * NEED_LIGHT - If lighting must be present to perform action (can't heal someone in the dark)
|
|
* * NEED_DEXTERITY - If other mobs (monkeys, aliens, etc) can perform action (can't use computers if you are a monkey)
|
|
* * NEED_HANDS - If hands are required to perform action (can't pickup items if you are a cyborg)
|
|
* * FORBID_TELEKINESIS_REACH - If telekinesis is forbidden to perform action from a distance (ex. canisters are blacklisted from telekinesis manipulation)
|
|
* * ALLOW_SILICON_REACH - If silicons are allowed to perform action from a distance (silicons can operate airlocks from far away)
|
|
* * ALLOW_RESTING - If resting on the floor is allowed to perform action ()
|
|
* * ALLOW_VENTCRAWL - Mobs with ventcrawl traits can alt-click this to vent
|
|
* * BYPASS_ADJACENCY - The target does not have to be adjacent
|
|
* * SILENT_ADJACENCY - Adjacency is required but errors are not printed
|
|
* * NOT_INSIDE_TARGET - The target maybe adjacent but the mob should not be inside the target
|
|
* * ALLOW_PAI - Allows pAIs to perform an action
|
|
*
|
|
* silence_adjacency: Sometimes we want to use this proc to check interaction without allowing it to throw errors for base case adjacency
|
|
* Alt click uses this, as otherwise you can detect what is interactable from a distance via the error message
|
|
**/
|
|
/mob/proc/can_perform_action(atom/target, action_bitflags)
|
|
return
|
|
|
|
///Can this mob use storage
|
|
/mob/proc/canUseStorage()
|
|
return FALSE
|
|
|
|
/**
|
|
* Fully update the name of a mob
|
|
*
|
|
* This will update a mob's name, real_name, mind.name, GLOB.manifest records, pda, id and traitor text
|
|
*
|
|
* Calling this proc without an oldname will only update the mob and skip updating the pda, id and records ~Carn
|
|
*/
|
|
/mob/proc/fully_replace_character_name(oldname, newname)
|
|
if(!newname)
|
|
log_message("[src] failed name change from [oldname] as no new name was specified", LOG_OWNERSHIP)
|
|
return FALSE
|
|
if(oldname == newname)
|
|
log_message("[src] failed name change as the new name was the same as the old one: [oldname]", LOG_OWNERSHIP)
|
|
return FALSE
|
|
if(!istext(newname) && !isnull(newname))
|
|
stack_trace("[src] attempted to change its name from [oldname] to the non string value [newname]")
|
|
return FALSE
|
|
|
|
log_message("[src] name changed from [oldname] to [newname]", LOG_OWNERSHIP)
|
|
|
|
log_played_names(
|
|
ckey,
|
|
list(
|
|
"[newname]" = tag,
|
|
),
|
|
)
|
|
|
|
real_name = newname
|
|
name = newname
|
|
if(mind)
|
|
mind.name = newname
|
|
if(mind.key)
|
|
log_played_names(
|
|
ckey(mind.key),
|
|
list(
|
|
"[newname]" = tag,
|
|
),
|
|
) //Just in case the mind is unsynced at the moment.
|
|
|
|
if(oldname)
|
|
//update the datacore records! This is goig to be a bit costly.
|
|
replace_records_name(oldname,newname)
|
|
|
|
//update our pda and id if we have them on our person
|
|
replace_identification_name(oldname,newname)
|
|
|
|
for(var/datum/mind/T in SSticker.minds)
|
|
for(var/datum/objective/obj in T.get_all_objectives())
|
|
// Only update if this player is a target
|
|
if(obj.target && obj.target.current && obj.target.current.real_name == name)
|
|
obj.update_explanation_text()
|
|
// SKYRAT EDIT BEGIN - Update the mob chat color list, removing the old name
|
|
if(client)
|
|
GLOB.chat_colors_by_mob_name -= oldname
|
|
|
|
if(client)
|
|
GLOB.chat_colors_by_mob_name[name] = list(chat_color, chat_color_darkened)
|
|
// SKYRAT EDIT END
|
|
log_mob_tag("TAG: [tag] RENAMED: [key_name(src)]")
|
|
|
|
return TRUE
|
|
|
|
///Updates GLOB.manifest records with new name , see mob/living/carbon/human
|
|
/mob/proc/replace_records_name(oldname,newname)
|
|
return
|
|
|
|
///update the ID name of this mob
|
|
/mob/proc/replace_identification_name(oldname,newname)
|
|
var/list/searching = get_all_contents()
|
|
var/search_id = 1
|
|
var/search_pda = 1
|
|
|
|
for(var/A in searching)
|
|
if( search_id && isidcard(A) )
|
|
var/obj/item/card/id/ID = A
|
|
if(ID.registered_name == oldname)
|
|
ID.registered_name = newname
|
|
ID.update_label()
|
|
ID.update_icon()
|
|
if(ID.registered_account?.account_holder == oldname)
|
|
ID.registered_account.account_holder = newname
|
|
if(!search_pda)
|
|
break
|
|
search_id = 0
|
|
|
|
else if( search_pda && istype(A, /obj/item/modular_computer/pda) )
|
|
var/obj/item/modular_computer/pda/PDA = A
|
|
if(PDA.saved_identification == oldname)
|
|
PDA.imprint_id(name = newname)
|
|
PDA.UpdateDisplay()
|
|
if(!search_id)
|
|
break
|
|
search_pda = 0
|
|
|
|
/mob/proc/update_stat()
|
|
return
|
|
|
|
/mob/proc/update_health_hud()
|
|
return
|
|
|
|
/// Changes the stamina HUD based on new information
|
|
/mob/proc/update_stamina_hud()
|
|
return
|
|
|
|
///Update the lighting plane and sight of this mob (sends COMSIG_MOB_UPDATE_SIGHT)
|
|
/mob/proc/update_sight()
|
|
SHOULD_CALL_PARENT(TRUE)
|
|
SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT)
|
|
sync_lighting_plane_cutoff()
|
|
|
|
///Set the lighting plane hud filters to the mobs lighting_cutoff var
|
|
/mob/proc/sync_lighting_plane_cutoff()
|
|
if(!hud_used)
|
|
return
|
|
for(var/atom/movable/screen/plane_master/rendering_plate/lighting/light as anything in hud_used.get_true_plane_masters(RENDER_PLANE_LIGHTING))
|
|
light.set_light_cutoff(lighting_cutoff, lighting_color_cutoffs)
|
|
|
|
///Update the mouse pointer of the attached client in this mob
|
|
/mob/proc/update_mouse_pointer()
|
|
if(!client)
|
|
return
|
|
if(client.mouse_pointer_icon != initial(client.mouse_pointer_icon))//only send changes to the client if theyre needed
|
|
client.mouse_pointer_icon = initial(client.mouse_pointer_icon)
|
|
if(examine_cursor_icon && client.keys_held["Shift"]) //mouse shit is hardcoded, make this non hard-coded once we make mouse modifiers bindable
|
|
client.mouse_pointer_icon = examine_cursor_icon
|
|
if(istype(loc, /obj/vehicle/sealed))
|
|
var/obj/vehicle/sealed/E = loc
|
|
if(E.mouse_pointer)
|
|
client.mouse_pointer_icon = E.mouse_pointer
|
|
if(client.mouse_override_icon)
|
|
client.mouse_pointer_icon = client.mouse_override_icon
|
|
|
|
/**
|
|
* Can this mob see in the dark
|
|
*
|
|
* This checks all traits, glasses, and robotic eyeball implants to see if the mob can see in the dark
|
|
* this does NOT check if the mob is missing it's eyeballs.
|
|
**/
|
|
/mob/proc/has_nightvision()
|
|
// Somewhat conservative, basically is your lighting plane bright enough that you the user can see stuff
|
|
var/light_offset = lighting_cutoff
|
|
if(length(lighting_color_cutoffs) == 3)
|
|
light_offset += (lighting_color_cutoffs[1] + lighting_color_cutoffs[2] + lighting_color_cutoffs[3]) / 3
|
|
return light_offset >= LIGHTING_NIGHTVISION_THRESHOLD
|
|
|
|
/// This mob is abile to read books
|
|
/mob/proc/is_literate()
|
|
return HAS_TRAIT(src, TRAIT_LITERATE) && !HAS_TRAIT(src, TRAIT_ILLITERATE)
|
|
|
|
/**
|
|
* Proc that returns TRUE if the mob can write using the writing_instrument, FALSE otherwise.
|
|
*
|
|
* This proc a side effect, outputting a message to the mob's chat with a reason if it returns FALSE.
|
|
* Unless silent_if_not_writing_tool is TRUE. In that case it'll be silent if it isn't a writing implement/tool/instrument w/e.
|
|
*/
|
|
/mob/proc/can_write(obj/item/writing_instrument, silent_if_not_writing_tool = FALSE)
|
|
if(!writing_instrument)
|
|
return FALSE
|
|
|
|
if(!IS_WRITING_UTENSIL(writing_instrument))
|
|
if(!silent_if_not_writing_tool)
|
|
to_chat(src, span_warning("You can't write with \the [writing_instrument]!"))
|
|
return FALSE
|
|
|
|
if(!is_literate())
|
|
to_chat(src, span_warning("You try to write, but don't know how to spell anything!"))
|
|
return FALSE
|
|
|
|
if(!has_light_nearby() && !has_nightvision())
|
|
to_chat(src, span_warning("It's too dark in here to write anything!"))
|
|
return FALSE
|
|
|
|
if(has_gravity())
|
|
return TRUE
|
|
|
|
var/obj/item/pen/pen = writing_instrument
|
|
|
|
if(istype(pen) && pen.requires_gravity)
|
|
to_chat(src, span_warning("You try to write, but \the [writing_instrument] doesn't work in zero gravity!"))
|
|
return FALSE
|
|
|
|
return TRUE
|
|
|
|
/**
|
|
* Checks if there is enough light where the mob is located
|
|
*
|
|
* Args:
|
|
* light_amount (optional) - A decimal amount between 1.0 through 0.0 (default is 0.2)
|
|
**/
|
|
/mob/proc/has_light_nearby(light_amount = LIGHTING_TILE_IS_DARK)
|
|
var/turf/mob_location = get_turf(src)
|
|
var/area/mob_area = get_area(src)
|
|
|
|
if(mob_location.get_lumcount() > light_amount)
|
|
return TRUE
|
|
else if(!mob_area.static_lighting)
|
|
return TRUE
|
|
|
|
return FALSE
|
|
|
|
|
|
|
|
/// Can this mob read
|
|
/mob/proc/can_read(atom/viewed_atom, reading_check_flags = (READING_CHECK_LITERACY|READING_CHECK_LIGHT), silent = FALSE)
|
|
if((reading_check_flags & READING_CHECK_LITERACY) && !is_literate())
|
|
if(!silent)
|
|
to_chat(src, span_warning("You try to read [viewed_atom], but can't comprehend any of it."))
|
|
return FALSE
|
|
|
|
if((reading_check_flags & READING_CHECK_LIGHT) && !has_light_nearby() && !has_nightvision())
|
|
if(!silent)
|
|
to_chat(src, span_warning("It's too dark in here to read!"))
|
|
return FALSE
|
|
|
|
return TRUE
|
|
|
|
/**
|
|
* Get the mob VV dropdown extras
|
|
*/
|
|
/mob/vv_get_dropdown()
|
|
. = ..()
|
|
VV_DROPDOWN_OPTION("", "--- /mob ---")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIB, "Gib")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIVE_AI, "Give AI Controller")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIVE_AI_SPEECH, "Give Random AI Speech")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIVE_SPELL, "Give Spell")
|
|
VV_DROPDOWN_OPTION(VV_HK_REMOVE_SPELL, "Remove Spell")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIVE_MOB_ACTION, "Give Mob Ability")
|
|
VV_DROPDOWN_OPTION(VV_HK_REMOVE_MOB_ACTION, "Remove Mob Ability")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIVE_DISEASE, "Give Disease")
|
|
VV_DROPDOWN_OPTION(VV_HK_GODMODE, "Toggle Godmode")
|
|
VV_DROPDOWN_OPTION(VV_HK_DROP_ALL, "Drop Everything")
|
|
VV_DROPDOWN_OPTION(VV_HK_REGEN_ICONS, "Regenerate Icons")
|
|
VV_DROPDOWN_OPTION(VV_HK_REGEN_ICONS_FULL, "Regenerate Icons & Clear Stuck Overlays")
|
|
VV_DROPDOWN_OPTION(VV_HK_PLAYER_PANEL, "Show player panel")
|
|
VV_DROPDOWN_OPTION(VV_HK_BUILDMODE, "Toggle Buildmode")
|
|
VV_DROPDOWN_OPTION(VV_HK_DIRECT_CONTROL, "Assume Direct Control")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIVE_DIRECT_CONTROL, "Give Direct Control")
|
|
VV_DROPDOWN_OPTION(VV_HK_OFFER_GHOSTS, "Offer Control to Ghosts")
|
|
VV_DROPDOWN_OPTION(VV_HK_VIEW_PLANES, "View/Edit Planes")
|
|
VV_DROPDOWN_OPTION(VV_HK_GIVE_ACCESS, "Give Access")
|
|
|
|
/mob/vv_do_topic(list/href_list)
|
|
. = ..()
|
|
|
|
if(!.)
|
|
return
|
|
|
|
if(href_list[VV_HK_REGEN_ICONS])
|
|
regenerate_icons()
|
|
|
|
if(href_list[VV_HK_REGEN_ICONS_FULL])
|
|
cut_overlays()
|
|
regenerate_icons()
|
|
|
|
if(href_list[VV_HK_PLAYER_PANEL])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/show_player_panel, src)
|
|
|
|
if(href_list[VV_HK_GODMODE])
|
|
if(!check_rights(R_ADMIN))
|
|
return
|
|
usr.client.cmd_admin_godmode(src)
|
|
|
|
if(href_list[VV_HK_GIVE_AI])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/give_ai_controller, src)
|
|
|
|
if(href_list[VV_HK_GIVE_AI_SPEECH])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/give_ai_speech, src)
|
|
|
|
if(href_list[VV_HK_GIVE_MOB_ACTION])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/give_mob_action, src)
|
|
|
|
if(href_list[VV_HK_REMOVE_MOB_ACTION])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/remove_mob_action, src)
|
|
|
|
if(href_list[VV_HK_GIVE_SPELL])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/give_spell, src)
|
|
|
|
if(href_list[VV_HK_REMOVE_SPELL])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/remove_spell, src)
|
|
|
|
if(href_list[VV_HK_GIVE_DISEASE])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/give_disease, src)
|
|
|
|
if(href_list[VV_HK_GIB])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/gib_them, src)
|
|
|
|
if(href_list[VV_HK_BUILDMODE])
|
|
if(!check_rights(R_BUILD))
|
|
return
|
|
togglebuildmode(src)
|
|
|
|
if(href_list[VV_HK_DROP_ALL])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/drop_everything, src)
|
|
|
|
if(href_list[VV_HK_DIRECT_CONTROL])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/cmd_assume_direct_control, src)
|
|
|
|
if(href_list[VV_HK_GIVE_DIRECT_CONTROL])
|
|
return SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/cmd_give_direct_control, src)
|
|
|
|
if(href_list[VV_HK_OFFER_GHOSTS])
|
|
offer_control(src)
|
|
|
|
if(href_list[VV_HK_VIEW_PLANES])
|
|
if(!check_rights(R_DEBUG))
|
|
return
|
|
usr.client.edit_plane_masters(src)
|
|
|
|
if(href_list[VV_HK_GIVE_ACCESS])
|
|
AddComponent(/datum/component/simple_access, SSid_access.get_region_access_list(list(REGION_ALL_GLOBAL)))
|
|
to_chat(usr, span_notice("Access granted."))
|
|
/**
|
|
* extra var handling for the logging var
|
|
*/
|
|
/mob/vv_get_var(var_name)
|
|
switch(var_name)
|
|
if(NAMEOF(src, logging))
|
|
return debug_variable(var_name, logging, 0, src, FALSE)
|
|
. = ..()
|
|
|
|
/mob/vv_auto_rename(new_name)
|
|
//Do not do parent's actions, as we *usually* do this differently.
|
|
fully_replace_character_name(real_name, new_name)
|
|
|
|
///Adjust the nutrition of a mob
|
|
/mob/proc/adjust_nutrition(change, forced = FALSE) //Honestly FUCK the oldcoders for putting nutrition on /mob someone else can move it up because holy hell I'd have to fix SO many typechecks
|
|
if(HAS_TRAIT(src, TRAIT_NOHUNGER) && !forced)
|
|
return
|
|
//Bubber edit BEGIN - Allow for people to get hungry faster
|
|
if(HAS_TRAIT(src, TRAIT_FAST_METABOLISM) && change < 0)
|
|
change = change * 1.5
|
|
//Bubber edit END
|
|
|
|
nutrition = max(0, nutrition + change)
|
|
|
|
/mob/living/adjust_nutrition(change, forced)
|
|
. = ..()
|
|
// Queue update if change is small enough (6 is 1% of nutrition softcap)
|
|
if(abs(change) >= 6)
|
|
update_nutrition()
|
|
else
|
|
living_flags |= QUEUE_NUTRITION_UPDATE
|
|
|
|
///Force set the mob nutrition
|
|
/mob/proc/set_nutrition(set_to, forced = FALSE) //Seriously fuck you oldcoders.
|
|
if(HAS_TRAIT(src, TRAIT_NOHUNGER) && !forced)
|
|
return
|
|
|
|
nutrition = max(0, set_to)
|
|
|
|
/mob/living/set_nutrition(set_to, forced)
|
|
var/old_nutrition = nutrition
|
|
. = ..()
|
|
// Queue update if change is small enough (6 is 1% of nutrition softcap)
|
|
if(abs(old_nutrition - nutrition) >= 6)
|
|
update_nutrition()
|
|
else
|
|
living_flags |= QUEUE_NUTRITION_UPDATE
|
|
|
|
/// Updates nutrition related effects
|
|
/mob/living/proc/update_nutrition()
|
|
mob_mood?.update_nutrition_moodlets()
|
|
var/atom/movable/screen/hunger/hunger_bar = hud_used?.screen_objects[HUD_MOB_HUNGER]
|
|
if (hunger_bar)
|
|
hunger_bar.update_hunger_bar()
|
|
SEND_SIGNAL(src, COMSIG_LIVING_UPDATE_NUTRITION)
|
|
|
|
/// Apply a proper movespeed modifier based on items we have equipped
|
|
/mob/proc/update_equipment_speed_mods()
|
|
var/speedies = 0
|
|
var/immutable_speedies = 0
|
|
//Bubber Addition
|
|
var/true_immute_speedies = 0
|
|
//Bubber Addition End
|
|
for(var/obj/item/thing in get_equipped_speed_mod_items())
|
|
//Bubber Addition
|
|
if(thing.bubber_obj_flags & TRUE_IMMUTABLE_SLOW)
|
|
true_immute_speedies += thing.slowdown
|
|
//Bubber Addition End
|
|
else if(thing.item_flags & IMMUTABLE_SLOW)
|
|
immutable_speedies += thing.slowdown
|
|
else
|
|
speedies += thing.slowdown
|
|
|
|
//if we have TRAIT_STURDY_FRAME, we reduce our overall speed penalty UNLESS that penalty would be a negative value, and therefore a speed boost.
|
|
if(speedies > 0 && HAS_TRAIT(src, TRAIT_STURDY_FRAME))
|
|
speedies *= 0.2
|
|
//Bubber Addition
|
|
if(true_immute_speedies)
|
|
add_or_update_variable_movespeed_modifier(
|
|
/datum/movespeed_modifier/equipment_speedmod/true_immutable,
|
|
multiplicative_slowdown = true_immute_speedies,
|
|
)
|
|
else
|
|
remove_movespeed_modifier(/datum/movespeed_modifier/equipment_speedmod/true_immutable)
|
|
//Bubber Addition End
|
|
|
|
if(immutable_speedies)
|
|
add_or_update_variable_movespeed_modifier(
|
|
/datum/movespeed_modifier/equipment_speedmod/immutable,
|
|
multiplicative_slowdown = immutable_speedies,
|
|
)
|
|
else
|
|
remove_movespeed_modifier(/datum/movespeed_modifier/equipment_speedmod/immutable)
|
|
|
|
if(speedies)
|
|
add_or_update_variable_movespeed_modifier(
|
|
/datum/movespeed_modifier/equipment_speedmod,
|
|
multiplicative_slowdown = speedies,
|
|
)
|
|
else
|
|
remove_movespeed_modifier(/datum/movespeed_modifier/equipment_speedmod)
|
|
|
|
/mob/proc/set_stat(new_stat)
|
|
if(new_stat == stat)
|
|
return
|
|
. = stat
|
|
stat = new_stat
|
|
SEND_SIGNAL(src, COMSIG_MOB_STATCHANGE, new_stat, .)
|
|
|
|
/mob/vv_edit_var(var_name, var_value)
|
|
switch(var_name)
|
|
if(NAMEOF(src, focus))
|
|
set_focus(var_value)
|
|
. = TRUE
|
|
if(NAMEOF(src, nutrition))
|
|
set_nutrition(var_value)
|
|
. = TRUE
|
|
if(NAMEOF(src, stat))
|
|
set_stat(var_value)
|
|
. = TRUE
|
|
|
|
if(!isnull(.))
|
|
datum_flags |= DF_VAR_EDITED
|
|
return
|
|
|
|
var/slowdown_edit = (var_name == NAMEOF(src, cached_multiplicative_slowdown))
|
|
var/diff
|
|
if(slowdown_edit && isnum(cached_multiplicative_slowdown) && isnum(var_value))
|
|
remove_movespeed_modifier(/datum/movespeed_modifier/admin_varedit)
|
|
diff = var_value - cached_multiplicative_slowdown
|
|
|
|
. = ..()
|
|
|
|
if(. && slowdown_edit && isnum(diff))
|
|
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/admin_varedit, multiplicative_slowdown = diff)
|
|
|
|
/// Cleanup proc that's called when a mob loses a client, either through client destroy or logout
|
|
/// Logout happens post client del, so we can't just copypaste this there. This keeps things clean and consistent
|
|
/mob/proc/become_uncliented()
|
|
if(!canon_client)
|
|
return
|
|
|
|
for(var/datum/callback/CB as anything in persistent_client.post_logout_callbacks)
|
|
CB.Invoke()
|
|
|
|
if(canon_client?.movingmob)
|
|
LAZYREMOVE(canon_client.movingmob.client_mobs_in_contents, src)
|
|
canon_client.movingmob = null
|
|
|
|
clear_important_client_contents()
|
|
canon_client = null
|
|
|
|
///Shows a tgui window with memories
|
|
/mob/proc/open_memory_panel()
|
|
if(!mind)
|
|
var/fail_message = "You have no mind!"
|
|
if(isobserver(src))
|
|
fail_message += " You have to be in the current round at some point to have one."
|
|
to_chat(src, span_warning(fail_message))
|
|
return
|
|
if(!mind.memory_panel)
|
|
mind.memory_panel = new(usr, mind)
|
|
mind.memory_panel.ui_interact(usr)
|
|
|
|
/datum/memory_panel
|
|
var/datum/mind/mind_reference
|
|
var/client/holder //client of whoever is using this datum
|
|
|
|
/datum/memory_panel/New(user, mind_reference)//user can either be a client or a mob due to byondcode(tm)
|
|
if (istype(user, /client))
|
|
var/client/user_client = user
|
|
holder = user_client //if its a client, assign it to holder
|
|
else
|
|
var/mob/user_mob = user
|
|
holder = user_mob.client //if its a mob, assign the mob's client to holder
|
|
src.mind_reference = mind_reference
|
|
|
|
/datum/memory_panel/Destroy(force)
|
|
mind_reference.memory_panel = null
|
|
. = ..()
|
|
|
|
/datum/memory_panel/ui_state(mob/user)
|
|
return GLOB.always_state
|
|
|
|
/datum/memory_panel/ui_close()
|
|
qdel(src)
|
|
|
|
/datum/memory_panel/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "MemoryPanel")
|
|
ui.open()
|
|
|
|
/datum/memory_panel/ui_data(mob/user)
|
|
var/list/data = list()
|
|
var/list/memories = list()
|
|
|
|
for(var/memory_key in user?.mind.memories)
|
|
var/datum/memory/memory = user.mind.memories[memory_key]
|
|
memories += list(list("name" = memory.name, "quality" = memory.story_value))
|
|
|
|
data["memories"] = memories
|
|
return data
|
|
|
|
/mob/key_down(key, client/client, full_key)
|
|
..()
|
|
SEND_SIGNAL(src, COMSIG_MOB_KEYDOWN, key, client, full_key)
|
|
|
|
/mob/proc/setup_hud_traits()
|
|
for(var/hud_trait in GLOB.trait_to_hud)
|
|
RegisterSignal(src, SIGNAL_ADDTRAIT(hud_trait), PROC_REF(hud_trait_enabled))
|
|
RegisterSignal(src, SIGNAL_REMOVETRAIT(hud_trait), PROC_REF(hud_trait_disabled))
|
|
for(var/hud_trait in GLOB.trait_blockers_to_hud)
|
|
RegisterSignal(src, SIGNAL_ADDTRAIT(hud_trait), PROC_REF(hud_trait_blocker_gained))
|
|
RegisterSignal(src, SIGNAL_REMOVETRAIT(hud_trait), PROC_REF(hud_trait_blocker_lost))
|
|
|
|
/mob/proc/hud_trait_enabled(datum/source, new_trait)
|
|
SIGNAL_HANDLER
|
|
|
|
for(var/blocker, blocked_traits in GLOB.trait_blockers_to_hud)
|
|
if(HAS_TRAIT(src, blocker) && (new_trait in blocked_traits))
|
|
return
|
|
|
|
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[new_trait]]
|
|
datahud.show_to(src)
|
|
|
|
/mob/proc/hud_trait_disabled(datum/source, lost_trait)
|
|
SIGNAL_HANDLER
|
|
|
|
for(var/blocker, blocked_traits in GLOB.trait_blockers_to_hud)
|
|
if(HAS_TRAIT(src, blocker) && (lost_trait in blocked_traits))
|
|
return // it may seem counterintuitive to check for blockers on trait removal, the blocker now has total reign over whether the hud should come back
|
|
|
|
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[lost_trait]]
|
|
datahud.hide_from(src)
|
|
|
|
/mob/proc/hud_trait_blocker_gained(datum/source, new_trait)
|
|
SIGNAL_HANDLER
|
|
|
|
for(var/trait in GLOB.trait_blockers_to_hud[new_trait])
|
|
if(!HAS_TRAIT(src, trait))
|
|
continue
|
|
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[trait]]
|
|
datahud.hide_from(src)
|
|
|
|
/mob/proc/hud_trait_blocker_lost(datum/source, new_trait)
|
|
SIGNAL_HANDLER
|
|
|
|
for(var/trait in GLOB.trait_blockers_to_hud[new_trait])
|
|
if(!HAS_TRAIT(src, trait))
|
|
continue
|
|
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[trait]]
|
|
datahud.show_to(src)
|
|
|
|
/**
|
|
* Returns the access list for this mob, most mobs don't have any access.
|
|
*/
|
|
/mob/proc/get_access() as /list
|
|
return list()
|