Sending a message should no longer work if you are incapacitated. Fixes issue 1120.

Moved some mob vars to carbon:
mob/var/handcuffed -> mob/living/carbon/var/handcuffed
mob/var/legcuffed -> mob/living/carbon/var/legcuffed

As a result, I've turned some procs into pure virtual procs and moved their code into carbon.dm.

mob/proc/restrained() -> mob/living/carbon/restrained()
mob/proc/can_use_hands() -> mob/living/carbon/can_use_hands()

The hand and legcuff portion of mob/proc/u_equip() was moved into mob/living/carbon/u_equip().

The handcuffed portion of mob/proc/show_inv() was moved into mob/living/carbon/show_inv().

Fixes issue 1114.

Made parrots immune to bear traps since parrots should be flying over them anyway.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5184 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
johnsonmt88@gmail.com
2012-11-25 00:28:47 +00:00
parent c6a4b991bc
commit 4ddf9100f5
14 changed files with 132 additions and 84 deletions
+4 -4
View File
@@ -739,16 +739,16 @@
var/mob/living/carbon/H = AM
if(H.m_intent == "run")
armed = 0
usr.legcuffed = src
src.loc = usr
usr.update_inv_legcuffed()
H.legcuffed = src
src.loc = H
H.update_inv_legcuffed()
H << "\red <B>You step on \the [src]!</B>"
feedback_add_details("handcuffs","B") //Yes, I know they're legcuffs. Don't change this, no need for an extra variable. The "B" is used to tell them apart.
for(var/mob/O in viewers(H, null))
if(O == H)
continue
O.show_message("\red <B>[H] steps on \the [src].</B>", 1)
if(isanimal(AM))
if(isanimal(AM) && !istype(AM, /mob/living/simple_animal/parrot))
armed = 0
var/mob/living/simple_animal/SA = AM
SA.health = 0
+2 -2
View File
@@ -755,7 +755,7 @@ var/list/sacrificed = list()
if(iscultist(C) && !C.stat)
users+=C
if(users.len>=3)
var/mob/cultist = input("Choose the one who you want to free", "Followers of Geometer") as null|anything in (cultists - users)
var/mob/living/carbon/cultist = input("Choose the one who you want to free", "Followers of Geometer") as null|anything in (cultists - users)
if(!cultist)
return fizzle()
if (cultist == user) //just to be sure.
@@ -805,7 +805,7 @@ var/list/sacrificed = list()
if(iscultist(C) && !C.stat)
users+=C
if(users.len>=3)
var/mob/cultist = input("Choose the one who you want to summon", "Followers of Geometer") as null|anything in (cultists - user)
var/mob/living/carbon/cultist = input("Choose the one who you want to summon", "Followers of Geometer") as null|anything in (cultists - user)
if(!cultist)
return fizzle()
if (cultist == user) //just to be sure.
@@ -703,6 +703,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (last_text && world.time < last_text + 5)
return
if(!can_use())
return
last_text = world.time
// check if telecomms I/O route 1459 is stable
//var/telecomms_intact = telecomms_process(P.owner, owner, t)
+23 -23
View File
@@ -1,22 +1,22 @@
/obj/item/weapon/handcuffs/attack(mob/M as mob, mob/user as mob)
/obj/item/weapon/handcuffs/attack(mob/living/carbon/C as mob, mob/user as mob)
if(istype(src, /obj/item/weapon/handcuffs/cyborg) && isrobot(user))
if(!M.handcuffed)
if(!C.handcuffed)
var/turf/p_loc = user.loc
var/turf/p_loc_m = M.loc
var/turf/p_loc_m = C.loc
playsound(src.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -2)
for(var/mob/O in viewers(user, null))
O.show_message("\red <B>[user] is trying to put handcuffs on [M]!</B>", 1)
O.show_message("\red <B>[user] is trying to put handcuffs on [C]!</B>", 1)
spawn(30)
if(!M) return
if(p_loc == user.loc && p_loc_m == M.loc)
M.handcuffed = new /obj/item/weapon/handcuffs(M)
M.update_inv_handcuffed()
if(!C) return
if(p_loc == user.loc && p_loc_m == C.loc)
C.handcuffed = new /obj/item/weapon/handcuffs(C)
C.update_inv_handcuffed()
else
if ((CLUMSY in usr.mutations) && prob(50))
usr << "\red Uh ... how do those things work?!"
if (istype(M, /mob/living/carbon/human))
if(!M.handcuffed)
if (istype(C, /mob/living/carbon/human))
if(!C.handcuffed)
var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( )
O.source = user
O.target = user
@@ -24,7 +24,7 @@
O.s_loc = user.loc
O.t_loc = user.loc
O.place = "handcuff"
M.requests += O
C.requests += O
spawn( 0 )
O.process()
return
@@ -32,21 +32,21 @@
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
usr << "\red You don't have the dexterity to do this!"
return
if (istype(M, /mob/living/carbon/human))
if(!M.handcuffed)
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been handcuffed (attempt) by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to handcuff [M.name] ([M.ckey])</font>")
if (istype(C, /mob/living/carbon/human))
if(!C.handcuffed)
C.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been handcuffed (attempt) by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to handcuff [C.name] ([C.ckey])</font>")
log_attack("<font color='red'>[user.name] ([user.ckey]) Attempted to handcuff [M.name] ([M.ckey])</font>")
log_attack("<font color='red'>[user.name] ([user.ckey]) Attempted to handcuff [C.name] ([C.ckey])</font>")
var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( )
O.source = user
O.target = M
O.target = C
O.item = user.get_active_hand()
O.s_loc = user.loc
O.t_loc = M.loc
O.t_loc = C.loc
O.place = "handcuff"
M.requests += O
C.requests += O
spawn( 0 )
if(istype(src, /obj/item/weapon/handcuffs/cable))
feedback_add_details("handcuffs","C")
@@ -57,15 +57,15 @@
O.process()
return
else
if(!M.handcuffed)
if(!C.handcuffed)
var/obj/effect/equip_e/monkey/O = new /obj/effect/equip_e/monkey( )
O.source = user
O.target = M
O.target = C
O.item = user.get_active_hand()
O.s_loc = user.loc
O.t_loc = M.loc
O.t_loc = C.loc
O.place = "handcuff"
M.requests += O
C.requests += O
spawn( 0 )
if(istype(src, /obj/item/weapon/handcuffs/cable))
playsound(src.loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2)
@@ -15,7 +15,7 @@
return
trigger(emote, mob/source as mob)
trigger(emote, mob/living/carbon/source as mob)
if (src.uses < 1) return 0
if (emote == src.activation_emote)
src.uses--
@@ -45,7 +45,7 @@
return
implanted(mob/source)
implanted(mob/living/carbon/source)
source.mind.store_memory("Freedom implant can be activated by using the [src.activation_emote] emote, <B>say *[src.activation_emote]</B> to attempt to activate.", 0, 0)
source << "The implanted freedom implant can be activated by using the [src.activation_emote] emote, <B>say *[src.activation_emote]</B> to attempt to activate."
return 1
+6 -6
View File
@@ -90,13 +90,13 @@
icon_state = "cutters-y"
item_state = "cutters_yellow"
/obj/item/weapon/wirecutters/attack(mob/M as mob, mob/user as mob)
if((M.handcuffed) && (istype(M:handcuffed, /obj/item/weapon/handcuffs/cable)))
usr.visible_message("\The [usr] cuts \the [M]'s restraints with \the [src]!",\
"You cut \the [M]'s restraints with \the [src]!",\
/obj/item/weapon/wirecutters/attack(mob/living/carbon/C as mob, mob/user as mob)
if((C.handcuffed) && (istype(C.handcuffed, /obj/item/weapon/handcuffs/cable)))
usr.visible_message("\The [usr] cuts \the [C]'s restraints with \the [src]!",\
"You cut \the [C]'s restraints with \the [src]!",\
"You hear cable being cut.")
M.handcuffed = null
M.update_inv_handcuffed()
C.handcuffed = null
C.update_inv_handcuffed()
return
else
..()
@@ -56,8 +56,13 @@
if(ismob(user))
var/mob/M = user
if(world.time - user.last_bumped <= 60) return //NOTE do we really need that?
if(M.client && !M:handcuffed)
SwitchState()
if(M.client)
if(iscarbon(M))
var/mob/living/carbon/C = M
if(!C.handcuffed)
SwitchState()
else
SwitchState()
else if(istype(user, /obj/mecha))
SwitchState()
-6
View File
@@ -157,12 +157,6 @@
else if (W == l_hand)
l_hand = null
update_inv_l_hand(0)
else if (W == handcuffed)
handcuffed = null
update_inv_handcuffed(0)
else if (W == legcuffed)
legcuffed = null
update_inv_legcuffed()
else if (W == back)
back = null
update_inv_back(0)
+47 -1
View File
@@ -437,4 +437,50 @@
/mob/living/carbon/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(exposed_temperature > CARBON_LIFEFORM_FIRE_RESISTANCE)
adjustFireLoss(CARBON_LIFEFORM_FIRE_DAMAGE)
..()
..()
/mob/living/carbon/can_use_hands()
if(handcuffed)
return 0
if(buckled && ! istype(buckled, /obj/structure/stool/bed/chair)) // buckling does not restrict hands
return 0
return 1
/mob/living/carbon/restrained()
if (handcuffed)
return 1
return
/mob/living/carbon/u_equip(obj/item/W as obj)
if(!W) return 0
else if (W == handcuffed)
handcuffed = null
update_inv_handcuffed()
else if (W == legcuffed)
legcuffed = null
update_inv_legcuffed()
else
..()
return
/mob/living/carbon/show_inv(mob/living/carbon/user as mob)
user.set_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
@@ -10,3 +10,6 @@
var/silent = null //Can't talk. Value goes down every life proc.
var/last_eating = 0 //Not sure what this does... I found it hidden in food.dm
var/obj/item/handcuffed = null //Whether or not the mob is handcuffed
var/obj/item/legcuffed = null //Same as handcuffs but for legs. Bear traps use this.
+3 -1
View File
@@ -262,7 +262,9 @@
ear_damage = 0
heal_overall_damage(1000, 1000)
buckled = initial(src.buckled)
handcuffed = initial(src.handcuffed)
if(iscarbon(src))
var/mob/living/carbon/C = src
C.handcuffed = initial(C.handcuffed)
for(var/datum/disease/D in viruses)
D.cure(0)
if(stat == 2)
+1 -8
View File
@@ -129,8 +129,6 @@
/mob/proc/restrained()
if (handcuffed)
return 1
return
//This proc is called whenever someone clicks an inventory ui slot.
@@ -227,7 +225,6 @@ var/list/slot_equipment_priority = list( \
<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>
@@ -537,11 +534,7 @@ var/list/slot_equipment_priority = list( \
/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 ..()
return
/mob/proc/is_active()
return (0 >= usr.stat)
-2
View File
@@ -103,8 +103,6 @@
var/lastDblClick = 0
var/lastKnownIP = null
var/obj/structure/stool/bed/buckled = null//Living
var/obj/item/handcuffed = null//Living
var/obj/item/legcuffed = null//Living
var/obj/item/l_hand = null//Living
var/obj/item/r_hand = null//Living
var/obj/item/weapon/back = null//Human/Monkey
+31 -27
View File
@@ -283,19 +283,21 @@
usr.clearmap()
if("mov_intent")
if(usr.legcuffed)
usr << "\red You are legcuffed! You cannot run until you get your cuffs removed!"
usr.m_intent = "walk" //Just incase
usr.hud_used.move_intent.icon_state = "walking"
return
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(iscarbon(usr))
var/mob/living/carbon/C = usr
if(C.legcuffed)
C << "\red You are legcuffed! You cannot run until you get your cuffs removed!"
C.m_intent = "walk" //Just incase
C.hud_used.move_intent.icon_state = "walking"
return
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)
@@ -539,20 +541,22 @@
//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)
if(iscarbon(L))
var/mob/living/carbon/C = L
if( C.handcuffed )
C.next_move = world.time + 100
C.last_special = world.time + 100
C << "\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(!C.buckled)
return
for(var/mob/O in viewers(C))
O.show_message("\red <B>[usr] manages to unbuckle themself!</B>", 1)
C << "\blue You successfully unbuckle yourself."
C.buckled.manual_unbuckle(C)
else
L.buckled.manual_unbuckle(L)