Fixes turf_decal layering
This commit is contained in:
committed by
CitadelStationBot
parent
36234e94d4
commit
88e7e8d2cb
@@ -13,6 +13,7 @@
|
||||
//#define TURF_LAYER 2 //For easy recordkeeping; this is a byond define
|
||||
#define MID_TURF_LAYER 2.02
|
||||
#define HIGH_TURF_LAYER 2.03
|
||||
#define TURF_DECAL_LAYER 2.039 //Makes turf decals appear in DM how they will look inworld.
|
||||
#define ABOVE_OPEN_TURF_LAYER 2.04
|
||||
#define CLOSED_TURF_LAYER 2.05
|
||||
#define BULLET_HOLE_LAYER 2.06
|
||||
@@ -20,7 +21,6 @@
|
||||
#define LATTICE_LAYER 2.2
|
||||
#define DISPOSAL_PIPE_LAYER 2.3
|
||||
#define GAS_PIPE_HIDDEN_LAYER 2.35
|
||||
#define TURF_DECAL_LAYER 2.39
|
||||
#define WIRE_LAYER 2.4
|
||||
#define WIRE_TERMINAL_LAYER 2.45
|
||||
#define GAS_SCRUBBER_LAYER 2.46
|
||||
|
||||
53
code/datums/components/decal.dm
Normal file
53
code/datums/components/decal.dm
Normal file
@@ -0,0 +1,53 @@
|
||||
/datum/component/decal
|
||||
dupe_mode = COMPONENT_DUPE_ALLOWED
|
||||
|
||||
var/cleanable
|
||||
var/mutable_appearance/pic
|
||||
|
||||
/datum/component/decal/Initialize(_icon, _icon_state, _dir, _cleanable=CLEAN_GOD, _color, _layer=TURF_LAYER)
|
||||
if(!isatom(parent) || !_icon || !_icon_state)
|
||||
. = COMPONENT_INCOMPATIBLE
|
||||
CRASH("A turf decal was applied incorrectly to [parent.type]: icon:[_icon ? _icon : "none"] icon_state:[_icon_state ? _icon_state : "none"]")
|
||||
|
||||
// It has to be made from an image or dir breaks because of a byond bug
|
||||
var/temp_image = image(_icon, null, _icon_state, _layer, _dir)
|
||||
pic = new(temp_image)
|
||||
pic.color = _color
|
||||
|
||||
cleanable = _cleanable
|
||||
|
||||
apply()
|
||||
|
||||
if(_dir) // If no dir is assigned at start then it follows the atom's dir
|
||||
RegisterSignal(COMSIG_ATOM_DIR_CHANGE, .proc/rotate_react)
|
||||
if(_cleanable)
|
||||
RegisterSignal(COMSIG_COMPONENT_CLEAN_ACT, .proc/clean_react)
|
||||
|
||||
/datum/component/decal/Destroy()
|
||||
remove()
|
||||
return ..()
|
||||
|
||||
/datum/component/decal/OnTransfer(atom/thing)
|
||||
remove()
|
||||
remove(thing)
|
||||
apply(thing)
|
||||
|
||||
/datum/component/decal/proc/apply(atom/thing)
|
||||
var/atom/master = thing || parent
|
||||
master.add_overlay(pic, TRUE)
|
||||
|
||||
/datum/component/decal/proc/remove(atom/thing)
|
||||
var/atom/master = thing || parent
|
||||
master.cut_overlay(pic, TRUE)
|
||||
|
||||
/datum/component/decal/proc/rotate_react(old_dir, new_dir)
|
||||
if(old_dir == new_dir)
|
||||
return
|
||||
remove()
|
||||
var/rotation = SimplifyDegrees(dir2angle(new_dir)-dir2angle(old_dir))
|
||||
pic.dir = turn(pic.dir, rotation)
|
||||
apply()
|
||||
|
||||
/datum/component/decal/proc/clean_react(strength)
|
||||
if(strength >= cleanable)
|
||||
qdel(src)
|
||||
@@ -20,6 +20,7 @@
|
||||
/obj/effect/turf_decal
|
||||
icon = 'icons/turf/decals.dmi'
|
||||
icon_state = "warningline"
|
||||
layer = TURF_DECAL_LAYER
|
||||
|
||||
/obj/effect/turf_decal/Initialize()
|
||||
..()
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
var/static/list/dent_decal_list = list(
|
||||
WALL_DENT_HIT = list(
|
||||
mutable_appearance('icons/effects/effects.dmi', "impact1", TURF_DECAL_LAYER),
|
||||
mutable_appearance('icons/effects/effects.dmi', "impact2", TURF_DECAL_LAYER),
|
||||
mutable_appearance('icons/effects/effects.dmi', "impact3", TURF_DECAL_LAYER)
|
||||
mutable_appearance('icons/effects/effects.dmi', "impact1", BULLET_HOLE_LAYER),
|
||||
mutable_appearance('icons/effects/effects.dmi', "impact2", BULLET_HOLE_LAYER),
|
||||
mutable_appearance('icons/effects/effects.dmi', "impact3", BULLET_HOLE_LAYER)
|
||||
),
|
||||
WALL_DENT_SHOT = list(
|
||||
mutable_appearance('icons/effects/effects.dmi', "bullet_hole", TURF_DECAL_LAYER)
|
||||
mutable_appearance('icons/effects/effects.dmi', "bullet_hole", BULLET_HOLE_LAYER)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user