This commit is contained in:
L
2020-06-27 05:10:30 -03:00
parent 8f66088b0f
commit 52bf8a66f9
6 changed files with 110 additions and 82 deletions

View File

@@ -45,14 +45,6 @@
#define DEFAULT_UNDERLAY_ICON 'icons/turf/floors.dmi'
#define DEFAULT_UNDERLAY_ICON_STATE "plating"
/atom/var/smooth = SMOOTH_FALSE
/atom/var/top_left_corner
/atom/var/top_right_corner
/atom/var/bottom_left_corner
/atom/var/bottom_right_corner
/atom/var/list/canSmoothWith = null // TYPE PATHS I CAN SMOOTH WITH~~~~~ If this is null and atom is smooth, it smooths only with itself
/atom/movable/var/can_be_unanchored = FALSE
/turf/var/list/fixed_underlay = null
/proc/calculate_adjacencies(atom/A)
if(!A.loc)
@@ -385,12 +377,10 @@
//SSicon_smooth
/proc/queue_smooth(atom/A)
if(!A.smooth || A.smooth & SMOOTH_QUEUED)
if(!A.smooth)
return
SSicon_smooth.smooth_queue += A
SSicon_smooth.can_fire = 1
A.smooth |= SMOOTH_QUEUED
SSicon_smooth.add_to_queue(A)
//Example smooth wall

View File

@@ -12,13 +12,15 @@ SUBSYSTEM_DEF(icon_smooth)
/datum/controller/subsystem/icon_smooth/fire()
var/list/cached = smooth_queue
while(cached.len)
var/atom/A = cached[cached.len]
while(length(cached))
var/atom/smoothing_atom = cached[length(cached)]
cached.len--
if (A.flags_1 & INITIALIZED_1)
smooth_icon(A)
if(QDELETED(smoothing_atom) || !(smoothing_atom.smooth & SMOOTH_QUEUED))
continue
if(smoothing_atom.flags_1 & INITIALIZED_1)
smooth_icon(smoothing_atom)
else
deferred += A
deferred += smoothing_atom
if (MC_TICK_CHECK)
return
@@ -27,27 +29,46 @@ SUBSYSTEM_DEF(icon_smooth)
smooth_queue = deferred
deferred = cached
else
can_fire = 0
can_fire = FALSE
/datum/controller/subsystem/icon_smooth/Initialize()
smooth_zlevel(1,TRUE)
smooth_zlevel(2,TRUE)
var/queue = smooth_queue
var/list/queue = smooth_queue
smooth_queue = list()
for(var/V in queue)
var/atom/A = V
if(!A || A.z <= 2)
while(length(queue))
var/atom/smoothing_atom = queue[length(queue)]
queue.len--
if(QDELETED(smoothing_atom) || !(smoothing_atom.smooth & SMOOTH_QUEUED) || smoothing_atom.z <= 2)
continue
smooth_icon(A)
smooth_icon(smoothing_atom)
CHECK_TICK
queue = blueprint_queue
blueprint_queue = list()
var/atom/movable/AM
var/turf/T
for(var/item in queue)
AM = item
T = AM.loc
if(T && AM)
T.add_blueprints(AM)
var/atom/movable/movable_item = item
if(!isturf(movable_item.loc))
continue
var/turf/item_loc = movable_item.loc
item_loc.add_blueprints(movable_item)
return ..()
/datum/controller/subsystem/icon_smooth/proc/add_to_queue(atom/thing)
if(thing.smooth & SMOOTH_QUEUED)
return
thing.smooth |= SMOOTH_QUEUED
smooth_queue += thing
if(!can_fire)
can_fire = TRUE
/datum/controller/subsystem/icon_smooth/proc/remove_from_queues(atom/thing)
thing &= ~SMOOTH_QUEUED
smooth_queue -= thing
blueprint_queue -= thing
deferred -= thing

View File

