ugh...this was horrible. I'm really sorry if I fucked anything up, I was literally going braindead towards the end.

Replaced every l_hand = and r_hand = and all that if(hand) crap to use standardised procs. This means we can use procs like Dropped() reliably as they will always be called when things are dropped.

Thorough documentation to come. But generally, if you want a mob's icons to update after deleting something in the inventory...use drop_from_inventory(the_thing_you_wanna_drop) just before deleting it. If you wanna put something in a mob's hands use put_in_hands() (or one of the variants). It'll try putting it in active hand first, then inactive, then the floor. They handle layers, overlays, screenlocs calling various procs such as dropped() etc for you. Easy

mob.equipped() is now mob.get_active_hand() because there was another totally unrelated proc named equipped() and stuff was confusing.

Weakening was made instantaneous.

Minor optimisations for human/handle_regular_status_updates(). I'll port these changes over to the other mobs next. Basically it should stop it constantly incrementing every status effect even after death.

umm... bunch of overlays related fixes... I think that's everything. :/

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3900 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-06-23 21:24:45 +00:00
parent ce21bded5f
commit 48088b79d9
136 changed files with 972 additions and 1522 deletions
+131 -95
View File
@@ -1,116 +1,152 @@
//These procs handle putting s tuff in your hand. It's probably best to use these rather than setting l_hand = ...etc
//as they handle all relevant stuff like adding it to the player's screen and updating their overlays.
//Returns the thing in our active hand
/mob/proc/get_active_hand()
if (hand)
return l_hand
else
return r_hand
if(hand) return l_hand
else return r_hand
//Returns the thing in our inactive hand
/mob/proc/get_inactive_hand()
if (!hand)
return l_hand
else
return r_hand
if(hand) return r_hand
else return l_hand
/mob/proc/put_in_hand(var/obj/item/I)
if(!I) return
I.loc = src
if (hand)
l_hand = I
//Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success.
/mob/proc/put_in_l_hand(var/obj/item/W)
if(!W) return 0
if(lying) return 0
if(!l_hand)
W.loc = src //TODO: move to equipped?
l_hand = W
W.layer = 20 //TODO: move to equipped?
// l_hand.screen_loc = ui_lhand
W.equipped(src,"l_hand")
if(client) client.screen |= W
update_inv_l_hand()
else
r_hand = I
update_inv_r_hand()
I.layer = 20
return 1
return 0
/mob/proc/put_in_hands(var/obj/item/I) //A suprisingly useful proc. Allows a simple way to place an object in a mob's hands, or, if they are full, on the ground below them.
//Puts the item into your r_hand if possible and calls all necessary triggers/updates. returns 1 on success.
/mob/proc/put_in_r_hand(var/obj/item/W)
if(!W) return 0
if(lying) return 0
if(!r_hand)
I.loc = src
r_hand = I
W.loc = src
r_hand = W
W.layer = 20
// r_hand.screen_loc = ui_rhand
W.equipped(src,"r_hand")
if(client) client.screen |= W
update_inv_r_hand()
I.layer = 20
else if(!l_hand)
I.loc = src
l_hand = I
update_inv_l_hand()
I.layer = 20
return 1
return 0
//Puts the item into our active hand if possible. returns 1 on success.
/mob/proc/put_in_active_hand(var/obj/item/W)
if(hand) return put_in_l_hand(W)
else return put_in_r_hand(W)
//Puts the item into our inactive hand if possible. returns 1 on success.
/mob/proc/put_in_inactive_hand(var/obj/item/W)
if(hand) return put_in_r_hand(W)
else return put_in_l_hand(W)
//Puts the item our active hand if possible. Failing that it tries our inactive hand. Returns 1 on success.
//If both fail it drops it on the floor and returns 0.
//This is probably the main one you need to know :)
/mob/proc/put_in_hands(var/obj/item/W)
if(!W) return 0
if(put_in_active_hand(W)) return 1
else if(put_in_inactive_hand(W)) return 1
else
I.loc = get_turf(src)
W.loc = get_turf(src)
return 0
/mob/proc/drop_item_v()
if (stat == 0)
drop_item()
return
/mob/proc/drop_from_slot(var/obj/item/item)
if(!item)
return
if(!(item in contents))
return
u_equip(item)
if (client)
client.screen -= item
if (item)
item.loc = loc
item.dropped(src)
if (item)
item.layer = initial(item.layer)
var/turf/T = get_turf(loc)
if (istype(T))
T.Entered(item)
return
/mob/proc/drop_item(var/atom/target)
var/obj/item/W = equipped()
/mob/proc/drop_item_v() //this is dumb.
if(stat == CONSCIOUS)
return drop_item()
return 0
if (W)
/mob/proc/drop_from_inventory(var/obj/item/W)
if(W)
if(client) client.screen -= W
u_equip(W)
update_icons()
if (client)
client.screen -= W
if (W)
W.layer = initial(W.layer)
if(target)
W.loc = target.loc
else
W.loc = loc
W.dropped(src)
var/turf/T = get_turf(loc)
if (istype(T))
T.Entered(W)
return
W.layer = initial(W.layer)
W.loc = loc
/mob/proc/before_take_item(var/obj/item/item)
item.loc = null
item.layer = initial(item.layer)
u_equip(item)
//if (client)
// client.screen -= item
var/turf/T = get_turf(loc)
if(isturf(T))
T.Entered(W)
W.dropped(src)
update_icons()
return 1
return 0
//Drops the item in our left hand
/mob/proc/drop_l_hand(var/atom/Target)
if(l_hand)
if(client) client.screen -= l_hand
l_hand.layer = initial(l_hand.layer)
if(Target) l_hand.loc = Target.loc
else l_hand.loc = loc
var/turf/T = get_turf(loc)
if(isturf(T))
T.Entered(l_hand)
l_hand.dropped(src)
l_hand = null
update_inv_l_hand()
return 1
return 0
//Drops the item in our right hand
/mob/proc/drop_r_hand(var/atom/Target)
if(r_hand)
if(client) client.screen -= r_hand
r_hand.layer = initial(r_hand.layer)
if(Target) r_hand.loc = Target.loc
else r_hand.loc = loc
var/turf/T = get_turf(Target)
if(istype(T))
T.Entered(r_hand)
r_hand.dropped(src)
r_hand = null
update_inv_r_hand()
return 1
return 0
//Drops the item in our active hand.
/mob/proc/drop_item(var/atom/Target)
if(hand) return drop_l_hand(Target)
else return drop_r_hand(Target)
//TODO: phase out this proc
/mob/proc/before_take_item(var/obj/item/W) //TODO: what is this?
W.loc = null
W.layer = initial(W.layer)
u_equip(W)
update_icons()
return
/mob/proc/put_in_inactive_hand(var/obj/item/I)
I.loc = src
if (!hand)
l_hand = I
update_inv_l_hand()
else
r_hand = I
update_inv_r_hand()
I.layer = 20
/mob/proc/equipped()
if(issilicon(src))
if(isrobot(src))
if(src:module_active)
return src:module_active
else
if (hand)
return l_hand
else
return r_hand
/mob/proc/u_equip(W as obj)
if (W == r_hand)
@@ -401,14 +401,10 @@
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
@@ -20,7 +20,7 @@
update_inv_l_hand(0)
/mob/living/carbon/alien/humanoid/db_click(text, t1)
var/obj/item/W = equipped()
var/obj/item/W = get_active_hand()
var/emptyHand = (W == null)
if ((!emptyHand) && (!istype(W, /obj/item)))
return
@@ -42,7 +42,7 @@
return
u_equip(W)
wear_suit = W
W.equipped(src, text)
W.get_active_hand(src, text)
*/
if("head")
if (head)
@@ -57,7 +57,7 @@
return
u_equip(W)
head = W
W.equipped(src, text)
W.get_active_hand(src, text)
*/
if("storage1")
if (l_store)
@@ -17,9 +17,7 @@
..()
if (src.stat != 2) //still breathing
if (src.stat != DEAD) //still breathing
//First, resolve location and get a breath
@@ -62,36 +60,25 @@
//Status updates, death etc.
handle_regular_status_updates()
//Being buckled to a chair or bed
check_if_buckled()
//Temporary, whilst I finish the regenerate_icons changes ~Carn
if( update_icon ) //forces a full overlay update
update_icon = 0
regenerate_icons()
else if( lying != lying_prev )
update_icons()
if(client)
handle_regular_hud_updates()
// Yup.
update_canmove()
clamp_values()
// Grabbing
for(var/obj/item/weapon/grab/G in src)
G.process()
if(client)
handle_regular_hud_updates()
clamp_values()
/mob/living/carbon/alien/humanoid
proc
clamp_values()
SetStunned(min(stunned, 20))
// SetStunned(min(stunned, 20))
SetParalysis(min(paralysis, 20))
SetWeakened(min(weakened, 20))
// SetWeakened(min(weakened, 20))
sleeping = max(min(sleeping, 20), 0)
adjustBruteLoss(0)
adjustToxLoss(0)
@@ -256,10 +243,6 @@
src.internals.icon_state = "internal0"
return null
update_canmove()
if(paralysis || stunned || weakened || buckled) canmove = 0
else canmove = 1
handle_breath(datum/gas_mixture/breath)
if(src.nodamage)
return
@@ -115,7 +115,7 @@
if(r_hand)
var/t_state = r_hand.item_state
if(!t_state) t_state = r_hand.icon_state
r_hand.screen_loc = ui_rhand
// r_hand.screen_loc = ui_rhand
overlays_standing[X_R_HAND_LAYER] = image("icon" = 'items_righthand.dmi', "icon_state" = t_state)
else
overlays_standing[X_R_HAND_LAYER] = null
@@ -125,7 +125,7 @@
if(l_hand)
var/t_state = l_hand.item_state
if(!t_state) t_state = l_hand.icon_state
l_hand.screen_loc = ui_lhand
// l_hand.screen_loc = ui_lhand
overlays_standing[X_L_HAND_LAYER] = image("icon" = 'items_lefthand.dmi', "icon_state" = t_state)
else
overlays_standing[X_L_HAND_LAYER] = null
@@ -368,14 +368,10 @@
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
@@ -58,32 +58,26 @@
//Status updates, death etc.
handle_regular_status_updates()
// Update clothing
// regenerate_icons()
if(client)
handle_regular_hud_updates()
//Being buckled to a chair or bed
check_if_buckled()
// Yup.
//Handles updating canmove.
update_canmove()
clamp_values()
// Grabbing
for(var/obj/item/weapon/grab/G in src)
G.process()
if(client)
handle_regular_hud_updates()
clamp_values()
/mob/living/carbon/alien/larva
proc
clamp_values()
SetStunned(min(stunned, 20))
// SetStunned(min(stunned, 20))
SetParalysis(min(paralysis, 20))
SetWeakened(min(weakened, 20))
// SetWeakened(min(weakened, 20))
sleeping = max(min(sleeping, 20), 0)
handle_mutations_and_radiation()
@@ -227,10 +221,6 @@
internals.icon_state = "internal0"
return null
update_canmove()
if(paralysis || stunned || weakened || buckled) canmove = 0
else canmove = 1
handle_breath(datum/gas_mixture/breath)
if(nodamage)
return
@@ -506,4 +496,4 @@
if(air_master.current_cycle%3==1)
if(!M.nodamage)
M.adjustBruteLoss(5)
nutrition += 10
nutrition += 10
+6 -10
View File
@@ -40,15 +40,13 @@
clamp_values()
proc
clamp_values()
AdjustParalysis(0)
AdjustStunned(0)
AdjustWeakened(0)
// AdjustStunned(0)
// AdjustWeakened(0)
adjustBruteLoss(0)
adjustFireLoss(0)
adjustOxyLoss(0)
@@ -89,12 +87,6 @@
emote("gasp")
updatehealth()
update_canmove()
if(in_contents_of(/obj/mecha))
canmove = 1
else
canmove = 0
return
handle_environment(datum/gas_mixture/environment)
if(!environment)
@@ -315,3 +307,7 @@
D.cure()
return
update_canmove()
if(in_contents_of(/obj/mecha)) canmove = 1
else canmove = 0
return canmove
+1 -1
View File
@@ -14,7 +14,7 @@
for(var/mob/M in hearers(4, src))
if(M.client)
M.show_message(text("\red You hear something rumbling inside [src]'s stomach..."), 2)
var/obj/item/I = user.equipped()
var/obj/item/I = user.get_active_hand()
if(I && I.force)
var/d = rand(round(I.force / 4), I.force)
if(istype(src, /mob/living/carbon/human))
@@ -622,7 +622,7 @@
var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( )
O.source = usr
O.target = src
O.item = usr.equipped()
O.item = usr.get_active_hand()
O.s_loc = usr.loc
O.t_loc = loc
O.place = href_list["item"]
@@ -692,7 +692,7 @@
if(full_body && ((src.l_hand && !( src.l_hand.abstract )) || (src.r_hand && !( src.r_hand.abstract )) || (src.back || src.wear_mask || src.head || src.shoes || src.w_uniform || src.wear_suit || src.glasses || src.ears || src.gloves)))
return 1
if((src.l_hand && !( src.l_hand.abstract )) || (src.r_hand && !( src.r_hand.abstract )))
if( (src.l_hand && !src.l_hand.abstract) || (src.r_hand && !src.r_hand.abstract) )
return 1
return 0
@@ -14,14 +14,10 @@
w_uniform.add_fingerprint(M)
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
LAssailant = M
@@ -87,14 +87,10 @@
if(w_uniform) w_uniform.add_fingerprint(M)
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab(M)
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
LAssailant = M
@@ -559,7 +559,7 @@ It can still be worn/put on as normal.
if(source.loc != s_loc) return
if(target.loc != t_loc) return
if(LinkBlocked(s_loc,t_loc)) return
if(item && source.equipped() != item) return
if(item && source.get_active_hand() != item) return
if ((source.restrained() || source.stat)) return
switch(place)
if("mask")
@@ -920,8 +920,8 @@ It can still be worn/put on as normal.
W.add_fingerprint(source)
else
if (istype(item, /obj/item/weapon/handcuffs))
target.drop_from_slot(target.r_hand)
target.drop_from_slot(target.l_hand)
target.drop_from_inventory(target.r_hand)
target.drop_from_inventory(target.l_hand)
source.drop_item()
target.handcuffed = item
item.loc = target
@@ -1012,7 +1012,7 @@ It can still be worn/put on as normal.
return
/mob/living/carbon/human/db_click(text, t1)
var/obj/item/W = equipped()
var/obj/item/W = get_active_hand()
var/emptyHand = (W == null)
if(emptyHand)
usr.next_move = usr.prev_move
+74 -105
View File
@@ -68,16 +68,7 @@
//Status updates, death etc.
UpdateLuminosity()
handle_regular_status_updates() //TODO: optimise ~Carn
//Being buckled to chairs/beds/etc
check_if_buckled()
//Temporary, whilst I finish the regenerate_icons changes ~Carn
if( update_icon ) //forces a full overlay update
update_icon = 0
regenerate_icons()
else if( lying != lying_prev )
update_icons()
update_canmove() //TODO: remove from life() if viable ~Carn (read as: if it won't cause massive problems)
//Update our name based on whether our face is obscured/disfigured
name = get_visible_name() //TODO: this was broken by the dismemberment revert ~Carn
@@ -85,10 +76,6 @@
if(client)
handle_regular_hud_updates()
update_canmove() //TODO: check ~Carn
clamp_values() //TODO: check that dmage procs aren't outputing bad values outside clamp ranges ~Carn
// Grabbing
for(var/obj/item/weapon/grab/G in src)
G.process()
@@ -99,6 +86,9 @@
if(!currentTurf.sd_lumcount)
playsound_local(src,pick(scarySounds),50, 1, -1)
clamp_values() //TODO: finish removing this ~Carn
/mob/living/carbon/human/calculate_affecting_pressure(var/pressure)
..()
var/pressure_difference = abs( pressure - ONE_ATMOSPHERE )
@@ -121,9 +111,9 @@
//This can probably be removed like Rockdtben suggested, but I'd like to go over the damage procs first just to be safe.
//Perhaps code view-vars to be unable to directly edit the damagevariables without using procs
proc/clamp_values()
stunned = max( min(stunned,20), 0 ) // positive and under 20
// stunned = max( min(stunned,20), 0 ) // positive and under 20
paralysis = max( min(paralysis,20), 0 ) // positive and under 20
weakened = max( min(weakened,20), 0 ) // positive and under 20
// weakened = max( min(weakened,20), 0 ) // positive and under 20
sleeping = max( min(sleeping, 20), 0 ) // positive and under 20
oxyloss = max(oxyloss,0) // positive
toxloss = max(toxloss,0) // positive
@@ -376,14 +366,6 @@
internals.icon_state = "internal0"
return null
proc/update_canmove()
if(stat || sleeping || paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath))
canmove = 0
else
lying = 0
canmove = 1
proc/handle_breath(datum/gas_mixture/breath)
if(nodamage || REBREATHER in augmentations)
@@ -754,100 +736,87 @@
return //TODO: DEFERRED
proc/handle_regular_status_updates()
// health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
if(getOxyLoss() > 50) Paralyse(3)
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
else if(health < config.health_threshold_crit)
if(health <= 20 && prob(1)) spawn(0) emote("gasp")
//if(!rejuv) oxyloss++
if(!reagents.has_reagent("inaprovaline")) adjustOxyLoss(1)
if(stat != DEAD) stat = UNCONSCIOUS
Paralyse(5)
if (stat != DEAD) //Alive.
if (silent)
silent--
if (resting || sleeping || paralysis || stunned || weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc.
if (stunned > 0)
AdjustStunned(-1)
stat = CONSCIOUS
if (weakened > 0)
AdjustWeakened(-1)
lying = 1
stat = CONSCIOUS
if (paralysis > 0)
AdjustParalysis(-1)
blinded = 1
lying = 1
stat = UNCONSCIOUS
if (sleeping > 0)
handle_dreams()
adjustHalLoss(-5)
blinded = 1
lying = 1
stat = UNCONSCIOUS
if (prob(10) && health && !hal_crit)
spawn(0)
emote("snore")
sleeping--
if(resting)
lying = 1
stat = CONSCIOUS
var/h = hand
hand = 0
drop_item()
hand = 1
drop_item()
hand = h
else //Not stunned.
lying = 0
stat = CONSCIOUS
else //Dead.
lying = 1
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
blinded = 1
stat = DEAD
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
blinded = 1
stat = DEAD
silent = 0
return 1
if (stuttering) stuttering--
stat = CONSCIOUS
if(getOxyLoss() > 50)
Paralyse(3)
if (eye_blind)
eye_blind--
blinded = 1
if(health < config.health_threshold_crit) //UNCONSCIOUS. NO-ONE IS HOME
if( health <= 20 && prob(1) )
spawn(0)
emote("gasp")
if (ear_deaf > 0) ear_deaf--
if (ear_damage < 25)
ear_damage -= 0.05
ear_damage = max(ear_damage, 0)
if(!reagents.has_reagent("inaprovaline"))
adjustOxyLoss(1)
density = !( lying )
stat = UNCONSCIOUS
Paralyse(5)
if ((sdisabilities & 1 || istype(glasses, /obj/item/clothing/glasses/blindfold)))
blinded = 1
if ((sdisabilities & 4 || istype(ears, /obj/item/clothing/ears/earmuffs)))
ear_deaf = 1
if(silent)
silent = max(silent-1, 0)
if (eye_blurry > 0)
eye_blurry--
eye_blurry = max(0, eye_blurry)
if(stunned > 0)
AdjustStunned(-1)
if(weakened > 0)
AdjustWeakened(-1)
if (druggy > 0)
druggy--
druggy = max(0, druggy)
//Incapacitated
if(paralysis > 0)
AdjustParalysis(-1)
blinded = 1
stat = UNCONSCIOUS
if(sleeping > 0)
handle_dreams()
adjustHalLoss(-5)
blinded = 1
stat = UNCONSCIOUS
if( prob(10) && health && !hal_crit )
spawn(0)
emote("snore")
sleeping = max(sleeping-1, 0)
if(stuttering)
stuttering = max(stuttering-1, 0)
//Eyes & Ears
if(sdisabilities & 1) //disabled-blind, doesn't get better on its own
blinded = 1
else if(eye_blind) //blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
blinded = 1
else if(istype(glasses, /obj/item/clothing/glasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster
eye_blurry = max(eye_blurry-3, 0)
blinded = 1
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
if(sdisabilities & 4) //disabled-deaf, doesn't get better on its own
ear_deaf = max(ear_deaf, 1)
else if(ear_deaf) //deafness, heals slowly over time
ear_deaf = max(ear_deaf-1, 0)
else if(istype(ears, /obj/item/clothing/ears/earmuffs)) //resting your ears with earmuffs heals ear damage faster
ear_damage = max(ear_damage-0.15, 0)
ear_deaf = max(ear_deaf, 1)
else if(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs
ear_damage = max(ear_damage-0.05, 0)
if(druggy)
druggy = max(druggy-1, 0)
return 1
proc/handle_regular_hud_updates()
if(!client) return 0
@@ -127,6 +127,8 @@ Please contact me on #coderbus IRC. ~Carn x
//this proc is messy as I was forced to include some old laggy cloaking code to it so that I don't break cloakers
//I'll work on removing that stuff by rewriting some of the cloaking stuff at a later date.
/mob/living/carbon/human/update_icons()
if(Debug2) world << "human/update_icons()"
lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again
update_hud() //TODO: remove the need for this
overlays = null
@@ -354,19 +356,14 @@ Please contact me on #coderbus IRC. ~Carn x
if(!t_color) t_color = icon_state
var/image/lying = image("icon_state" = "[t_color]_l")
var/image/standing = image("icon_state" = "[t_color]_s")
if( (FAT in mutations) )
if(w_uniform.flags&ONESIZEFITSALL)
lying.icon = 'uniform_fat.dmi'
standing.icon = 'uniform_fat.dmi'
else
src << "\red You burst out of \the [w_uniform]!"
var/obj/item/clothing/c = w_uniform
w_uniform = null
if(client)
client.screen -= c
c.loc = loc
c.dropped(src)
c.layer = initial(c.layer)
drop_from_inventory(w_uniform)
lying = null
standing = null
else
@@ -451,14 +451,10 @@
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
@@ -557,14 +553,10 @@
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
@@ -66,7 +66,7 @@
if(source.loc != s_loc) return
if(target.loc != t_loc) return
if(LinkBlocked(s_loc,t_loc)) return
if(item && source.equipped() != item) return
if(item && source.get_active_hand() != item) return
if ((source.restrained() || source.stat)) return
switch(place)
if("mask")
+5 -22
View File
@@ -56,25 +56,13 @@
//Status updates, death etc.
UpdateLuminosity()
handle_regular_status_updates()
update_canmove()
clamp_values()
if(client)
handle_regular_hud_updates()
//Being buckled to a chair or bed
check_if_buckled()
//Temporary, whilst I finish the regenerate_icons changes ~Carn
if( update_icon ) //forces a full overlay update
update_icon = 0
regenerate_icons()
else if( lying != lying_prev )
update_icons()
// Yup.
update_canmove()
clamp_values()
// Grabbing
for(var/obj/item/weapon/grab/G in src)
G.process()
@@ -93,10 +81,9 @@
proc/clamp_values()
AdjustStunned(0)
// AdjustStunned(0)
AdjustParalysis(0)
AdjustWeakened(0)
// AdjustWeakened(0)
proc/handle_disabilities()
@@ -250,10 +237,6 @@
src.internals.icon_state = "internal0"
return null
proc/update_canmove()
if(paralysis || stunned || weakened || buckled || (changeling && changeling.changeling_fakedeath)) canmove = 0
else canmove = 1
proc/handle_breath(datum/gas_mixture/breath)
if(src.nodamage)
return
@@ -85,7 +85,7 @@
var/obj/effect/equip_e/monkey/O = new /obj/effect/equip_e/monkey( )
O.source = usr
O.target = src
O.item = usr.equipped()
O.item = usr.get_active_hand()
O.s_loc = usr.loc
O.t_loc = loc
O.place = href_list["item"]
@@ -211,14 +211,10 @@
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
@@ -286,14 +282,10 @@
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
+2 -15
View File
@@ -173,22 +173,9 @@
/mob/living/proc/UpdateDamageIcon()
return
/*CARN: Deprecated. Please use update_canmove()
/mob/living/proc/check_if_buckled()
if (buckled)
density = 1
if( istype(buckled, /obj/structure/stool/bed/chair) )
lying = 0
else
lying = 1
else
density = !lying
if(lying)
var/h = hand
hand = 0
drop_item()
hand = 1
drop_item()
hand = h
*/
/mob/living/proc/Examine_OOC()
set name = "Examine Meta-Info (OOC)"
@@ -40,6 +40,7 @@
var/obj/item/weapon/cloaking_device/C = locate((/obj/item/weapon/cloaking_device) in src)
if(C && C.active)
C.attack_self(src)//Should shut it off
update_icons()
src << "\blue Your [C.name] was disrupted!"
Stun(2)
@@ -0,0 +1,79 @@
//These procs handle putting s tuff in your hand. It's probably best to use these rather than setting stuff manually
//as they handle all relevant stuff like adding it to the player's screen and such
//Returns the thing in our active hand (whatever is in our active module-slot, in this case)
/mob/living/silicon/robot/get_active_hand()
return module_active
/*-------TODOOOOOOOOOO--------*/
/mob/living/silicon/robot/proc/uneq_active()
if(isnull(module_active))
return
if(module_state_1 == module_active)
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode &= ~module_state_1:sight_mode
if (client)
client.screen -= module_state_1
contents -= module_state_1
module_active = null
module_state_1 = null
inv1.icon_state = "inv1"
else if(module_state_2 == module_active)
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode &= ~module_state_2:sight_mode
if (client)
client.screen -= module_state_2
contents -= module_state_2
module_active = null
module_state_2 = null
inv2.icon_state = "inv2"
else if(module_state_3 == module_active)
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode &= ~module_state_3:sight_mode
if (client)
client.screen -= module_state_3
contents -= module_state_3
module_active = null
module_state_3 = null
inv3.icon_state = "inv3"
/mob/living/silicon/robot/proc/uneq_all()
module_active = null
if(module_state_1)
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode &= ~module_state_1:sight_mode
if (client)
client.screen -= module_state_1
contents -= module_state_1
module_state_1 = null
inv1.icon_state = "inv1"
if(module_state_2)
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode &= ~module_state_2:sight_mode
if (client)
client.screen -= module_state_2
contents -= module_state_2
module_state_2 = null
inv2.icon_state = "inv2"
if(module_state_3)
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode &= ~module_state_3:sight_mode
if (client)
client.screen -= module_state_3
contents -= module_state_3
module_state_3 = null
inv3.icon_state = "inv3"
/mob/living/silicon/robot/proc/activated(obj/item/O)
if(module_state_1 == O)
return 1
else if(module_state_2 == O)
return 1
else if(module_state_3 == O)
return 1
else
return 0
@@ -16,7 +16,7 @@
UpdateLuminosity()
handle_regular_hud_updates()
update_items()
if (src.stat != 2) //still using power
if (src.stat != DEAD) //still using power
use_power()
process_killswitch()
process_locks()
@@ -30,9 +30,9 @@
proc
clamp_values()
SetStunned(min(stunned, 30))
// SetStunned(min(stunned, 30))
SetParalysis(min(paralysis, 30))
SetWeakened(min(weakened, 20))
// SetWeakened(min(weakened, 20))
sleeping = 0
adjustBruteLoss(0)
adjustToxLoss(0)
@@ -66,12 +66,6 @@
uneq_all()
src.stat = 1
update_canmove()
if(paralysis || stunned || weakened || buckled || lockcharge) canmove = 0
else canmove = 1
update_mind()
if(!mind && client)
mind = new
@@ -315,3 +309,8 @@
src << "\red <B>Weapon Lock Timed Out!"
weapon_lock = 0
weaponlock_time = 120
update_canmove()
if(paralysis || stunned || weakened || buckled || lockcharge) canmove = 0
else canmove = 1
return canmove
+8 -91
View File
@@ -540,14 +540,10 @@
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
playsound(loc, 'thudswoosh.ogg', 50, 1, -1)
@@ -673,20 +669,11 @@
if(opened && !wiresexposed && (!istype(user, /mob/living/silicon)))
if(cell)
cell.loc = usr
cell.layer = 20
if (user.hand )
user.l_hand = cell
user.update_inv_l_hand()
else
user.r_hand = cell
user.update_inv_r_hand()
cell.add_fingerprint(user)
cell.updateicon()
cell.add_fingerprint(user)
user.put_in_active_hand(cell)
user << "You remove \the [cell]."
cell = null
user << "You remove the power cell."
updateicon()
if(ishuman(user))
@@ -701,12 +688,12 @@
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
//if they are holding or wearing a card that has access, that works
if(check_access(H.equipped()) || check_access(H.wear_id))
if(check_access(H.get_active_hand()) || check_access(H.wear_id))
return 1
else if(istype(M, /mob/living/carbon/monkey))
var/mob/living/carbon/monkey/george = M
//they can only hold things :(
if(george.equipped() && istype(george.equipped(), /obj/item/weapon/card/id) && check_access(george.equipped()))
if(george.get_active_hand() && istype(george.get_active_hand(), /obj/item/weapon/card/id) && check_access(george.get_active_hand()))
return 1
return 0
@@ -855,76 +842,6 @@
installed_modules()
return
/mob/living/silicon/robot/proc/uneq_active()
if(isnull(module_active))
return
if(module_state_1 == module_active)
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode &= ~module_state_1:sight_mode
if (client)
client.screen -= module_state_1
contents -= module_state_1
module_active = null
module_state_1 = null
inv1.icon_state = "inv1"
else if(module_state_2 == module_active)
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode &= ~module_state_2:sight_mode
if (client)
client.screen -= module_state_2
contents -= module_state_2
module_active = null
module_state_2 = null
inv2.icon_state = "inv2"
else if(module_state_3 == module_active)
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode &= ~module_state_3:sight_mode
if (client)
client.screen -= module_state_3
contents -= module_state_3
module_active = null
module_state_3 = null
inv3.icon_state = "inv3"
/mob/living/silicon/robot/proc/uneq_all()
module_active = null
if(module_state_1)
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode &= ~module_state_1:sight_mode
if (client)
client.screen -= module_state_1
contents -= module_state_1
module_state_1 = null
inv1.icon_state = "inv1"
if(module_state_2)
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode &= ~module_state_2:sight_mode
if (client)
client.screen -= module_state_2
contents -= module_state_2
module_state_2 = null
inv2.icon_state = "inv2"
if(module_state_3)
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode &= ~module_state_3:sight_mode
if (client)
client.screen -= module_state_3
contents -= module_state_3
module_state_3 = null
inv3.icon_state = "inv3"
/mob/living/silicon/robot/proc/activated(obj/item/O)
if(module_state_1 == O)
return 1
else if(module_state_2 == O)
return 1
else if(module_state_3 == O)
return 1
else
return 0
/mob/living/silicon/robot/proc/radio_menu()
var/dat = {"
<TT>
@@ -98,7 +98,7 @@
usr.machine = src
if (href_list["borgwires"])
var/t1 = text2num(href_list["borgwires"])
if (!( istype(usr.equipped(), /obj/item/weapon/wirecutters) ))
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
usr << "You need wirecutters!"
return
if (src.isWireColorCut(t1))
@@ -107,7 +107,7 @@
src.cut(t1)
else if (href_list["pulse"])
var/t1 = text2num(href_list["pulse"])
if (!istype(usr.equipped(), /obj/item/device/multitool))
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
usr << "You need a multitool!"
return
if (src.isWireColorCut(t1))
+41 -5
View File
@@ -108,7 +108,7 @@
//Used by monkeys, *chimpers* //TODO: eliminate this convoluted proc it's incredibly shitty. ~Carn
/mob/proc/db_click(text, t1)
var/obj/item/weapon/W = equipped()
var/obj/item/weapon/W = get_active_hand()
switch(text)
if("mask")
if (wear_mask)
@@ -666,6 +666,43 @@ note dizziness decrements automatically in the mob's Life() proc.
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( stat || weakened || paralysis || resting || sleeping || (changeling && changeling.changeling_fakedeath) )
lying = 1
canmove = 0
else if( stunned )
// lying = 0
canmove = 0
else
lying = 0
canmove = 1
if(buckled)
anchored = 1
if( istype(buckled,/obj/structure/stool/bed/chair) )
lying = 0
else
lying = 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
@@ -706,8 +743,6 @@ note dizziness decrements automatically in the mob's Life() proc.
/mob/proc/Stun(amount)
if(canstun)
stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun
else
if(istype(src, /mob/living/carbon/alien)) // add some movement delay
var/mob/living/carbon/alien/Alien = src
@@ -717,8 +752,6 @@ note dizziness decrements automatically in the mob's Life() proc.
/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(canstun)
stunned = max(amount,0)
return
/mob/proc/AdjustStunned(amount)
@@ -729,16 +762,19 @@ note dizziness decrements automatically in the mob's Life() proc.
/mob/proc/Weaken(amount)
if(canweaken)
weakened = max(max(weakened,amount),0)
update_canmove() //updates lying, canmove and icons
return
/mob/proc/SetWeakened(amount)
if(canweaken)
weakened = max(amount,0)
update_canmove() //updates lying, canmove and icons
return
/mob/proc/AdjustWeakened(amount)
if(canweaken)
weakened = max(weakened + amount,0)
update_canmove() //updates lying, canmove and icons
return
/mob/proc/Paralyse(amount)
+8 -3
View File
@@ -172,9 +172,14 @@
/client/verb/attack_self()
set hidden = 1
var/obj/item/weapon/W = mob.equipped()
if (W)
W.attack_self(mob)
if(mob.hand)
if(mob.l_hand)
mob.l_hand.attack_self(mob)
mob.update_inv_l_hand()
else
if(mob.r_hand)
mob.r_hand.attack_self(mob)
mob.update_inv_r_hand()
return
+2 -7
View File
@@ -277,14 +277,9 @@
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
M.update_inv_l_hand()
else
M.r_hand = G
M.update_inv_r_hand()
G.layer = 20
G.affecting = src
M.put_in_active_hand(G)
grabbed_by += G
G.synch()
+7 -7
View File
@@ -2,9 +2,9 @@
if (monkeyizing)
return
for(var/obj/item/W in src)
if (W==w_uniform) // will be teared
if (W==w_uniform) // will be torn
continue
drop_from_slot(W)
drop_from_inventory(W)
regenerate_icons()
monkeyizing = 1
canmove = 0
@@ -63,7 +63,7 @@
if (monkeyizing)
return
for(var/obj/item/W in src)
drop_from_slot(W)
drop_from_inventory(W)
regenerate_icons()
monkeyizing = 1
canmove = 0
@@ -155,7 +155,7 @@
if (monkeyizing)
return
for(var/obj/item/W in src)
drop_from_slot(W)
drop_from_inventory(W)
regenerate_icons()
monkeyizing = 1
canmove = 0
@@ -222,7 +222,7 @@
if (monkeyizing)
return
for(var/obj/item/W in src)
drop_from_slot(W)
drop_from_inventory(W)
regenerate_icons()
monkeyizing = 1
canmove = 0
@@ -262,7 +262,7 @@
if (monkeyizing)
return
for(var/obj/item/W in src)
drop_from_slot(W)
drop_from_inventory(W)
regenerate_icons()
monkeyizing = 1
canmove = 0
@@ -313,7 +313,7 @@
if (monkeyizing)
return
for(var/obj/item/W in src)
drop_from_slot(W)
drop_from_inventory(W)
regenerate_icons()
monkeyizing = 1
canmove = 0