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
+21 -15
View File
@@ -85,23 +85,29 @@
#define ABOVE_LIGHTING_PLANE 16
#define ABOVE_LIGHTING_LAYER 16
#define BYOND_LIGHTING_PLANE 17
#define BYOND_LIGHTING_LAYER 17
#define FLOOR_OPENSPACE_PLANE 17
#define OPENSPACE_LAYER 17
#define BYOND_LIGHTING_PLANE 18
#define BYOND_LIGHTING_LAYER 18
#define CAMERA_STATIC_PLANE 19
#define CAMERA_STATIC_LAYER 19
//HUD layer defines
#define FULLSCREEN_PLANE 18
#define FLASH_LAYER 18
#define FULLSCREEN_LAYER 18.1
#define UI_DAMAGE_LAYER 18.2
#define BLIND_LAYER 18.3
#define CRIT_LAYER 18.4
#define CURSE_LAYER 18.5
#define FULLSCREEN_PLANE 20
#define FLASH_LAYER 20
#define FULLSCREEN_LAYER 20.1
#define UI_DAMAGE_LAYER 20.2
#define BLIND_LAYER 20.3
#define CRIT_LAYER 20.4
#define CURSE_LAYER 20.5
#define HUD_PLANE 19
#define HUD_LAYER 19
#define ABOVE_HUD_PLANE 20
#define ABOVE_HUD_LAYER 20
#define HUD_PLANE 21
#define HUD_LAYER 21
#define ABOVE_HUD_PLANE 22
#define ABOVE_HUD_LAYER 22
#define SPLASHSCREEN_LAYER 21
#define SPLASHSCREEN_PLANE 21
#define SPLASHSCREEN_LAYER 23
#define SPLASHSCREEN_PLANE 23
+3
View File
@@ -141,6 +141,9 @@
blobpwrdisplay.name = "blob power"
blobpwrdisplay.icon_state = "block"
blobpwrdisplay.screen_loc = ui_health
blobpwrdisplay.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
blobpwrdisplay.layer = ABOVE_HUD_LAYER
blobpwrdisplay.plane = ABOVE_HUD_PLANE
static_inventory += blobpwrdisplay
blobhealthdisplay = new /obj/screen()
+1 -1
View File
@@ -1,7 +1,7 @@
/obj/screen/movable/pic_in_pic
name = "Picture-in-picture"
screen_loc = "CENTER"
plane = GAME_PLANE
plane = FLOOR_PLANE
var/atom/center
var/width = 0
var/height = 0
+7 -12
View File
@@ -9,9 +9,10 @@
/obj/screen
name = ""
icon = 'icons/mob/screen_gen.dmi'
layer = HUD_LAYER_SCREEN
plane = ABOVE_HUD_PLANE
unacidable = 1
layer = HUD_LAYER
plane = HUD_PLANE
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF
unacidable = TRUE
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
var/datum/hud/hud = null
appearance_flags = NO_CLIENT_COLOR
@@ -36,6 +37,8 @@
/obj/screen/close
name = "close"
layer = ABOVE_HUD_LAYER
plane = ABOVE_HUD_PLANE
/obj/screen/close/Click()
if(master)
@@ -47,8 +50,6 @@
/obj/screen/drop
name = "drop"
icon_state = "act_drop"
layer = HUD_LAYER
plane = HUD_PLANE
/obj/screen/drop/Click()
usr.drop_item_v()
@@ -144,9 +145,7 @@
name = "resist"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "act_resist"
layer = HUD_LAYER
plane = HUD_PLANE
/obj/screen/resist/Click()
if(isliving(usr))
var/mob/living/L = usr
@@ -329,8 +328,6 @@
/obj/screen/inventory
var/slot_id //The indentifier for the slot. It has nothing to do with ID cards.
var/list/object_overlays = list()
layer = HUD_LAYER
plane = HUD_PLANE
/obj/screen/inventory/MouseEntered()
..()
@@ -420,8 +417,6 @@
return 1
/obj/screen/swap_hand
layer = HUD_LAYER
plane = HUD_PLANE
name = "swap hand"
/obj/screen/swap_hand/Click()
+12 -16
View File
@@ -1,5 +1,3 @@
// Squeak component ported over from tg
/datum/component/squeak
var/static/list/default_squeak_sounds = list('sound/items/toysqueak1.ogg'=1, 'sound/items/toysqueak2.ogg'=1, 'sound/items/toysqueak3.ogg'=1)
var/list/override_squeak_sounds
@@ -49,21 +47,12 @@
else
playsound(parent, pickweight(override_squeak_sounds), volume, 1, -1)
/datum/component/squeak/proc/step_squeak(datum/source, mob/living/carbon/human/H)
if(H.m_intent == MOVE_INTENT_RUN)
if(steps > step_delay)
play_squeak()
steps = 0
else
steps++
else
/datum/component/squeak/proc/step_squeak()
if(steps > step_delay)
play_squeak()
/datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot)
RegisterSignal(equipper, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, TRUE)
/datum/component/squeak/proc/on_drop(datum/source, mob/user)
UnregisterSignal(user, COMSIG_MOVABLE_DISPOSING)
steps = 0
else
steps++
/datum/component/squeak/proc/play_squeak_crossed(atom/movable/AM)
if(isitem(AM))
@@ -83,6 +72,13 @@
last_use = world.time
play_squeak()
/datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot)
RegisterSignal(equipper, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, TRUE)
/datum/component/squeak/proc/on_drop(datum/source, mob/user)
UnregisterSignal(user, COMSIG_MOVABLE_DISPOSING)
// Disposal pipes related shit
/datum/component/squeak/proc/disposing_react(datum/source, obj/structure/disposalholder/holder, obj/machinery/disposal/source)
//We don't need to worry about unregistering this signal as it will happen for us automaticaly when the holder is qdeleted
RegisterSignal(holder, COMSIG_ATOM_DIR_CHANGE, .proc/holder_dir_change)
+6 -1
View File
@@ -4,6 +4,11 @@
// Mutable appearances are children of images, just so you know.
/mutable_appearance/New()
..()
plane = FLOAT_PLANE // No clue why this is 0 by default yet images are on FLOAT_PLANE
// And yes this does have to be in the constructor, BYOND ignores it if you set it as a normal var
// Helper similar to image()
/proc/mutable_appearance(icon, icon_state = "", layer = FLOAT_LAYER, plane = FLOAT_PLANE)
var/mutable_appearance/MA = new()
@@ -13,7 +18,7 @@
MA.plane = plane
return MA
/mutable_appearance/clean
/mutable_appearance/clean/New()
. = ..()
alpha = 255
+4 -3
View File
@@ -185,11 +185,12 @@
. = 0
// Called after a successful Move(). By this point, we've already moved
/atom/movable/proc/Moved(atom/OldLoc, Dir)
if(!inertia_moving)
/atom/movable/proc/Moved(atom/OldLoc, Dir, Forced = FALSE)
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, OldLoc, Dir, Forced)
if (!inertia_moving)
inertia_next_move = world.time + inertia_move_delay
newtonian_move(Dir)
return 1
return TRUE
// Previously known as HasEntered()
// This is automatically called when something enters your square
@@ -7,7 +7,8 @@
var/turf/teleport_target
/obj/machinery/abductor/pad/proc/Warp(mob/living/target)
target.Move(src.loc)
if(!target.buckled)
target.forceMove(get_turf(src))
/obj/machinery/abductor/pad/proc/Send()
if(teleport_target == null)
+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