Merge pull request #2866 from cadyn/upstream-merge-11404

Merge Upstream Pull Request 11404
This commit is contained in:
Nadyr
2021-08-25 21:23:07 -04:00
committed by GitHub
12 changed files with 31 additions and 33 deletions

View File

@@ -26,7 +26,6 @@
closet_appearance = null closet_appearance = null
open_sound = 'sound/items/zip.ogg' open_sound = 'sound/items/zip.ogg'
close_sound = 'sound/items/zip.ogg' close_sound = 'sound/items/zip.ogg'
door_anim_time = 0 //Unsupported
var/item_path = /obj/item/bodybag var/item_path = /obj/item/bodybag
density = FALSE density = FALSE
storage_capacity = (MOB_MEDIUM * 2) - 1 storage_capacity = (MOB_MEDIUM * 2) - 1

View File

@@ -65,7 +65,6 @@
closet_appearance = null closet_appearance = null
catalogue_data = list(/datum/category_item/catalogue/information/objects/oldreactor) catalogue_data = list(/datum/category_item/catalogue/information/objects/oldreactor)
climbable = FALSE climbable = FALSE
door_anim_time = 0 //Unsupported
starts_with = list( starts_with = list(
/obj/item/weapon/fuel_assembly/deuterium = 6) /obj/item/weapon/fuel_assembly/deuterium = 6)

View File

@@ -34,19 +34,11 @@
var/list/starts_with // List of type = count (or just type for 1) var/list/starts_with // List of type = count (or just type for 1)
var/closet_appearance = /decl/closet_appearance // The /decl that defines what decals we end up with, that makes our look unique var/decl/closet_appearance/closet_appearance = /decl/closet_appearance // The /decl that defines what decals we end up with, that makes our look unique
/// Currently animating the door transform /// Currently animating the door transform
var/is_animating_door = FALSE var/is_animating_door = FALSE
/// Length of time (ds) to animate the door transform /// Our visual object for the closet door, if we're animating
var/door_anim_time = 2.0
/// Amount to 'squish' the full width of the door by
var/door_anim_squish = 0.30
/// Virtual angle at which the door is opened to (136 by default, so not a full 180)
var/door_anim_angle = 136
/// Offset for the door hinge location from centerline
var/door_hinge = -6.5
/// Our visual object for the closet door
var/obj/effect/overlay/closet_door/door_obj var/obj/effect/overlay/closet_door/door_obj
/obj/structure/closet/Initialize() /obj/structure/closet/Initialize()
@@ -73,15 +65,16 @@
storage_capacity = content_size + 5 storage_capacity = content_size + 5
if(ispath(closet_appearance)) if(ispath(closet_appearance))
var/decl/closet_appearance/app = GLOB.closet_appearances[closet_appearance] closet_appearance = GLOB.closet_appearances[closet_appearance]
if(app) if(istype(closet_appearance))
icon = app.icon icon = closet_appearance.icon
color = null color = null
update_icon() update_icon()
/obj/structure/closet/Destroy() /obj/structure/closet/Destroy()
. = ..()
qdel_null(door_obj) qdel_null(door_obj)
closet_appearance = null
return ..()
/obj/structure/closet/examine(mob/user) /obj/structure/closet/examine(mob/user)
. = ..() . = ..()
@@ -500,7 +493,7 @@
return 1 return 1
/obj/structure/closet/proc/animate_door(closing = FALSE) /obj/structure/closet/proc/animate_door(closing = FALSE)
if(!door_anim_time) if(!closet_appearance?.door_anim_time)
update_icon() update_icon()
return return
if(!door_obj) if(!door_obj)
@@ -511,9 +504,9 @@
is_animating_door = TRUE is_animating_door = TRUE
if(!closing) if(!closing)
update_icon() update_icon()
var/num_steps = door_anim_time / world.tick_lag var/num_steps = closet_appearance.door_anim_time / world.tick_lag
for(var/I in 0 to num_steps) for(var/I in 0 to num_steps)
var/angle = door_anim_angle * (closing ? 1 - (I/num_steps) : (I/num_steps)) var/angle = closet_appearance.door_anim_angle * (closing ? 1 - (I/num_steps) : (I/num_steps))
var/matrix/M = get_door_transform(angle) var/matrix/M = get_door_transform(angle)
var/door_state = angle >= 90 ? "door_back" : "door_front" var/door_state = angle >= 90 ? "door_back" : "door_front"
var/door_layer = angle >= 90 ? FLOAT_LAYER : ABOVE_MOB_LAYER var/door_layer = angle >= 90 ? FLOAT_LAYER : ABOVE_MOB_LAYER
@@ -526,7 +519,7 @@
animate(door_obj, transform = M, icon_state = door_state, layer = door_layer, time = world.tick_lag, flags = ANIMATION_END_NOW) animate(door_obj, transform = M, icon_state = door_state, layer = door_layer, time = world.tick_lag, flags = ANIMATION_END_NOW)
else else
animate(transform = M, icon_state = door_state, layer = door_layer, time = world.tick_lag) animate(transform = M, icon_state = door_state, layer = door_layer, time = world.tick_lag)
addtimer(CALLBACK(src,.proc/end_door_animation,closing),door_anim_time,TIMER_UNIQUE|TIMER_OVERRIDE) addtimer(CALLBACK(src, .proc/end_door_animation,closing), closet_appearance.door_anim_time, TIMER_UNIQUE|TIMER_OVERRIDE)
/obj/structure/closet/proc/end_door_animation(closing = FALSE) /obj/structure/closet/proc/end_door_animation(closing = FALSE)
is_animating_door = FALSE is_animating_door = FALSE
@@ -537,7 +530,9 @@
/obj/structure/closet/proc/get_door_transform(angle) /obj/structure/closet/proc/get_door_transform(angle)
var/matrix/M = matrix() var/matrix/M = matrix()
M.Translate(-door_hinge, 0) if(!closet_appearance)
M.Multiply(matrix(cos(angle), 0, 0, -sin(angle) * door_anim_squish, 1, 0)) return M
M.Translate(door_hinge, 0) M.Translate(-closet_appearance.door_hinge, 0)
M.Multiply(matrix(cos(angle), 0, 0, -sin(angle) * closet_appearance.door_anim_squish, 1, 0))
M.Translate(closet_appearance.door_hinge, 0)
return M return M

