mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-28 19:21:48 +00:00
I changed how uplinks worked. Instead of there being a duplicate item which would switch out when it activates, there's an item called "obj/item/device/uplink/hidden". It is a hidden uplink which you can place in any obj/item. In "hidden" is where it will generate menus, check for triggers to show the menu and etc.. No need to switch out with duplicate items or add the menu onto the PDA's notes. How to create a new uplink item in 3 easy steps! 1. All obj/item 's have a hidden_uplink var. By default it's null. Give the item one with "new(src)", it must be in it's contents. Feel free to add/remove "uses". 2. Code in the triggers. Use check_trigger for this, I recommend closing the item's menu with "usr << browse(null, "window=windowname") if it returns true. The var/value is the value that will be compared with the var/target. If they are equal it will activate the menu. 3. If you want the menu to stay until the users locks his uplink, add an active_uplink_check(mob/user as mob) in your interact/attack_hand proc. Then check if it's true, if true return. This will stop the normal menu appearing and will instead show the uplink menu. I've given the recharge station's verbs a category so they don't create their own tab. I've added a mob/proc called put_in_any_hand_if_possible. Name speaks for itself. Returns true if successful, false otherwise. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4450 316c924e-a436-60f5-8080-3fe189b3f50e
853 lines
22 KiB
Plaintext
853 lines
22 KiB
Plaintext
/mob/Del()//This makes sure that mobs with clients/keys are not just deleted from the game.
|
|
ghostize()
|
|
remove_from_mob_list(src)
|
|
..()
|
|
|
|
/mob/New()
|
|
add_to_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)
|
|
|
|
/atom/proc/relaymove()
|
|
return
|
|
|
|
/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 << "<I>... You can almost hear someone talking ...</I>"
|
|
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()
|
|
if (handcuffed)
|
|
return 1
|
|
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)
|
|
|
|
/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)
|
|
equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
|
|
|
//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_w_uniform,\
|
|
slot_wear_suit,\
|
|
slot_wear_mask,\
|
|
slot_head,\
|
|
slot_shoes,\
|
|
slot_gloves,\
|
|
slot_ears,\
|
|
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/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.machine = src
|
|
var/dat = {"
|
|
<B><HR><FONT size=3>[name]</FONT></B>
|
|
<BR><HR>
|
|
<BR><B>Head(Mask):</B> <A href='?src=\ref[src];item=mask'>[(wear_mask ? wear_mask : "Nothing")]</A>
|
|
<BR><B>Left Hand:</B> <A href='?src=\ref[src];item=l_hand'>[(l_hand ? l_hand : "Nothing")]</A>
|
|
<BR><B>Right Hand:</B> <A href='?src=\ref[src];item=r_hand'>[(r_hand ? r_hand : "Nothing")]</A>
|
|
<BR><B>Back:</B> <A href='?src=\ref[src];item=back'>[(back ? back : "Nothing")]</A> [((istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/weapon/tank) && !( internal )) ? text(" <A href='?src=\ref[];item=internal'>Set Internal</A>", src) : "")]
|
|
<BR>[(handcuffed ? text("<A href='?src=\ref[src];item=handcuff'>Handcuffed</A>") : text("<A href='?src=\ref[src];item=handcuff'>Not Handcuffed</A>"))]
|
|
<BR>[(internal ? text("<A href='?src=\ref[src];item=internal'>Remove Internal</A>") : "")]
|
|
<BR><A href='?src=\ref[src];item=pockets'>Empty Pockets</A>
|
|
<BR><A href='?src=\ref[user];refresh=1'>Refresh</A>
|
|
<BR><A href='?src=\ref[user];mach_close=mob[name]'>Close</A>
|
|
<BR>"}
|
|
user << browse(dat, text("window=mob[];size=325x500", name))
|
|
onclose(user, "mob[name]")
|
|
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 = "IC"
|
|
set src = usr
|
|
|
|
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()
|
|
return
|
|
|
|
/*
|
|
/mob/verb/dump_source()
|
|
|
|
var/master = "<PRE>"
|
|
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 = "OOC"
|
|
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 = "OOC"
|
|
|
|
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 += "<BR>[msg]"
|
|
|
|
if (popup)
|
|
memory()
|
|
|
|
/*
|
|
/mob/verb/help()
|
|
set name = "Help"
|
|
src << browse('help.html', "window=help")
|
|
return
|
|
*/
|
|
|
|
/mob/verb/abandon_mob()
|
|
set name = "Respawn"
|
|
set category = "OOC"
|
|
|
|
if (!( abandon_allowed ))
|
|
return
|
|
if ((stat != 2 || !( ticker )))
|
|
usr << "\blue <B>You must be dead to use this!</B>"
|
|
return
|
|
|
|
log_game("[usr.name]/[usr.key] used abandon mob.")
|
|
|
|
usr << "\blue <B>Please roleplay correctly!</B>"
|
|
|
|
if(!client)
|
|
log_game("[usr.key] AM failed due to disconnect.")
|
|
return
|
|
for(var/obj/screen/t in usr.client.screen)
|
|
if (t.loc == null)
|
|
//t = null
|
|
del(t)
|
|
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
|
|
|
|
|
|
|
|
if(client && client.holder && (client.holder.state == 2))
|
|
client.admin_play()
|
|
return
|
|
|
|
M.key = client.key
|
|
M.Login()
|
|
return
|
|
|
|
/mob/verb/changes()
|
|
set name = "Changelog"
|
|
set category = "OOC"
|
|
if (client)
|
|
src.getFiles('postcardsmall.jpg',
|
|
'somerights20.png',
|
|
'88x31.png',
|
|
'bug-minus.png',
|
|
'cross-circle.png',
|
|
'hard-hat-exclamation.png',
|
|
'image-minus.png',
|
|
'image-plus.png',
|
|
'music-minus.png',
|
|
'music-plus.png',
|
|
'tick-circle.png',
|
|
'wrench-screwdriver.png',
|
|
'spell-check.png',
|
|
'burn-exclamation.png',
|
|
'chevron.png',
|
|
'chevron-expand.png',
|
|
'changelog.css',
|
|
'changelog.js'
|
|
)
|
|
src << browse('changelog.html', "window=changes;size=675x650")
|
|
client.changes = 1
|
|
|
|
/client/var/ghost_ears = 1
|
|
/client/verb/toggle_ghost_ears()
|
|
set name = "Ghost ears"
|
|
set category = "OOC"
|
|
set desc = "Hear talks from everywhere"
|
|
ghost_ears = !ghost_ears
|
|
if (ghost_ears)
|
|
usr << "\blue Now you hear all speech in the world"
|
|
else
|
|
usr << "\blue Now you hear speech only from nearest creatures."
|
|
|
|
/client/var/ghost_sight = 1
|
|
/client/verb/toggle_ghost_sight()
|
|
set name = "Ghost sight"
|
|
set category = "OOC"
|
|
set desc = "Hear emotes from everywhere"
|
|
ghost_sight = !ghost_sight
|
|
if (ghost_sight)
|
|
usr << "\blue Now you hear all emotes in the world"
|
|
else
|
|
usr << "\blue Now you hear emotes only from nearest creatures."
|
|
|
|
|
|
|
|
/mob/verb/observe()
|
|
set name = "Observe"
|
|
set category = "OOC"
|
|
var/is_admin = 0
|
|
|
|
if (client.holder && client.holder.level >= 1 && ( client.holder.state == 2 || client.holder.level > 3 ))
|
|
is_admin = 1
|
|
else if (istype(src, /mob/new_player) || stat != 2)
|
|
usr << "\blue You must be observing to use this!"
|
|
return
|
|
|
|
if (is_admin && stat == 2)
|
|
is_admin = 0
|
|
|
|
var/list/names = list()
|
|
var/list/namecounts = list()
|
|
var/list/creatures = list()
|
|
|
|
for (var/obj/item/weapon/disk/nuclear/D in world)
|
|
var/name = "Nuclear Disk"
|
|
if (names.Find(name))
|
|
namecounts[name]++
|
|
name = "[name] ([namecounts[name]])"
|
|
else
|
|
names.Add(name)
|
|
namecounts[name] = 1
|
|
creatures[name] = D
|
|
|
|
for (var/obj/machinery/singularity/S in world)
|
|
var/name = "Singularity"
|
|
if (names.Find(name))
|
|
namecounts[name]++
|
|
name = "[name] ([namecounts[name]])"
|
|
else
|
|
names.Add(name)
|
|
namecounts[name] = 1
|
|
creatures[name] = S
|
|
|
|
for (var/obj/machinery/bot/B in world)
|
|
var/name = "BOT: [B.name]"
|
|
if (names.Find(name))
|
|
namecounts[name]++
|
|
name = "[name] ([namecounts[name]])"
|
|
else
|
|
names.Add(name)
|
|
namecounts[name] = 1
|
|
creatures[name] = B
|
|
/*
|
|
for (var/mob/living/silicon/decoy/D in world)
|
|
var/name = "[D.name]"
|
|
if (names.Find(name))
|
|
namecounts[name]++
|
|
name = "[name] ([namecounts[name]])"
|
|
else
|
|
names.Add(name)
|
|
namecounts[name] = 1
|
|
creatures[name] = D
|
|
*/
|
|
|
|
|
|
|
|
//THIS IS HOW YOU ADD OBJECTS TO BE OBSERVED
|
|
|
|
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
|
|
|
|
//THIS IS THE MOBS PART: LOOK IN HELPERS.DM
|
|
|
|
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)
|
|
machine = null
|
|
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"]]")
|
|
machine = null
|
|
src << browse(null, t1)
|
|
// ..()
|
|
return
|
|
|
|
/mob/proc/UpdateLuminosity()
|
|
if(src.total_luminosity == src.last_luminosity) return 0//nothing to do here
|
|
src.last_luminosity = src.total_luminosity
|
|
sd_SetLuminosity(min(src.total_luminosity,7))//Current hardcode max at 7, should likely be a const somewhere else
|
|
return 1
|
|
|
|
/mob/MouseDrop(mob/M as mob)
|
|
..()
|
|
if(M != usr) return
|
|
if(usr == src) return
|
|
if(get_dist(usr,src) > 1) return
|
|
if(istype(M,/mob/living/silicon/ai)) return
|
|
if(LinkBlocked(usr.loc,loc)) return
|
|
show_inv(usr)
|
|
|
|
/atom/movable
|
|
var/mob/pulledby = null
|
|
|
|
/atom/movable/verb/pull()
|
|
set name = "Pull"
|
|
set category = "IC"
|
|
set src in oview(1)
|
|
|
|
usr.start_pulling(src)
|
|
return
|
|
|
|
/mob/proc/stop_pulling()
|
|
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 ))
|
|
if(pulling)
|
|
stop_pulling()
|
|
|
|
src.pulling = AM
|
|
AM.pulledby = src
|
|
if(ismob(AM))
|
|
var/mob/M = AM
|
|
if(!iscarbon(src))
|
|
M.LAssailant = null
|
|
else
|
|
M.LAssailant = usr
|
|
|
|
/atom/verb/examine()
|
|
set name = "Examine"
|
|
set category = "IC"
|
|
set src in oview(12) //make it work from farther away
|
|
|
|
if (!( usr ))
|
|
return
|
|
usr << "That's \a [src]." //changed to "That's" from "This is" because "This is some metal sheets" sounds dumb compared to "That's some metal sheets" ~Carn
|
|
usr << desc
|
|
// *****RM
|
|
//usr << "[name]: Dn:[density] dir:[dir] cont:[contents] icon:[icon] is:[icon_state] loc:[loc]"
|
|
return
|
|
|
|
/mob/proc/can_use_hands()
|
|
if(handcuffed)
|
|
return 0
|
|
if(buckled && ! istype(buckled, /obj/structure/stool/bed/chair)) // buckling does not restrict hands
|
|
return 0
|
|
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()
|
|
..()
|
|
|
|
statpanel("Status")
|
|
|
|
if (client && client.holder)
|
|
stat(null, "([x], [y], [z])")
|
|
stat(null, "CPU: [world.cpu]")
|
|
if (master_controller)
|
|
stat(null, "Current Iteration: [controller_iteration]")
|
|
stat(null, "Time between ticks: [last_tick_duration]")
|
|
|
|
|
|
if (spell_list.len)
|
|
|
|
for(var/obj/effect/proc_holder/spell/S in spell_list)
|
|
switch(S.charge_type)
|
|
if("recharge")
|
|
statpanel("Spells","[S.charge_counter/10.0]/[S.charge_max/10]",S)
|
|
if("charges")
|
|
statpanel("Spells","[S.charge_counter]/[S.charge_max]",S)
|
|
if("holdervar")
|
|
statpanel("Spells","[S.holder_var_type] [S.holder_var_amount]",S)
|
|
|
|
|
|
|
|
// 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()
|
|
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 = 0
|
|
canmove = 1
|
|
|
|
if(lying)
|
|
density = 0
|
|
drop_l_hand()
|
|
drop_r_hand()
|
|
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( update_icon ) //forces a full overlay update
|
|
update_icon = 0
|
|
regenerate_icons()
|
|
else if( lying != lying_prev )
|
|
update_icons()
|
|
|
|
return canmove
|
|
|
|
|
|
/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
|
|
|
|
/*
|
|
* Sends resource files to client cache
|
|
*/
|
|
/mob/proc/getFiles()
|
|
if(!isemptylist(args))
|
|
for(var/file in args)
|
|
src << browse_rsc(file)
|
|
return 1
|
|
return 0 |