mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-02 21:43:22 +00:00
I'm currently working on moving all of the vars in mob_defines.dm and some procs in mob.dm into more fitting places. For example, ghosts and simple animals can not be cloned, so they do not need a cloneloss var. Cloneloss would be better fitting to /mob/living or even /mob/living/carbon. By moving these defines into proper children of /mob we lower the amount of resources that must be set aside every time a mob is created and we lower the amount of data that gets transfered between mobs when we combine, transfer or transform them. In theory, this should help free up some resources and combat lag. Due to how integrated some of these defines are in the rest of the code, I'm going to be committing this cleanup in small batches. Doing it this way instead of one massive commit means that bugs will be easier to locate and identify. It is also less likely to overwhelm players with bugs, and if it still does, it will make it easier for us to revert only the section that is causing problems. Smaller commits also means merging with existing code will be less of a nightmare and has less potential for merging mistakes. One of my goals in this cleanup is to add a description to every single variable in mob defines. While some of them are self explanatory, there are some there that are used in horribly obscure ways on top of having no comment to describe their use. ----------------------- Mob defines moved to living: - last_special* - bruteloss - oxyloss - toxloss - fireloss - cloneloss - brainloss - halloss - hallucination - hallucinations(list) *Note: I believe this variable is not needed, but the code it is used in (the resist verb) is cluttered and messy. That chunk of code probably use a re-write. I'll put it on my TODO list and if I survive mob_defines I'll try to get around to it but if anyone wants to do it for me, that would certainly help! ----------------------- Mob procs moved to living: - getBruteLoss() - adjustBruteLoss() - getOxyLoss() - adjustOxyLoss() - setOxyLoss() - getToxLoss() - adjustToxLoss() - setToxLoss() - getFireLoss() - adjustFireLoss() - getCloneLoss() - adjustCloneLoss() - setCloneLoss() - getHalLoss() - adjustHalLoss() - setHalLoss() - getBrainLoss() - adjustBrainLoss() - setBrainLoss Mob procs moved to carbon: getDNA() setDNA() ----------------------- Mob verbs moved to carbon: - Sleep - Lay down / Get up ----------------------- The : operator... The thing that has been killing me through this whole cleanup is people using or copy/pasting the : operator everywhere. *** Please use obj.var_or_procname. Do not use obj:var_or_procname *** Using obj:procname will not throw a compiler error if obj does not have that specific var or proc. This means that the coder making changes will NOT be informed of an error which will result in a proc failing, potentially being completely unusable and definatly causing a runtime error. With that said, I fully anticipate that most bugs (if any) caused by this mob define cleanup to be the result of : operators. I've been replacing many : operators in favour of the . operator as I've been going, most noteably I went out of my way to remove almost every : operator from the 4000+ line Chemistry-Regents.dm Exceptions: - Water: Turf and Atmos related vars. I'm not familiar with the members and methods in those class' hierarchy. - Silicate: because it's commented out and I honestly dont see it returning. - Thermite: Turf and Atmos related vars. - Corn Oil: Turf and Atmos related vars. Final note: While this may be the source of some mob-related bugs, there are two other revisions that have been committed between now and the last time either of the the two tgstation servers have been updated. These revisions both touch mob-related files. I'm not blaming these other revisions for anything, especially since one of them is mine anyway, I'm just listing them here for refrence to help quickly identify any problems. - My human/life() changes in r3925 - Carn's life() standardizations in r3933 Stuff unrelated to mob defines: - Fixed borgs and such being able to go into DNA modifiers. - Changelog updated and I added Sieve to the list of coders. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3934 316c924e-a436-60f5-8080-3fe189b3f50e
692 lines
20 KiB
Plaintext
692 lines
20 KiB
Plaintext
/obj/screen
|
|
name = "screen"
|
|
icon = 'screen1.dmi'
|
|
layer = 20.0
|
|
unacidable = 1
|
|
var/id = 0.0
|
|
var/obj/master
|
|
|
|
/obj/screen/close
|
|
name = "close"
|
|
master = null
|
|
|
|
/obj/screen/close/DblClick()
|
|
if (src.master)
|
|
src.master:close(usr)
|
|
return
|
|
|
|
/obj/screen/grab
|
|
name = "grab"
|
|
master = null
|
|
|
|
/obj/screen/storage
|
|
name = "storage"
|
|
master = null
|
|
|
|
/obj/screen/storage/attackby(W, mob/user as mob)
|
|
src.master.attackby(W, user)
|
|
return
|
|
|
|
/obj/screen/zone_sel
|
|
name = "Damage Zone"
|
|
icon = 'zone_sel.dmi'
|
|
icon_state = "blank"
|
|
var/selecting = "chest"
|
|
screen_loc = ui_zonesel
|
|
|
|
|
|
/obj/screen/zone_sel/MouseDown(location, control,params)
|
|
// Changes because of 4.0
|
|
var/list/PL = params2list(params)
|
|
var/icon_x = text2num(PL["icon-x"])
|
|
var/icon_y = text2num(PL["icon-y"])
|
|
|
|
if (icon_y < 2)
|
|
return
|
|
else if (icon_y < 5)
|
|
if ((icon_x > 9 && icon_x < 23))
|
|
if (icon_x < 16)
|
|
selecting = "r_foot"
|
|
else
|
|
selecting = "l_foot"
|
|
else if (icon_y < 11)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
if (icon_x < 16)
|
|
selecting = "r_leg"
|
|
else
|
|
selecting = "l_leg"
|
|
else if (icon_y < 12)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
if (icon_x < 14)
|
|
selecting = "r_leg"
|
|
else if (icon_x < 19)
|
|
selecting = "groin"
|
|
else
|
|
selecting = "l_leg"
|
|
else
|
|
return
|
|
else if (icon_y < 13)
|
|
if ((icon_x > 7 && icon_x < 25))
|
|
if (icon_x < 12)
|
|
selecting = "r_hand"
|
|
else if (icon_x < 13)
|
|
selecting = "r_leg"
|
|
else if (icon_x < 20)
|
|
selecting = "groin"
|
|
else if (icon_x < 21)
|
|
selecting = "l_leg"
|
|
else
|
|
selecting = "l_hand"
|
|
else
|
|
return
|
|
else if (icon_y < 14)
|
|
if ((icon_x > 7 && icon_x < 25))
|
|
if (icon_x < 12)
|
|
selecting = "r_hand"
|
|
else if (icon_x < 21)
|
|
selecting = "groin"
|
|
else
|
|
selecting = "l_hand"
|
|
else
|
|
return
|
|
else if (icon_y < 16)
|
|
if ((icon_x > 7 && icon_x < 25))
|
|
if (icon_x < 13)
|
|
selecting = "r_hand"
|
|
else if (icon_x < 20)
|
|
selecting = "chest"
|
|
else
|
|
selecting = "l_hand"
|
|
else
|
|
return
|
|
else if (icon_y < 23)
|
|
if ((icon_x > 7 && icon_x < 25))
|
|
if (icon_x < 12)
|
|
selecting = "r_arm"
|
|
else if (icon_x < 21)
|
|
selecting = "chest"
|
|
else
|
|
selecting = "l_arm"
|
|
else
|
|
return
|
|
else if (icon_y < 24)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
selecting = "chest"
|
|
else
|
|
return
|
|
else if (icon_y < 25)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
if (icon_x < 16)
|
|
selecting = "head"
|
|
else if (icon_x < 17)
|
|
selecting = "mouth"
|
|
else
|
|
selecting = "head"
|
|
else
|
|
return
|
|
else if (icon_y < 26)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
if (icon_x < 15)
|
|
selecting = "head"
|
|
else if (icon_x < 18)
|
|
selecting = "mouth"
|
|
else
|
|
selecting = "head"
|
|
else
|
|
return
|
|
else if (icon_y < 27)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
if (icon_x < 15)
|
|
selecting = "head"
|
|
else if (icon_x < 16)
|
|
selecting = "eyes"
|
|
else if (icon_x < 17)
|
|
selecting = "mouth"
|
|
else if (icon_x < 18)
|
|
selecting = "eyes"
|
|
else
|
|
selecting = "head"
|
|
else
|
|
return
|
|
else if (icon_y < 28)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
if (icon_x < 14)
|
|
selecting = "head"
|
|
else if (icon_x < 19)
|
|
selecting = "eyes"
|
|
else
|
|
selecting = "head"
|
|
else
|
|
return
|
|
else if (icon_y < 29)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
if (icon_x < 15)
|
|
selecting = "head"
|
|
else if (icon_x < 16)
|
|
selecting = "eyes"
|
|
else if (icon_x < 17)
|
|
selecting = "head"
|
|
else if (icon_x < 18)
|
|
selecting = "eyes"
|
|
else
|
|
selecting = "head"
|
|
else
|
|
return
|
|
else if (icon_y < 31)
|
|
if ((icon_x > 11 && icon_x < 21))
|
|
selecting = "head"
|
|
else
|
|
return
|
|
else
|
|
return
|
|
|
|
overlays = null
|
|
overlays += image("icon" = 'zone_sel.dmi', "icon_state" = text("[]", selecting))
|
|
|
|
return
|
|
|
|
/obj/screen/grab/Click()
|
|
master:s_click(src)
|
|
return
|
|
|
|
/obj/screen/grab/DblClick()
|
|
master:s_dbclick(src)
|
|
return
|
|
|
|
/obj/screen/grab/attack_hand()
|
|
return
|
|
|
|
/obj/screen/grab/attackby()
|
|
return
|
|
|
|
/obj/screen/MouseEntered(object,location,control,params)
|
|
if(!ishuman(usr) && !istype(usr,/mob/living/carbon/alien/humanoid) && !islarva(usr) && !ismonkey(usr))
|
|
return
|
|
switch(name)
|
|
/*
|
|
if("other")
|
|
if (usr.hud_used.inventory_shown)
|
|
usr.hud_used.inventory_shown = 0
|
|
usr.client.screen -= usr.hud_used.other
|
|
else
|
|
usr.hud_used.inventory_shown = 1
|
|
usr.client.screen += usr.hud_used.other
|
|
|
|
usr.hud_used.hidden_inventory_update()*/
|
|
if("act_intent")
|
|
if(ishuman(usr) || istype(usr,/mob/living/carbon/alien/humanoid) || islarva(usr))
|
|
usr.hud_used.action_intent.icon_state = "intent_[usr.a_intent]"
|
|
|
|
/obj/screen/MouseExited(object,location,control,params)
|
|
if(!ishuman(usr) && !istype(usr,/mob/living/carbon/alien/humanoid) && !islarva(usr) && !ismonkey(usr))
|
|
return
|
|
switch(name)
|
|
if("act_intent")
|
|
if(ishuman(usr) || istype(usr,/mob/living/carbon/alien/humanoid) || islarva(usr))
|
|
var/intent = usr.a_intent
|
|
if(intent == "hurt")
|
|
intent = "harm" //hurt and harm have different sprite names for some reason.
|
|
usr.hud_used.action_intent.icon_state = "[intent]"
|
|
|
|
/obj/screen/Click(location, control, params)
|
|
switch(name)
|
|
if("map")
|
|
usr.clearmap()
|
|
|
|
if("other")
|
|
if (usr.hud_used.inventory_shown)
|
|
usr.hud_used.inventory_shown = 0
|
|
usr.client.screen -= usr.hud_used.other
|
|
else
|
|
usr.hud_used.inventory_shown = 1
|
|
usr.client.screen += usr.hud_used.other
|
|
|
|
usr.hud_used.hidden_inventory_update()
|
|
|
|
if("equip")
|
|
var/obj/item/I = usr.get_active_hand()
|
|
if(!I)
|
|
usr << "\blue You are not holding anything to equip."
|
|
return
|
|
if(ishuman(usr))
|
|
var/mob/living/carbon/human/H = usr
|
|
H.equip_to_appropriate_slot(I)
|
|
|
|
if("resist")
|
|
if(isliving(usr))
|
|
var/mob/living/L = usr
|
|
L.resist()
|
|
|
|
if("maprefresh")
|
|
var/obj/machinery/computer/security/seccomp = usr.machine
|
|
|
|
if(seccomp!=null)
|
|
seccomp.drawmap(usr)
|
|
else
|
|
usr.clearmap()
|
|
|
|
if("arrowleft")
|
|
switch(usr.a_intent)
|
|
if("help")
|
|
if(issilicon(usr))
|
|
usr.a_intent = "hurt"
|
|
usr.hud_used.action_intent.icon_state = "harm"
|
|
else
|
|
usr.a_intent = "grab"
|
|
usr.hud_used.action_intent.icon_state = "grab"
|
|
|
|
if("disarm")
|
|
usr.a_intent = "help"
|
|
usr.hud_used.action_intent.icon_state = "help"
|
|
|
|
if("hurt")
|
|
if(issilicon(usr))
|
|
usr.a_intent = "help"
|
|
usr.hud_used.action_intent.icon_state = "help"
|
|
else
|
|
usr.a_intent = "disarm"
|
|
usr.hud_used.action_intent.icon_state = "disarm"
|
|
|
|
if("grab")
|
|
usr.a_intent = "hurt"
|
|
usr.hud_used.action_intent.icon_state = "harm"
|
|
|
|
if("arrowright")
|
|
switch(usr.a_intent)
|
|
if("help")
|
|
if(issilicon(usr))
|
|
usr.a_intent = "hurt"
|
|
usr.hud_used.action_intent.icon_state = "harm"
|
|
else
|
|
usr.a_intent = "disarm"
|
|
usr.hud_used.action_intent.icon_state = "disarm"
|
|
|
|
if("disarm")
|
|
usr.a_intent = "hurt"
|
|
usr.hud_used.action_intent.icon_state = "harm"
|
|
|
|
if("hurt")
|
|
if(issilicon(usr))
|
|
usr.a_intent = "help"
|
|
usr.hud_used.action_intent.icon_state = "help"
|
|
else
|
|
usr.a_intent = "grab"
|
|
usr.hud_used.action_intent.icon_state = "grab"
|
|
|
|
if("grab")
|
|
usr.a_intent = "help"
|
|
usr.hud_used.action_intent.icon_state = "help"
|
|
|
|
if("mov_intent")
|
|
switch(usr.m_intent)
|
|
if("run")
|
|
usr.m_intent = "walk"
|
|
usr.hud_used.move_intent.icon_state = "walking"
|
|
if("walk")
|
|
usr.m_intent = "run"
|
|
usr.hud_used.move_intent.icon_state = "running"
|
|
if(istype(usr,/mob/living/carbon/alien/humanoid)) usr.update_icons()
|
|
if("m_intent")
|
|
if (!( usr.m_int ))
|
|
switch(usr.m_intent)
|
|
if("run")
|
|
usr.m_int = "13,14"
|
|
if("walk")
|
|
usr.m_int = "14,14"
|
|
if("face")
|
|
usr.m_int = "15,14"
|
|
else
|
|
usr.m_int = null
|
|
if("walk")
|
|
usr.m_intent = "walk"
|
|
usr.m_int = "14,14"
|
|
if("face")
|
|
usr.m_intent = "face"
|
|
usr.m_int = "15,14"
|
|
if("run")
|
|
usr.m_intent = "run"
|
|
usr.m_int = "13,14"
|
|
if("Reset Machine")
|
|
usr.machine = null
|
|
if("internal")
|
|
if ((!( usr.stat ) && usr.canmove && !( usr.restrained() )))
|
|
if (usr.internal)
|
|
usr.internal = null
|
|
usr << "\blue No longer running on internals."
|
|
if (usr.internals)
|
|
usr.internals.icon_state = "internal0"
|
|
else
|
|
if(ishuman(usr))
|
|
if (!( istype(usr.wear_mask, /obj/item/clothing/mask) ))
|
|
usr << "\red You are not wearing a mask"
|
|
return
|
|
else
|
|
if (ishuman(usr) && istype(usr:s_store, /obj/item/weapon/tank))
|
|
usr << "\blue You are now running on internals from the [usr:s_store] on your [usr:wear_suit]."
|
|
usr.internal = usr:s_store
|
|
else if (ishuman(usr) && istype(usr:belt, /obj/item/weapon/tank))
|
|
usr << "\blue You are now running on internals from the [usr:belt] on your belt."
|
|
usr.internal = usr:belt
|
|
else if (istype(usr:l_store, /obj/item/weapon/tank))
|
|
usr << "\blue You are now running on internals from the [usr:l_store] in your left pocket."
|
|
usr.internal = usr:l_store
|
|
else if (istype(usr:r_store, /obj/item/weapon/tank))
|
|
usr << "\blue You are now running on internals from the [usr:r_store] in your right pocket."
|
|
usr.internal = usr:r_store
|
|
else if (istype(usr.back, /obj/item/weapon/tank))
|
|
usr << "\blue You are now running on internals from the [usr.back] on your back."
|
|
usr.internal = usr.back
|
|
else if (istype(usr.l_hand, /obj/item/weapon/tank))
|
|
usr << "\blue You are now running on internals from the [usr.l_hand] on your left hand."
|
|
usr.internal = usr.l_hand
|
|
else if (istype(usr.r_hand, /obj/item/weapon/tank))
|
|
usr << "\blue You are now running on internals from the [usr.r_hand] on your right hand."
|
|
usr.internal = usr.r_hand
|
|
if (usr.internal)
|
|
//for(var/mob/M in viewers(usr, 1))
|
|
// M.show_message(text("[] is now running on internals.", usr), 1)
|
|
if (usr.internals)
|
|
usr.internals.icon_state = "internal1"
|
|
else
|
|
usr << "\blue You don't have an oxygen tank."
|
|
if("act_intent")
|
|
if(ishuman(usr) || istype(usr,/mob/living/carbon/alien/humanoid) || islarva(usr))
|
|
switch(usr.a_intent)
|
|
if("help")
|
|
usr.a_intent = "disarm"
|
|
usr.hud_used.action_intent.icon_state = "intent_disarm"
|
|
if("disarm")
|
|
usr.a_intent = "grab"
|
|
usr.hud_used.action_intent.icon_state = "intent_grab"
|
|
if("grab")
|
|
usr.a_intent = "hurt"
|
|
usr.hud_used.action_intent.icon_state = "intent_hurt"
|
|
if("hurt")
|
|
usr.a_intent = "help"
|
|
usr.hud_used.action_intent.icon_state = "intent_help"
|
|
/*if (usr.hud_used.show_intent_icons)
|
|
usr.hud_used.show_intent_icons = 0
|
|
usr.client.screen -= usr.hud_used.intent_small_hud_objects
|
|
else
|
|
usr.hud_used.show_intent_icons = 1
|
|
usr.client.screen += usr.hud_used.intent_small_hud_objects*/ //Small intent icons
|
|
if(issilicon(usr))
|
|
if(usr.a_intent == "help")
|
|
usr.a_intent = "hurt"
|
|
usr.hud_used.action_intent.icon_state = "harm"
|
|
else
|
|
usr.a_intent = "help"
|
|
usr.hud_used.action_intent.icon_state = "help"
|
|
if("help")
|
|
usr.a_intent = "help"
|
|
usr.hud_used.action_intent.icon_state = "help"
|
|
usr.hud_used.show_intent_icons = 0
|
|
if("harm")
|
|
usr.a_intent = "hurt"
|
|
usr.hud_used.action_intent.icon_state = "harm"
|
|
usr.hud_used.show_intent_icons = 0
|
|
if("grab")
|
|
usr.a_intent = "grab"
|
|
usr.hud_used.action_intent.icon_state = "grab"
|
|
usr.hud_used.show_intent_icons = 0
|
|
if("disarm")
|
|
usr.a_intent = "disarm"
|
|
usr.hud_used.action_intent.icon_state = "disarm"
|
|
usr.hud_used.show_intent_icons = 0
|
|
if("pull")
|
|
usr.pulling = null
|
|
if("throw")
|
|
if (!usr.stat && isturf(usr.loc) && !usr.restrained())
|
|
usr:toggle_throw_mode()
|
|
if("drop")
|
|
usr.drop_item_v()
|
|
if("swap")
|
|
usr:swap_hand()
|
|
if("hand")
|
|
usr:swap_hand()
|
|
if("r_hand")
|
|
if(iscarbon(usr))
|
|
var/mob/living/carbon/C = usr
|
|
C.activate_hand("r")
|
|
if("l_hand")
|
|
if(iscarbon(usr))
|
|
var/mob/living/carbon/C = usr
|
|
C.activate_hand("l")
|
|
if("module")
|
|
if(issilicon(usr))
|
|
if(usr:module)
|
|
return
|
|
usr:pick_module()
|
|
|
|
if("radio")
|
|
if(issilicon(usr))
|
|
usr:radio_menu()
|
|
if("panel")
|
|
if(issilicon(usr))
|
|
usr:installed_modules()
|
|
|
|
if("store")
|
|
if(issilicon(usr))
|
|
usr:uneq_active()
|
|
|
|
if("module1")
|
|
if(usr:module_state_1)
|
|
if(usr:module_active != usr:module_state_1)
|
|
usr:inv1.icon_state = "inv1 +a"
|
|
usr:inv2.icon_state = "inv2"
|
|
usr:inv3.icon_state = "inv3"
|
|
usr:module_active = usr:module_state_1
|
|
else
|
|
usr:inv1.icon_state = "inv1"
|
|
usr:module_active = null
|
|
|
|
if("module2")
|
|
if(usr:module_state_2)
|
|
if(usr:module_active != usr:module_state_2)
|
|
usr:inv1.icon_state = "inv1"
|
|
usr:inv2.icon_state = "inv2 +a"
|
|
usr:inv3.icon_state = "inv3"
|
|
usr:module_active = usr:module_state_2
|
|
else
|
|
usr:inv2.icon_state = "inv2"
|
|
usr:module_active = null
|
|
|
|
if("module3")
|
|
if(usr:module_state_3)
|
|
if(usr:module_active != usr:module_state_3)
|
|
usr:inv1.icon_state = "inv1"
|
|
usr:inv2.icon_state = "inv2"
|
|
usr:inv3.icon_state = "inv3 +a"
|
|
usr:module_active = usr:module_state_3
|
|
else
|
|
usr:inv3.icon_state = "inv3"
|
|
usr:module_active = null
|
|
|
|
if("radar")
|
|
usr:close_radar()
|
|
|
|
if("radar closed")
|
|
usr:start_radar()
|
|
|
|
else
|
|
DblClick()
|
|
return
|
|
|
|
/obj/screen/attack_hand(mob/user as mob, using)
|
|
user.db_click(name, using)
|
|
return
|
|
|
|
/obj/screen/attack_paw(mob/user as mob, using)
|
|
user.db_click(name, using)
|
|
return
|
|
|
|
|
|
/mob/living/carbon/verb/mob_sleep()
|
|
set name = "Sleep"
|
|
set category = "IC"
|
|
|
|
if(usr.sleeping)
|
|
usr << "\red You are already sleeping"
|
|
return
|
|
else
|
|
usr.sleeping = 20 //Short nap
|
|
|
|
/mob/living/carbon/verb/lay_down()
|
|
set name = "Lay down / Get up"
|
|
set category = "IC"
|
|
|
|
usr.resting = !( usr.resting )
|
|
usr << "\blue You are now [(usr.resting) ? "resting" : "getting up"]"
|
|
|
|
|
|
/mob/living/verb/resist()
|
|
set name = "Resist"
|
|
set category = "IC"
|
|
|
|
if(!isliving(usr) || usr.next_move > world.time)
|
|
return
|
|
usr.next_move = world.time + 20
|
|
|
|
var/mob/living/L = usr
|
|
|
|
//resisting grabs (as if it helps anyone...)
|
|
if ((!( L.stat ) && L.canmove && !( L.restrained() )))
|
|
var/resisting = 0
|
|
for(var/obj/O in L.requests)
|
|
del(O)
|
|
resisting++
|
|
for(var/obj/item/weapon/grab/G in usr.grabbed_by)
|
|
resisting++
|
|
if (G.state == 1)
|
|
del(G)
|
|
else
|
|
if (G.state == 2)
|
|
if (prob(25))
|
|
for(var/mob/O in viewers(L, null))
|
|
O.show_message(text("\red [] has broken free of []'s grip!", L, G.assailant), 1)
|
|
del(G)
|
|
else
|
|
if (G.state == 3)
|
|
if (prob(5))
|
|
for(var/mob/O in viewers(usr, null))
|
|
O.show_message(text("\red [] has broken free of []'s headlock!", L, G.assailant), 1)
|
|
del(G)
|
|
if(resisting)
|
|
for(var/mob/O in viewers(usr, null))
|
|
O.show_message(text("\red <B>[] resists!</B>", L), 1)
|
|
|
|
|
|
//unbuckling yourself
|
|
if( L.buckled && (L.last_special <= world.time) )
|
|
if( L.handcuffed )
|
|
L.next_move = world.time + 100
|
|
L.last_special = world.time + 100
|
|
L << "\red You attempt to unbuckle yourself. (This will take around 2 minutes and you need to stand still)"
|
|
for(var/mob/O in viewers(L))
|
|
O.show_message("\red <B>[usr] attempts to unbuckle themself!</B>", 1)
|
|
spawn(0)
|
|
if(do_after(usr, 1200))
|
|
if(!L.buckled)
|
|
return
|
|
for(var/mob/O in viewers(L))
|
|
O.show_message("\red <B>[usr] manages to unbuckle themself!</B>", 1)
|
|
L << "\blue You successfully unbuckle yourself."
|
|
L.buckled.manual_unbuckle(L)
|
|
else
|
|
L.buckled.manual_unbuckle(L)
|
|
|
|
//Breaking out of a locker?
|
|
else if( src.loc && (istype(src.loc, /obj/structure/closet)) )
|
|
var/obj/structure/closet/C = L.loc
|
|
if(C.opened)
|
|
return //Door's open... wait, why are you in it's contents then?
|
|
if(istype(L.loc, /obj/structure/closet/secure_closet))
|
|
var/obj/structure/closet/secure_closet/SC = L.loc
|
|
if(!SC.locked && !SC.welded)
|
|
return //It's a secure closet, but isn't locked. Easily escapable from, no need to 'resist'
|
|
else
|
|
if(!C.welded)
|
|
return //closed but not welded...
|
|
|
|
//okay, so the closet is either welded or locked... resist!!!
|
|
usr.next_move = world.time + 100
|
|
L.last_special = world.time + 100
|
|
L << "\red You lean on the back of \the [C] and start pushing the door open. (this will take about 2 minutes)"
|
|
for(var/mob/O in viewers(usr.loc))
|
|
O.show_message("\red <B>The [L.loc] begins to shake violently!</B>", 1)
|
|
spawn(0)
|
|
if(do_after(usr, 50))
|
|
if(!C || !L || L.loc != C || C.opened) //User, closet destroyed OR user no longer in closet OR closet opened
|
|
return
|
|
|
|
//Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'...
|
|
if(istype(L.loc, /obj/structure/closet/secure_closet))
|
|
var/obj/structure/closet/secure_closet/SC = L.loc
|
|
if(!SC.locked && !SC.welded)
|
|
return
|
|
else
|
|
if(!C.welded)
|
|
return
|
|
|
|
//Well then break it!
|
|
if(istype(usr.loc, /obj/structure/closet/secure_closet))
|
|
var/obj/structure/closet/secure_closet/SC = L.loc
|
|
SC.desc = "It appears to be broken."
|
|
SC.icon_state = SC.icon_off
|
|
flick(SC.icon_broken, SC)
|
|
sleep(10)
|
|
flick(SC.icon_broken, SC)
|
|
sleep(10)
|
|
SC.broken = 1
|
|
SC.locked = 0
|
|
usr << "\red You successfully break out!"
|
|
for(var/mob/O in viewers(L.loc))
|
|
O.show_message("\red <B>\the [usr] successfully broke out of \the [SC]!</B>", 1)
|
|
SC.open()
|
|
else
|
|
C.welded = 0
|
|
usr << "\red You successfully break out!"
|
|
for(var/mob/O in viewers(L.loc))
|
|
O.show_message("\red <B>\the [usr] successfully broke out of \the [C]!</B>", 1)
|
|
C.open()
|
|
|
|
//breaking out of handcuffs
|
|
else if(iscarbon(L))
|
|
var/mob/living/carbon/CM = L
|
|
if(CM.handcuffed && CM.canmove && (CM.last_special <= world.time))
|
|
CM.next_move = world.time + 100
|
|
CM.last_special = world.time + 100
|
|
if(isalienadult(CM) || (HULK in usr.mutations) || (SUPRSTR in CM.augmentations))//Don't want to do a lot of logic gating here.
|
|
usr << "\green You attempt to break your handcuffs. (This will take around 5 seconds and you need to stand still)"
|
|
for(var/mob/O in viewers(CM))
|
|
O.show_message(text("\red <B>[] is trying to break the handcuffs!</B>", CM), 1)
|
|
spawn(0)
|
|
if(do_after(CM, 50))
|
|
if(!CM.handcuffed || CM.buckled)
|
|
return
|
|
for(var/mob/O in viewers(CM))
|
|
O.show_message(text("\red <B>[] manages to break the handcuffs!</B>", CM), 1)
|
|
CM << "\green You successfully break your handcuffs."
|
|
del(CM.handcuffed)
|
|
CM.handcuffed = null
|
|
CM.update_inv_handcuffed()
|
|
else
|
|
var/obj/item/weapon/handcuffs/HC = CM.handcuffed
|
|
var/breakouttime = 1200 //A default in case you are somehow handcuffed with something that isn't an obj/item/weapon/handcuffs type
|
|
var/displaytime = 2 //Minutes to display in the "this will take X minutes."
|
|
if(istype(HC)) //If you are handcuffed with actual handcuffs... Well what do I know, maybe someone will want to handcuff you with toilet paper in the future...
|
|
breakouttime = HC.breakouttime
|
|
displaytime = breakouttime / 600 //Minutes
|
|
CM << "\red You attempt to remove \the [HC]. (This will take around [displaytime] minutes and you need to stand still)"
|
|
for(var/mob/O in viewers(CM))
|
|
O.show_message( "\red <B>[usr] attempts to remove \the [HC]!</B>", 1)
|
|
spawn(0)
|
|
if(do_after(CM, breakouttime))
|
|
if(!CM.handcuffed || CM.buckled)
|
|
return // time leniency for lag which also might make this whole thing pointless but the server
|
|
for(var/mob/O in viewers(CM))// lags so hard that 40s isn't lenient enough - Quarxink
|
|
O.show_message("\red <B>[CM] manages to remove the handcuffs!</B>", 1)
|
|
CM << "\blue You successfully remove \the [CM.handcuffed]."
|
|
CM.handcuffed.loc = usr.loc
|
|
CM.handcuffed = null
|
|
CM.update_inv_handcuffed() |