@@ -99,6 +99,20 @@
/// A luminescence-shifted value of the last color calculated for chatmessage overlays
var/chat_color_darkened
///Icon-smoothing behavior.
var/smooth = SMOOTH_FALSE
///Smoothing variable
var/top_left_corner
///Smoothing variable
var/top_right_corner
///Smoothing variable
var/bottom_left_corner
///Smoothing variable
var/bottom_right_corner
///Type path list this atom can smooth with. If this is null and atom is smooth, it smooths only with itself.
var/list/canSmoothWith = null
/**
* Called when an atom is created in byond (built in engine proc)
*
@@ -237,6 +251,9 @@
targeted_by = null
QDEL_NULL(light)
if(smooth & SMOOTH_QUEUED)
SSicon_smooth.remove_from_queues(src)
return ..()
/atom/proc/handle_ricochet(obj/projectile/P)
@@ -974,7 +991,7 @@
flags_1 |= ADMIN_SPAWNED_1
. = ..()
switch(var_name)
if(NAMEOF(src, color))
if("color")
add_atom_colour(color, ADMIN_COLOUR_PRIORITY)
/**
@@ -1289,15 +1306,13 @@
* * base_roll- Base wounding ability of an attack is a random number from 1 to (dealt_damage ** WOUND_DAMAGE_EXPONENT). This is the number that was rolled in there, before mods
*/
/proc/log_wound(atom/victim, datum/wound/suffered_wound, dealt_damage, dealt_wound_bonus, dealt_bare_wound_bonus, base_roll)
if(QDELETED(victim) || !suffered_wound)
return
var/message = "has suffered: [suffered_wound][suffered_wound.limb ? " to [suffered_wound.limb.name]" : null]"// maybe indicate if it's a promote/demote?
var/message = "has suffered: [suffered_wound] to [suffered_wound.limb.name]" // maybe indicate if it's a promote/demote?
if(dealt_damage)
message += " | Damage: [dealt_damage]"
// The base roll is useful since it can show how lucky someone got with the given attack. For example, dealing a cut
if(base_roll)
message += " (rolled [base_roll]/[dealt_damage ** WOUND_DAMAGE_EXPONENT])"
message += "(rolled [base_roll]/[dealt_damage ** WOUND_DAMAGE_EXPONENT])"
if(dealt_wound_bonus)
message += " | WB: [dealt_wound_bonus]"
@@ -1323,12 +1338,6 @@
arguments -= "priority"
filters += filter(arglist(arguments))
/obj/item/update_filters()
. = ..()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/atom/movable/proc/get_filter(name)
if(filter_data && filter_data[name])
return filters[filter_data.Find(name)]

View File

