Merge pull request #11493 from Fox-McCloud/mob-icon-fix-maybe

Generic Layering and forceMove fixes
This commit is contained in:
variableundefined
2019-05-09 12:06:48 +08:00
committed by GitHub
21 changed files with 149 additions and 164 deletions
+2 -21
View File
@@ -1,23 +1,4 @@
/mob/dead/forceMove(atom/destination)
// Overriden from code/game/atoms_movable.dm#141 to prevent things like mice squeaking when ghosts walk on them.
// Same as parent, except that it does not include Uncrossed or Crossed calls.
var/turf/old_loc = loc
var/oldloc = loc
loc = destination
if(old_loc)
old_loc.Exited(src, destination)
if(destination)
destination.Entered(src)
if(isturf(destination) && opacity)
var/turf/new_loc = destination
new_loc.reconsider_lights()
if(isturf(old_loc) && opacity)
old_loc.reconsider_lights()
for(var/datum/light_source/L in light_sources)
L.source_atom.update_light()
return 1
Moved(oldloc, NONE, TRUE)
+18 -22
View File
@@ -10,7 +10,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
desc = "It's a g-g-g-g-ghooooost!" //jinkies!
icon = 'icons/mob/mob.dmi'
icon_state = "ghost"
layer = 4
layer = GHOST_LAYER
stat = DEAD
density = 0
canmove = 0
@@ -228,29 +228,25 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/Move(NewLoc, direct)
following = null
dir = direct
ghostimage.dir = dir
setDir(direct)
ghostimage.setDir(dir)
var/oldloc = loc
if(NewLoc)
forceMove(NewLoc)
return
forceMove(get_turf(src)) //Get out of closets and such as a ghost
if((direct & NORTH) && y < world.maxy)
y++
else if((direct & SOUTH) && y > 1)
y--
if((direct & EAST) && x < world.maxx)
x++
else if((direct & WEST) && x > 1)
x--
else
forceMove(get_turf(src)) //Get out of closets and such as a ghost
if((direct & NORTH) && y < world.maxy)
y++
else if((direct & SOUTH) && y > 1)
y--
if((direct & EAST) && x < world.maxx)
x++
else if((direct & WEST) && x > 1)
x--
for(var/obj/effect/step_trigger/S in locate(x, y, z)) //<-- this is dumb
S.Crossed(src)
var/area/A = get_area(src)
if(A)
A.Entered(src)
..()
Moved(oldloc, direct)
/mob/dead/observer/can_use_hands() return 0
@@ -399,7 +395,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/area/A = input("Area to jump to", "BOOYEA") as null|anything in ghostteleportlocs
var/area/thearea = ghostteleportlocs[A]
if(!thearea)
return
@@ -7,8 +7,8 @@
if(stat != CONSCIOUS)
return
if(layer != TURF_LAYER+0.2)
layer = TURF_LAYER+0.2
if(layer != ABOVE_NORMAL_TURF_LAYER)
layer = ABOVE_NORMAL_TURF_LAYER
visible_message("<B>[src] scurries to the ground!</B>", "<span class='noticealien'>You are now hiding.</span>")
else
layer = MOB_LAYER
+2 -2
View File
@@ -44,7 +44,7 @@
visible_message("<span class='notice'>[user] sticks \a [O] into \the [src].</span>")
brainmob = B.brainmob
B.brainmob = null
brainmob.loc = src
brainmob.forceMove(src)
brainmob.container = src
brainmob.stat = CONSCIOUS
GLOB.respawnable_list -= brainmob
@@ -152,7 +152,7 @@
held_brain.name = "\the [brainmob.name]'s [initial(held_brain.name)]"
brainmob.container = null//Reset brainmob mmi var.
brainmob.loc = held_brain//Throw mob into brain.
brainmob.forceMove(held_brain) //Throw mob into brain.
GLOB.respawnable_list += brainmob
GLOB.living_mob_list -= brainmob//Get outta here
held_brain.brainmob = brainmob//Set the brain to use the brainmob
@@ -67,10 +67,10 @@
/mob/living/carbon/brain/on_forcemove(atom/newloc)
if(container)
container.loc = newloc
container.forceMove(newloc)
else //something went very wrong.
CRASH("Brainmob without container.")
loc = container
forceMove(container)
/*
This will return true if the brain has a container that leaves it less helpless than a naked brain
+7 -7
View File
@@ -72,7 +72,7 @@
if(prob(src.getBruteLoss() - 50))
for(var/atom/movable/A in stomach_contents)
A.loc = loc
A.forceMove(drop_location())
stomach_contents.Remove(A)
src.gib()
@@ -833,7 +833,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
to_chat(src, "<span class='notice'>You successfully remove [I].</span>")
if(I == handcuffed)
handcuffed.loc = loc
handcuffed.forceMove(drop_location())
handcuffed.dropped(src)
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
@@ -841,7 +841,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
update_handcuffed()
return
if(I == legcuffed)
legcuffed.loc = loc
legcuffed.forceMove(drop_location())
legcuffed.dropped()
legcuffed = null
update_inv_legcuffed()
@@ -935,7 +935,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
if(client)
client.screen -= W
if(W)
W.loc = loc
W.forceMove(drop_location())
W.dropped(src)
if(W)
W.layer = initial(W.layer)
@@ -947,7 +947,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
if(client)
client.screen -= W
if(W)
W.loc = loc
W.forceMove(drop_location())
W.dropped(src)
if(W)
W.layer = initial(W.layer)
@@ -1141,7 +1141,7 @@ so that different stomachs can handle things in different ways VB*/
sight = initial(sight)
lighting_alpha = initial(lighting_alpha)
for(var/obj/item/organ/internal/cyberimp/eyes/E in internal_organs)
sight |= E.vision_flags
if(E.see_in_dark)
@@ -1160,6 +1160,6 @@ so that different stomachs can handle things in different ways VB*/
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT)
sync_lighting_plane_alpha()
@@ -187,82 +187,85 @@
//This is an UNSAFE proc. Use mob_can_equip() before calling this one! Or rather use equip_to_slot_if_possible() or advanced_equip_to_slot_if_possible()
//set redraw_mob to 0 if you don't wish the hud to be updated - if you're doing it manually in your own proc.
/mob/living/carbon/human/equip_to_slot(obj/item/W as obj, slot, redraw_mob = 1)
if(!slot) return
if(!istype(W)) return
if(!has_organ_for_slot(slot)) return
/mob/living/carbon/human/equip_to_slot(obj/item/I, slot, redraw_mob = 1)
if(!slot)
return
if(!istype(I))
return
if(!has_organ_for_slot(slot))
return
if(W == src.l_hand)
if(I == src.l_hand)
src.l_hand = null
update_inv_l_hand() //So items actually disappear from hands.
else if(W == src.r_hand)
else if(I == src.r_hand)
src.r_hand = null
update_inv_r_hand()
W.screen_loc = null
W.loc = src
W.equipped(src, slot)
W.layer = ABOVE_HUD_LAYER
W.plane = ABOVE_HUD_PLANE
I.screen_loc = null
I.forceMove(src)
I.equipped(src, slot)
I.layer = ABOVE_HUD_LAYER
I.plane = ABOVE_HUD_PLANE
switch(slot)
if(slot_back)
back = W
back = I
update_inv_back(redraw_mob)
if(slot_wear_mask)
wear_mask = W
wear_mask = I
if((wear_mask.flags & BLOCKHAIR) || (wear_mask.flags & BLOCKHEADHAIR))
update_hair(redraw_mob) //rebuild hair
update_fhair(redraw_mob)
update_head_accessory(redraw_mob)
if(hud_list.len)
sec_hud_set_ID()
wear_mask_update(W, toggle_off = TRUE)
wear_mask_update(I, toggle_off = TRUE)
update_inv_wear_mask(redraw_mob)
if(slot_handcuffed)
handcuffed = W
handcuffed = I
update_inv_handcuffed(redraw_mob)
if(slot_legcuffed)
legcuffed = W
legcuffed = I
update_inv_legcuffed(redraw_mob)
if(slot_l_hand)
l_hand = W
l_hand = I
update_inv_l_hand(redraw_mob)
if(slot_r_hand)
r_hand = W
r_hand = I
update_inv_r_hand(redraw_mob)
if(slot_belt)
belt = W
belt = I
update_inv_belt(redraw_mob)
if(slot_wear_id)
wear_id = W
wear_id = I
if(hud_list.len)
sec_hud_set_ID()
update_inv_wear_id(redraw_mob)
if(slot_wear_pda)
wear_pda = W
wear_pda = I
update_inv_wear_pda(redraw_mob)
if(slot_l_ear)
l_ear = W
l_ear = I
if(l_ear.slot_flags & SLOT_TWOEARS)
var/obj/item/clothing/ears/offear/O = new(W)
O.loc = src
var/obj/item/clothing/ears/offear/O = new(I)
O.forceMove(src)
r_ear = O
O.layer = ABOVE_HUD_LAYER
O.plane = ABOVE_HUD_PLANE
update_inv_ears(redraw_mob)
if(slot_r_ear)
r_ear = W
r_ear = I
if(r_ear.slot_flags & SLOT_TWOEARS)
var/obj/item/clothing/ears/offear/O = new(W)
O.loc = src
var/obj/item/clothing/ears/offear/O = new(I)
O.forceMove(src)
l_ear = O
O.layer = ABOVE_HUD_LAYER
O.plane = ABOVE_HUD_PLANE
update_inv_ears(redraw_mob)
if(slot_glasses)
glasses = W
var/obj/item/clothing/glasses/G = W
glasses = I
var/obj/item/clothing/glasses/G = I
if(G.tint)
update_tint()
if(G.prescription)
@@ -272,49 +275,48 @@
update_inv_glasses(redraw_mob)
update_client_colour()
if(slot_gloves)
gloves = W
gloves = I
update_inv_gloves(redraw_mob)
if(slot_head)
head = W
head = I
if((head.flags & BLOCKHAIR) || (head.flags & BLOCKHEADHAIR))
update_hair(redraw_mob) //rebuild hair
update_fhair(redraw_mob)
update_head_accessory(redraw_mob)
// paper + bandanas
if(istype(W, /obj/item/clothing/head))
var/obj/item/clothing/head/hat = W
if(istype(I, /obj/item/clothing/head))
var/obj/item/clothing/head/hat = I
if(hat.vision_flags || hat.see_in_dark || !isnull(hat.lighting_alpha))
update_sight()
head_update(W)
head_update(I)
update_inv_head(redraw_mob)
if(slot_shoes)
shoes = W
shoes = I
update_inv_shoes(redraw_mob)
if(slot_wear_suit)
wear_suit = W
wear_suit = I
update_inv_wear_suit(redraw_mob)
if(slot_w_uniform)
w_uniform = W
w_uniform = I
update_inv_w_uniform(redraw_mob)
if(slot_l_store)
l_store = W
l_store = I
update_inv_pockets(redraw_mob)
if(slot_r_store)
r_store = W
r_store = I
update_inv_pockets(redraw_mob)
if(slot_s_store)
s_store = W
s_store = I
update_inv_s_store(redraw_mob)
if(slot_in_backpack)
if(get_active_hand() == W)
unEquip(W)
W.loc = back
if(get_active_hand() == I)
unEquip(I)
I.forceMove(back)
if(slot_tie)
var/obj/item/clothing/under/uniform = src.w_uniform
uniform.attackby(W,src)
uniform.attackby(I, src)
else
to_chat(src, "<span class='warning'>You are trying to equip this item to an unsupported inventory slot. Report this to a coder!</span>")
return
/mob/living/carbon/human/put_in_hands(obj/item/W)
if(!W) return 0
@@ -597,7 +597,7 @@ var/global/list/damage_icon_parts = list()
client.screen -= thing // WHAT THE FUCKING FUCK BAY GODDAMNIT
// **I FUCKING HATE YOU AAAAAAAAAA**
if(thing) //
thing.loc = loc //
thing.forceMove(drop_location()) //
thing.dropped(src) //
thing.layer = initial(thing.layer)
thing.plane = initial(thing.plane)
@@ -47,7 +47,7 @@
/mob/living/carbon/slime/proc/Feedon(var/mob/living/M)
Victim = M
src.loc = M.loc
forceMove(M.loc)
canmove = 0
anchored = 1
var/lastnut = nutrition
@@ -64,7 +64,7 @@
canmove = 0
if(Adjacent(Victim))
loc = M.loc
forceMove(M.loc)
if(iscarbon(Victim))
Victim.adjustCloneLoss(rand(5,6))
@@ -163,7 +163,7 @@
/mob/living/carbon/slime/proc/UpdateFeed(var/mob/M)
if(Victim)
if(Victim == M)
loc = M.loc // simple "attach to head" effect!
forceMove(M.loc) // simple "attach to head" effect!
/mob/living/carbon/slime/verb/Evolve()
+1 -2
View File
@@ -519,7 +519,6 @@
var/turf/T = loc
. = ..()
if(.)
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED)
handle_footstep(loc)
step_count++
@@ -972,7 +971,7 @@
/mob/living/onTransitZ(old_z,new_z)
..()
update_z(new_z)
update_z(new_z)
/mob/living/proc/owns_soul()
if(mind)
@@ -35,8 +35,9 @@
can_collar = 1
gold_core_spawnable = CHEM_MOB_SPAWN_FRIENDLY
/mob/living/simple_animal/mouse/Initialize()
/mob/living/simple_animal/mouse/Initialize(mapload)
. = ..()
AddComponent(/datum/component/squeak, list('sound/creatures/mousesqueak.ogg' = 1), 100)
/mob/living/simple_animal/mouse/handle_automated_speech()
..()
@@ -92,10 +93,9 @@
/mob/living/simple_animal/mouse/Crossed(AM as mob|obj)
if(ishuman(AM))
if(stat == CONSCIOUS)
if(!stat)
var/mob/M = AM
to_chat(M, "<span class='notice'>[bicon(src)] Squeek!</span>")
SEND_SOUND(M, squeak_sound)
..()
/mob/living/simple_animal/mouse/death(gibbed)
+2 -2
View File
@@ -93,9 +93,9 @@
density = !lying
if(lying)
if(layer == initial(layer))
layer = MOB_LAYER - 0.2
layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs
else
if(layer == MOB_LAYER - 0.2)
if(layer == LYING_MOB_LAYER)
layer = initial(layer)
update_transform()
+3 -3
View File
@@ -214,12 +214,12 @@
shift = -10
adir = assailant.dir
affecting.setDir(assailant.dir)
affecting.loc = assailant.loc
affecting.forceMove(assailant.loc)
if(GRAB_KILL)
shift = 0
adir = 1
affecting.setDir(SOUTH)//face up
affecting.loc = assailant.loc
affecting.forceMove(assailant.loc)
switch(adir)
if(NORTH)
@@ -387,7 +387,7 @@
if(M == assailant && state >= GRAB_AGGRESSIVE) //no eatin unless you have an agressive grab
if(checkvalid(user, affecting)) //wut
var/mob/living/carbon/attacker = user
if(affecting.buckled)
to_chat(user, "<span class='warning'>[affecting] is buckled!</span>")
return