Skip to content

Commit

Permalink
setter density
Browse files Browse the repository at this point in the history
  • Loading branch information
Rerik007 committed Apr 12, 2024
1 parent ee85eef commit be7e008
Show file tree
Hide file tree
Showing 67 changed files with 154 additions and 160 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@
#define ZIMPACT_NO_MESSAGE (1<<1)
/// Do not do the spin animation when landing
#define ZIMPACT_NO_SPIN (1<<2)
///called when the movable sucessfully has it's density var changed, from base atom/set_density(): (value)
#define COMSIG_ATOM_SET_DENSITY "atom_set_density"
/////////////////

///from base of area/Entered(): (/area)
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/path.dm
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
if(!length(path_turfs))
return TRUE
var/obj/dummy = new(start_turf)
dummy.density = TRUE
dummy.set_density(TRUE)
if(flags)
dummy.pass_flags |= flags
for(var/turf/turf as anything in path_turfs)
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ Returns 1 if the chain up to the area contains the given typepath
// Spawn a new shuttle corner object
var/obj/corner = new()
corner.loc = X
corner.density = 1
corner.set_density(TRUE)
corner.set_anchored(TRUE)
corner.icon = X.icon
corner.icon_state = replacetext(X.icon_state, "_s", "_f")
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
spell.icon = overlay_icon
spell.icon_state = overlay_icon_state
spell.set_anchored(TRUE)
spell.density = FALSE
spell.set_density(FALSE)
spawn(overlay_lifespan)
qdel(spell)

Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
var/obj/effect/overlay/trail = new /obj/effect/overlay(projectile.loc)
trail.icon = proj_trail_icon
trail.icon_state = proj_trail_icon_state
trail.density = FALSE
trail.set_density(FALSE)
spawn(proj_trail_lifespan)
qdel(trail)

Expand Down
15 changes: 9 additions & 6 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1337,17 +1337,20 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
return t


/*
Setter for the `density` variable.
Arguments:
* new_value - the new density you would want it to set.
Returns: Either null if identical to existing density, or the new density if different.
*/
/**
* Setter for the `density` variable.
* Returns: Either null if identical to existing density, or the new density if different.
*
* Arguments:
* * new_value - the new density you would want it to set.
**/
/atom/proc/set_density(new_value)
SHOULD_CALL_PARENT(TRUE)
if(density == new_value)
return
. = density
density = new_value
SEND_SIGNAL(src, COMSIG_ATOM_SET_DENSITY, new_value)

// Процедура выбора правильного падежа для любого предмета,если у него указан словарь «ru_names», примерно такой:
// ru_names = list(NOMINATIVE = "челюсти жизни", GENITIVE = "челюстей жизни", DATIVE = "челюстям жизни", ACCUSATIVE = "челюсти жизни", INSTRUMENTAL = "челюстями жизни", PREPOSITIONAL = "челюстях жизни")
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/blob/theblob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@
return
var/obj/structure/blob/normal/B = new /obj/structure/blob/normal(src.loc, min(obj_integrity, 30))
B.color = a_color
B.density = 1
B.set_density(TRUE)
if(T.Enter(B,src))//Attempt to move into the tile
B.density = initial(B.density)
B.set_density(initial(B.density))
B.loc = T
else
T.blob_act()//If we cant move in hit the turf
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/cult/cult_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
return message

/obj/structure/cult/functional/cult_conceal()
density = FALSE
set_density(FALSE)
visible_message("<span class='danger'>[src] fades away.</span>")
invisibility = INVISIBILITY_HIDDEN_RUNES
alpha = 100 //To help ghosts distinguish hidden objs
Expand All @@ -134,7 +134,7 @@
update_light()

/obj/structure/cult/functional/cult_reveal()
density = initial(density)
set_density(initial(density))
invisibility = 0
visible_message("<span class='danger'>[src] suddenly appears!</span>")
alpha = initial(alpha)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/deployable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

/obj/structure/barricade/security/proc/deploy()
icon_state = "barrier1"
density = TRUE
set_density(TRUE)
set_anchored(TRUE)
if(deploy_message)
visible_message(span_warning("[src] deploys!"))
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ About the new airlock wires panel:
set_opacity(FALSE)
update_freelook_sight()
sleep(4)
density = FALSE
set_density(FALSE)
air_update_turf(TRUE)
sleep(1)
layer = OPEN_DOOR_LAYER
Expand Down Expand Up @@ -1331,7 +1331,7 @@ About the new airlock wires panel:
layer = CLOSED_DOOR_LAYER
if(!override)
sleep(1)
density = TRUE
set_density(TRUE)
air_update_turf(TRUE)
if(!override)
sleep(4)
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
..()

/obj/machinery/door/Destroy()
density = 0
set_density(FALSE)
air_update_turf(1)
update_freelook_sight()
GLOB.airlocks -= src
Expand Down Expand Up @@ -404,7 +404,7 @@
do_animate("opening")
set_opacity(FALSE)
sleep(0.5 SECONDS)
density = FALSE
set_density(FALSE)
sleep(0.5 SECONDS)
layer = initial(layer)
update_icon()
Expand Down Expand Up @@ -434,7 +434,7 @@
do_animate("closing")
layer = closingLayer
sleep(0.5 SECONDS)
density = TRUE
set_density(TRUE)
sleep(0.5 SECONDS)
update_icon()
if(visible && !glass)
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
debris += new /obj/item/stack/cable_coil(src, cable)