@@ -51,6 +51,8 @@
///Internal holder for emissive blocker object, do not use directly use blocks_emissive
var/atom/movable/emissive_blocker/em_block
///Used for the calculate_adjacencies proc for icon smoothing.
var/can_be_unanchored = FALSE
/atom/movable/Initialize(mapload)
. = ..()
@@ -62,9 +64,46 @@
em_block = new(src, render_target)
vis_contents += em_block
/atom/movable/Destroy()
/atom/movable/Destroy(force)
QDEL_NULL(proximity_monitor)
QDEL_NULL(language_holder)
QDEL_NULL(em_block)
return ..()
unbuckle_all_mobs(force = TRUE)
. = ..()
if(loc)
//Restore air flow if we were blocking it (movables with ATMOS_PASS_PROC will need to do this manually if necessary)
if(((CanAtmosPass == ATMOS_PASS_DENSITY && density) || CanAtmosPass == ATMOS_PASS_NO) && isturf(loc))
CanAtmosPass = ATMOS_PASS_YES
air_update_turf(TRUE)
loc.handle_atom_del(src)
// If we have opacity, make sure to tell (potentially) affected light sources.
if(opacity && isturf(loc))
var/turf/turf_loc = loc
var/old_has_opaque_atom = turf_loc.has_opaque_atom
turf_loc.recalc_atom_opacity()
if(old_has_opaque_atom != turf_loc.has_opaque_atom)
turf_loc.reconsider_lights()
for(var/movable_content in contents)
qdel(movable_content)
LAZYCLEARLIST(client_mobs_in_contents)
invisibility = INVISIBILITY_ABSTRACT
if(pulledby)
pulledby.stop_pulling()
if(orbiting)
orbiting.end_orbit(src)
orbiting = null
moveToNullspace()
/atom/movable/proc/update_emissive_block()
if(blocks_emissive != EMISSIVE_BLOCK_GENERIC)
@@ -127,25 +166,25 @@
if((var_name in careful_edits) && (var_value % world.icon_size) != 0)
return FALSE
switch(var_name)
if(NAMEOF(src, x))
if("x")
var/turf/T = locate(var_value, y, z)
if(T)
forceMove(T)
return TRUE
return FALSE
if(NAMEOF(src, y))
if("y")
var/turf/T = locate(x, var_value, z)
if(T)
forceMove(T)
return TRUE
return FALSE
if(NAMEOF(src, z))
if("z")
var/turf/T = locate(x, y, var_value)
if(T)
forceMove(T)
return TRUE
return FALSE
if(NAMEOF(src, loc))
if("loc")
if(istype(var_value, /atom))
forceMove(var_value)
return TRUE
@@ -396,30 +435,6 @@
return TRUE
/atom/movable/Destroy(force)
QDEL_NULL(proximity_monitor)
QDEL_NULL(language_holder)
unbuckle_all_mobs(force=1)
. = ..()
if(loc)
//Restore air flow if we were blocking it (movables with ATMOS_PASS_PROC will need to do this manually if necessary)
if(((CanAtmosPass == ATMOS_PASS_DENSITY && density) || CanAtmosPass == ATMOS_PASS_NO) && isturf(loc))
CanAtmosPass = ATMOS_PASS_YES
air_update_turf(TRUE)
loc.handle_atom_del(src)
for(var/atom/movable/AM in contents)
qdel(AM)
LAZYCLEARLIST(client_mobs_in_contents)
moveToNullspace()
invisibility = INVISIBILITY_ABSTRACT
if(pulledby)
pulledby.stop_pulling()
if(orbiting)
orbiting.end_orbit(src)
orbiting = null
// Make sure you know what you're doing if you call this, this is intended to only be called by byond directly.
// You probably want CanPass()

View File

@@ -1,6 +1,8 @@
GLOBAL_LIST_EMPTY(station_turfs)
/turf
icon = 'icons/turf/floors.dmi'
flags_1 = CAN_BE_DIRTY_1
vis_flags = VIS_INHERIT_ID|VIS_INHERIT_PLANE // Important for interaction with and visualization of openspace.
var/intact = 1
@@ -17,8 +19,6 @@ GLOBAL_LIST_EMPTY(station_turfs)
var/blocks_air = FALSE
flags_1 = CAN_BE_DIRTY_1
var/list/image/blueprint_data //for the station blueprints, images of objects eg: pipes
var/explosion_level = 0 //for preventing explosion dodging
@@ -34,7 +34,9 @@ GLOBAL_LIST_EMPTY(station_turfs)
var/tiled_dirt = FALSE // use smooth tiled dirt decal
vis_flags = VIS_INHERIT_ID|VIS_INHERIT_PLANE // Important for interaction with and visualization of openspace.
///Icon-smoothing variable to map a diagonal wall corner with a fixed underlay.
var/list/fixed_underlay = null
/turf/vv_edit_var(var_name, new_value)
var/static/list/banned_edits = list("x", "y", "z")

View File

@@ -48,15 +48,6 @@
else
light = new/datum/light_source(src, .)
// If we have opacity, make sure to tell (potentially) affected light sources.
/atom/movable/Destroy()
var/turf/T = loc
. = ..()
if (opacity && istype(T))
var/old_has_opaque_atom = T.has_opaque_atom
T.recalc_atom_opacity()
if (old_has_opaque_atom != T.has_opaque_atom)
T.reconsider_lights()
// Should always be used to change the opacity of an atom.
// It notifies (potentially) affected light sources so they can update (if needed).