View File

@@ -14,6 +14,15 @@
var/decal_icon = 'icons/obj/closets/decals/closet.dmi' var/decal_icon = 'icons/obj/closets/decals/closet.dmi'
var/can_lock = FALSE var/can_lock = FALSE
/// Length of time (ds) to animate the door transform
var/door_anim_time = 2.0
/// Amount to 'squish' the full width of the door by
var/door_anim_squish = 0.30
/// Virtual angle at which the door is opened to (136 by default, so not a full 180)
var/door_anim_angle = 136
/// Offset for the door hinge location from centerline
var/door_hinge = -6.5
/decl/closet_appearance/New() /decl/closet_appearance/New()
// Build our colour and decal lists. // Build our colour and decal lists.
if(LAZYLEN(extra_decals)) if(LAZYLEN(extra_decals))
@@ -725,6 +734,7 @@
base_icon = 'icons/obj/closets/bases/crate.dmi' base_icon = 'icons/obj/closets/bases/crate.dmi'
decal_icon = 'icons/obj/closets/decals/crate.dmi' decal_icon = 'icons/obj/closets/decals/crate.dmi'
color = COLOR_GRAY40 color = COLOR_GRAY40
door_anim_time = 0
/decl/closet_appearance/crate/plastic /decl/closet_appearance/crate/plastic
color = COLOR_GRAY80 color = COLOR_GRAY80
@@ -1237,6 +1247,7 @@
decal_icon = 'icons/obj/closets/decals/large_crate.dmi' decal_icon = 'icons/obj/closets/decals/large_crate.dmi'
decals = null decals = null
extra_decals = null extra_decals = null
door_anim_time = 0
/decl/closet_appearance/large_crate/critter /decl/closet_appearance/large_crate/critter
color = COLOR_BEIGE color = COLOR_BEIGE
@@ -1349,6 +1360,7 @@
color = WOOD_COLOR_RICH color = WOOD_COLOR_RICH
decals = null decals = null
extra_decals = null extra_decals = null
door_anim_time = 0
/decl/closet_appearance/cabinet/secure /decl/closet_appearance/cabinet/secure
can_lock = TRUE can_lock = TRUE
@@ -1361,6 +1373,7 @@
"vent" "vent"
) )
extra_decals = null extra_decals = null
door_anim_time = 0
/decl/closet_appearance/wall/emergency /decl/closet_appearance/wall/emergency
color = COLOR_LIGHT_CYAN color = COLOR_LIGHT_CYAN
@@ -1402,6 +1415,7 @@
"vent" "vent"
) )
extra_decals = null extra_decals = null
door_anim_time = 0
/decl/closet_appearance/wall_double/kitchen /decl/closet_appearance/wall_double/kitchen
decals = null decals = null
@@ -1431,6 +1445,7 @@
decal_icon = 'icons/obj/closets/decals/cart.dmi' decal_icon = 'icons/obj/closets/decals/cart.dmi'
decals = null decals = null
extra_decals = null extra_decals = null
door_anim_time = 0
/decl/closet_appearance/cart/trash /decl/closet_appearance/cart/trash
color = COLOR_BOTTLE_GREEN color = COLOR_BOTTLE_GREEN