/obj/machinery/door/window/Destroy()
density = FALSE
set_density(FALSE)
QDEL_LIST(debris)
if(obj_integrity == 0)
playsound(src, "shatter", 70, 1)
Expand Down Expand Up @@ -171,7 +171,7 @@
update_icon()
sleep(1 SECONDS)

density = FALSE
set_density(FALSE)

air_update_turf(TRUE)
update_freelook_sight()
Expand All @@ -192,7 +192,7 @@
do_animate("closing")
playsound(loc, 'sound/machines/windowdoor.ogg', 100, TRUE)

density = TRUE
set_density(TRUE)
update_icon()
air_update_turf(TRUE)
update_freelook_sight()
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/mass_driver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
/obj/machinery/mass_driver/bumper/Bumped(atom/movable/moving_atom)
..()

density = 0
set_density(FALSE)
step(moving_atom, get_dir(moving_atom, src))
spawn(1)
density = 1
set_density(TRUE)
drive()
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/pipe/pipe_dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@
var/p_type = text2num(href_list["dmake"])
var/obj/structure/disposalconstruct/C = new(loc, p_type)
if(p_type in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE))
C.density = TRUE
C.set_density(TRUE)
2 changes: 1 addition & 1 deletion code/game/machinery/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ GLOBAL_LIST_EMPTY(turret_icons)
/obj/machinery/porta_turret/proc/set_raised_raising(var/is_raised, var/is_raising)
raised = is_raised
raising = is_raising
density = is_raised || is_raising
set_density(is_raised || is_raising)

/obj/machinery/porta_turret/proc/target(mob/living/target)
if(disabled)
Expand Down
16 changes: 7 additions & 9 deletions code/game/machinery/shieldgen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/obj/machinery/shield/Destroy()
opacity = FALSE
density = 0
set_density(FALSE)
air_update_turf(1)
return ..()

Expand Down Expand Up @@ -110,18 +110,16 @@
* The barrier itself is not intended to interact with the conceal runes cult spell for balance purposes.
*/
/obj/machinery/shield/cult/barrier/proc/Toggle()
var/visible
if(!density) // Currently invisible
density = TRUE // Turn visible
set_density(!density)
if(density)
invisibility = initial(invisibility)
visible = TRUE
else // Currently visible
density = FALSE // Turn invisible
. = TRUE
else
invisibility = INVISIBILITY_ABSTRACT
visible = FALSE
. = FALSE

air_update_turf(1)
return visible
return .

/obj/machinery/shieldgen
name = "Emergency shield projector"
Expand Down
22 changes: 11 additions & 11 deletions code/game/mecha/mecha_construction_paths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/ripley(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "ripley0"
const_holder.density = 1
const_holder.set_density(TRUE)
const_holder.overlays = null
qdel(src)
return
Expand Down Expand Up @@ -273,7 +273,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/gygax(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "gygax0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -546,7 +546,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/firefighter(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "fireripley0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -759,7 +759,7 @@
..("Honker")
var/obj/item/mecha_parts/chassis/const_holder = holder
const_holder.construct = new /datum/construction/reversible/mecha/honker(const_holder)
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -831,7 +831,7 @@
..("Reticence")
var/obj/item/mecha_parts/chassis/const_holder = holder
const_holder.construct = new /datum/construction/reversible/mecha/reticence(const_holder)
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -907,7 +907,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/durand(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "durand0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -1183,7 +1183,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/phazon(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "phazon0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -1500,7 +1500,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/odysseus(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "odysseus0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -1705,7 +1705,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/clarke(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "clarke0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -1908,7 +1908,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/rover(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "rover0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down Expand Up @@ -2182,7 +2182,7 @@
const_holder.construct = new /datum/construction/reversible/mecha/darkgygax(const_holder)
const_holder.icon = 'icons/obj/mecha/mech_construction.dmi'
const_holder.icon_state = "darkgygax0"
const_holder.density = 1
const_holder.set_density(TRUE)
qdel(src)
return

Expand Down
7 changes: 3 additions & 4 deletions code/game/objects/items/bodybag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@


/obj/structure/closet/body_bag/close()
if(..())
density = FALSE
return TRUE
return FALSE
. = ..()
if(.)
set_density(FALSE)


/obj/structure/closet/body_bag/update_icon_state()
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/items/devices/powersink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@
if(mode == OPERATING)
STOP_PROCESSING(SSobj, src)
set_anchored(FALSE)
density = FALSE
set_density(FALSE)

if(CLAMPED_OFF)
if(!attached)
return
if(mode == OPERATING)
STOP_PROCESSING(SSobj, src)
set_anchored(TRUE)
density = TRUE
set_density(TRUE)

if(OPERATING)
if(!attached)
return
START_PROCESSING(SSobj, src)
set_anchored(TRUE)
density = TRUE
set_density(TRUE)

mode = value
update_icon(UPDATE_ICON_STATE)
Expand Down
Loading

0 comments on commit be7e008

Please sign in to comment.