View File

@@ -7,7 +7,6 @@
seal_tool = /obj/item/weapon/tool/screwdriver seal_tool = /obj/item/weapon/tool/screwdriver
breakout_sound = 'sound/weapons/tablehit1.ogg' breakout_sound = 'sound/weapons/tablehit1.ogg'
closet_appearance = null // Special icon for us closet_appearance = null // Special icon for us
door_anim_time = 0 //Unsupported
/* Graves */ /* Graves */
/obj/structure/closet/grave /obj/structure/closet/grave
@@ -21,7 +20,6 @@
max_closets = 1 max_closets = 1
opened = 1 opened = 1
closet_appearance = null // Special icon for us closet_appearance = null // Special icon for us
door_anim_time = 0 //Unsupported
/obj/structure/closet/grave/attack_hand(mob/user as mob) /obj/structure/closet/grave/attack_hand(mob/user as mob)
if(opened) if(opened)

View File

@@ -2,4 +2,3 @@
name = "critter crate" name = "critter crate"
desc = "A crate which can sustain life for a while." desc = "A crate which can sustain life for a while."
closet_appearance = /decl/closet_appearance/large_crate/critter closet_appearance = /decl/closet_appearance/large_crate/critter
door_anim_time = 0 //Unsupported

View File

@@ -13,7 +13,6 @@
opened = 0 opened = 0
sealed = 0 //Don't touch this. sealed = 0 //Don't touch this.
health = 100 health = 100
door_anim_time = 0 //Unsupported
/obj/structure/closet/secure_closet/egg/update_icon() /obj/structure/closet/secure_closet/egg/update_icon()
if(opened) if(opened)

View File

@@ -3,7 +3,6 @@
desc = "Old will forever be in fashion." desc = "Old will forever be in fashion."
icon = 'icons/obj/closets/bases/cabinet.dmi' icon = 'icons/obj/closets/bases/cabinet.dmi'
closet_appearance = /decl/closet_appearance/cabinet closet_appearance = /decl/closet_appearance/cabinet
door_anim_time = 0 //Unsupported
/obj/structure/closet/acloset /obj/structure/closet/acloset
name = "strange closet" name = "strange closet"

View File

@@ -314,4 +314,3 @@ GLOBAL_LIST_BOILERPLATE(all_brig_closets, /obj/structure/closet/secure_closet/br
//too small to put a man in //too small to put a man in
large = 0 large = 0
door_anim_time = 0 // Unsupported

View File

@@ -7,7 +7,6 @@
anchored = TRUE anchored = TRUE
health = 0 //destroying the statue kills the mob within health = 0 //destroying the statue kills the mob within
blocks_emissive = EMISSIVE_BLOCK_UNIQUE blocks_emissive = EMISSIVE_BLOCK_UNIQUE
door_anim_time = 0 // Why is this a closet??
var/intialTox = 0 //these are here to keep the mob from taking damage from things that logically wouldn't affect a rock var/intialTox = 0 //these are here to keep the mob from taking damage from things that logically wouldn't affect a rock
var/intialFire = 0 //it's a little sloppy I know but it was this or the GODMODE flag. Lesser of two evils. var/intialFire = 0 //it's a little sloppy I know but it was this or the GODMODE flag. Lesser of two evils.
var/intialBrute = 0 var/intialBrute = 0

View File

@@ -10,7 +10,6 @@
anchored = TRUE anchored = TRUE
store_mobs = 0 store_mobs = 0
wall_mounted = 1 wall_mounted = 1
door_anim_time = 0 // Unsupported
//spawns 2 sets of breathmask, emergency oxy tank and crowbar //spawns 2 sets of breathmask, emergency oxy tank and crowbar
@@ -92,7 +91,6 @@
wall_mounted = 1 wall_mounted = 1
plane = TURF_PLANE plane = TURF_PLANE
layer = ABOVE_TURF_LAYER layer = ABOVE_TURF_LAYER
door_anim_time = 0 //Unsupported
/obj/structure/closet/walllocker_double/north /obj/structure/closet/walllocker_double/north
pixel_y = 32 pixel_y = 32

View File

@@ -7,7 +7,6 @@
closet_appearance = /decl/closet_appearance/crate closet_appearance = /decl/closet_appearance/crate
climbable = TRUE climbable = TRUE
dir = 4 //Spawn facing 'forward' by default. dir = 4 //Spawn facing 'forward' by default.
door_anim_time = 0 //Unsupported until appropriate sprites are available
var/points_per_crate = 5 var/points_per_crate = 5
var/rigged = 0 var/rigged = 0