Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple runtime error fixes #2720

Merged
merged 30 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
05790cb
hopefully fixes forensics runtimes
MarkSuckerberg Feb 11, 2024
746b5e5
fixes vox index errors
MarkSuckerberg Feb 11, 2024
dd34210
hopefully fixes wet floor transfer
MarkSuckerberg Feb 11, 2024
4245e89
fixes blood dna not being present for blood overlays
MarkSuckerberg Feb 11, 2024
bac68c9
Beauty component improvements. Two new fantasy component prefixes (#5…
Ghommie Nov 10, 2020
4844bb2
Beauty is now an element. Fixing an issue with enter/exit area comsig…
Ghommie Feb 25, 2021
0f3bea6
Fixes mapspawned headpikes
ShizCalev Jul 10, 2020
8e3f571
fixes my errors
MarkSuckerberg Feb 11, 2024
a709714
fixes headpikes
MarkSuckerberg Feb 11, 2024
92f511d
fixes design disk ejection runtime
MarkSuckerberg Feb 11, 2024
a2e8b7c
fixes jumping to empty area runtime
MarkSuckerberg Feb 11, 2024
289cf16
fixes old-style proc refs
MarkSuckerberg Feb 11, 2024
16f3ede
fixes engine tile decompression metal spawn
MarkSuckerberg Feb 11, 2024
98881df
grr
MarkSuckerberg Feb 11, 2024
9d650df
oops
MarkSuckerberg Feb 15, 2024
cfcad82
ree
MarkSuckerberg Feb 15, 2024
76ddb87
aaaaaaaaa
MarkSuckerberg Feb 15, 2024
ff498bc
whuh
MarkSuckerberg Feb 15, 2024
ce3613b
oopsie heehee
MarkSuckerberg Feb 15, 2024
f5ce57b
fixes this annoying runtime
MarkSuckerberg Feb 22, 2024
d62dd0c
another fixie
MarkSuckerberg Feb 22, 2024
49dfacf
reorder this
MarkSuckerberg Feb 22, 2024
63f80df
fix for areas with no weather controller
MarkSuckerberg Feb 22, 2024
34f74bc
fixes minor pellet cloud error
MarkSuckerberg Feb 22, 2024
14a1155
another small rdconsole error
MarkSuckerberg Feb 22, 2024
83eb828
keyboard smash
MarkSuckerberg Feb 22, 2024
fde7663
I guess not
MarkSuckerberg Feb 22, 2024
d278214
lettuce try this
MarkSuckerberg Feb 23, 2024
11d592f
More fixes
MarkSuckerberg Feb 24, 2024
908a3a3
gough
MarkSuckerberg Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@

/////////////////

#define COMSIG_ENTER_AREA "enter_area" //from base of area/Entered(): (/area)
#define COMSIG_EXIT_AREA "exit_area" //from base of area/Exited(): (/area)
#define COMSIG_ENTER_AREA "enter_area" //from base of area/Entered(): (/area). Sent to "area-sensitive" movables, see __DEFINES/traits.dm for info.
#define COMSIG_EXIT_AREA "exit_area" //from base of area/Exited(): (/area). Sent to "area-sensitive" movables, see __DEFINES/traits.dm for info.

#define COMSIG_CLICK "atom_click" //from base of atom/Click(): (location, control, params, mob/user)
#define COMSIG_CLICK_SHIFT "shift_click" //from base of atom/ShiftClick(): (/mob)
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/important_recursive_contents.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
///the area channel of the important_recursive_contents list, everything in here will be sent a signal when their last holding object changes areas
#define RECURSIVE_CONTENTS_AREA_SENSITIVE "recursive_contents_area_sensitive"
///the hearing channel of the important_recursive_contents list, everything in here will count as a hearing atom
#define RECURSIVE_CONTENTS_HEARING_SENSITIVE "recursive_contents_hearing_sensitive"
10 changes: 10 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai

#define TRAIT_HEARING_SENSITIVE "hearing_sensitive"

/*
* Used for movables that need to be updated, via COMSIG_ENTER_AREA and COMSIG_EXIT_AREA, when transitioning areas.
* Use [/atom/movable/proc/become_area_sensitive(trait_source)] to properly enable it. How you remove it isn't as important.
*/
#define TRAIT_AREA_SENSITIVE "area-sensitive"

///Used for managing KEEP_TOGETHER in [/atom/var/appearance_flags]
#define TRAIT_KEEP_TOGETHER "keep-together"

// item traits
Expand Down Expand Up @@ -426,6 +433,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_FISH_CASE_COMPATIBILE "fish_case_compatibile"
/// Granted by prismwine
#define TRAIT_REFLECTIVE "reflective"
/// Self-explainatory.
#define BEAUTY_ELEMENT_TRAIT "beauty_element"
#define MOOD_COMPONENT_TRAIT "mood_component"

/// Trait granted by [mob/living/silicon/ai]
/// Applied when the ai anchors itself
Expand Down
11 changes: 11 additions & 0 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1558,3 +1558,14 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
return call(source, proctype)(arglist(arguments))

#define TURF_FROM_COORDS_LIST(List) (locate(List[1], List[2], List[3]))

/proc/normalize_dir_to_cardinals(dir)
if(dir & NORTH)
return NORTH
if(dir & SOUTH)
return SOUTH
if(dir & EAST)
return EAST
if(dir & WEST)
return WEST
return 0
38 changes: 0 additions & 38 deletions code/datums/components/beauty.dm

This file was deleted.

26 changes: 26 additions & 0 deletions code/datums/components/fantasy/prefixes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,29 @@
var/obj/item/master = comp.parent
comp.appliedComponents += master.AddComponent(/datum/component/lifesteal, comp.quality)
return "vampiric [newName]"

/datum/fantasy_affix/beautiful
placement = AFFIX_PREFIX
alignment = AFFIX_GOOD

/datum/fantasy_affix/beautiful/apply(datum/component/fantasy/comp, newName)
var/obj/item/master = comp.parent
master.AddElement(/datum/element/beauty, max(comp.quality, 1) * 250)
return "[pick("aesthetic", "beautiful", "gorgeous", "pretty")] [newName]"

/datum/fantasy_affix/beautiful/remove(datum/component/fantasy/comp)
var/obj/item/master = comp.parent
master.RemoveElement(/datum/element/beauty, max(comp.quality, 1) * 250)

/datum/fantasy_affix/ugly
placement = AFFIX_PREFIX
alignment = AFFIX_EVIL

/datum/fantasy_affix/ugly/apply(datum/component/fantasy/comp, newName)
var/obj/item/master = comp.parent
master.AddElement(/datum/element/beauty, min(comp.quality, -1) * 250)
return "[pick("fugly", "ugly", "grotesque", "hideous")] [newName]"

/datum/fantasy_affix/ugly/remove(datum/component/fantasy/comp)
var/obj/item/master = comp.parent
master.RemoveElement(/datum/element/beauty, min(comp.quality, -1) * 250)
4 changes: 4 additions & 0 deletions code/datums/components/mood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
RegisterSignal(parent, COMSIG_JOB_RECEIVED, PROC_REF(register_job_signals))

var/mob/living/owner = parent
owner.become_area_sensitive(MOOD_COMPONENT_TRAIT)
if(owner.hud_used)
modify_hud()
var/datum/hud/hud = owner.hud_used
Expand All @@ -35,6 +36,9 @@
/datum/component/mood/Destroy()
STOP_PROCESSING(SSmood, src)
unmodify_hud()

var/mob/living/owner = parent
owner.lose_area_sensitivity(MOOD_COMPONENT_TRAIT)
return ..()

/datum/component/mood/proc/register_job_signals(datum/source, job)
Expand Down
6 changes: 3 additions & 3 deletions code/datums/components/pellet_cloud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
var/list/pellets = list()
/// An associated list with the atom hit as the key and how many pellets they've eaten for the value, for printing aggregate messages
var/list/targets_hit = list()
/// For grenades, any /mob/living's the grenade is moved onto, see [/datum/component/pellet_cloud/proc/handle_martyrs()]
/// LAZY LIST. For grenades, any /mob/living's the grenade is moved onto, see [/datum/component/pellet_cloud/proc/handle_martyrs()]
var/list/bodies
/// For grenades, tracking people who die covering a grenade for achievement purposes, see [/datum/component/pellet_cloud/proc/handle_martyrs()]
var/list/purple_hearts
Expand Down Expand Up @@ -65,7 +65,7 @@
purple_hearts = null
pellets = null
targets_hit = null
bodies = null
LAZYNULL(bodies)
return ..()

/datum/component/pellet_cloud/RegisterWithParent()
Expand Down Expand Up @@ -288,5 +288,5 @@
/datum/component/pellet_cloud/proc/on_target_qdel(atom/target)
UnregisterSignal(target, COMSIG_PARENT_QDELETING)
targets_hit -= target
LAZYREMOVE(target, bodies)
LAZYREMOVE(bodies, target)
purple_hearts -= target
2 changes: 1 addition & 1 deletion code/datums/components/weatherannouncer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

/datum/component/weather_announcer/proc/time_till_storm()
var/datum/weather_controller/local_weather_controller = SSmapping.get_map_zone_weather_controller(parent)
if(!local_weather_controller.next_weather)
if(!local_weather_controller?.next_weather)
return null
for(var/type_index in local_weather_controller.current_weathers)
var/datum/weather/check_weather = local_weather_controller.current_weathers[type_index]
Expand Down
76 changes: 76 additions & 0 deletions code/datums/elements/beauty.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Beauty element. It makes the indoor area the parent is in prettier or uglier depending on the beauty var value.
* Clean and well decorated areas lead to positive moodlets for passerbies;
* Shabbier, dirtier ones lead to negative moodlets EXCLUSIVE to characters with the snob quirk.
*/
/datum/element/beauty
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
id_arg_index = 2
var/beauty = 0
/**
* Assoc list of atoms as keys and number of time the same element instance has been attached to them as assoc value.
* So things don't get odd with same-valued yet dissimilar beauty modifiers being added to the same atom.
*/
var/beauty_counter = list()

/datum/element/beauty/Attach(datum/target, beauty)
. = ..()
if(!isatom(target) || isarea(target))
return ELEMENT_INCOMPATIBLE

src.beauty = beauty

if(!beauty_counter[target] && ismovable(target))
var/atom/movable/mov_target = target
mov_target.become_area_sensitive(BEAUTY_ELEMENT_TRAIT)
RegisterSignal(mov_target, COMSIG_ENTER_AREA, PROC_REF(enter_area))
RegisterSignal(mov_target, COMSIG_EXIT_AREA, PROC_REF(exit_area))

beauty_counter[target]++

var/area/current_area = get_area(target)
if(current_area && !current_area.outdoors)
current_area.totalbeauty += beauty
current_area.update_beauty()

/datum/element/beauty/proc/enter_area(datum/source, area/new_area)
SIGNAL_HANDLER

if(new_area.outdoors)
return
new_area.totalbeauty += beauty * beauty_counter[source]
new_area.update_beauty()

/datum/element/beauty/proc/exit_area(datum/source, area/old_area)
SIGNAL_HANDLER

if(old_area.outdoors)
return
old_area.totalbeauty -= beauty * beauty_counter[source]
old_area.update_beauty()

/datum/element/beauty/Detach(datum/source)
if(!beauty_counter[source])
return ..()
var/area/current_area = get_area(source)
if(QDELETED(source))
. = ..()
UnregisterSignal(source, list(COMSIG_ENTER_AREA, COMSIG_EXIT_AREA))
if(current_area)
exit_area(source, current_area)
beauty_counter -= source
var/atom/movable/movable_source = source
if(istype(movable_source))
movable_source.lose_area_sensitivity(BEAUTY_ELEMENT_TRAIT)
else //lower the 'counter' down by one, update the area, and call parent if it's reached zero.
beauty_counter[source]--
if(current_area && !current_area.outdoors)
current_area.totalbeauty -= beauty
current_area.update_beauty()
if(!beauty_counter[source])
. = ..()
UnregisterSignal(source, list(COMSIG_ENTER_AREA, COMSIG_EXIT_AREA))
beauty_counter -= source
var/atom/movable/movable_source = source
if(istype(movable_source))
movable_source.lose_area_sensitivity(BEAUTY_ELEMENT_TRAIT)
7 changes: 5 additions & 2 deletions code/datums/materials/_material.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Simple datum which is instanced once per type and is used for every object of sa
source.name = "[name] [source.name]"

if(beauty_modifier)
addtimer(CALLBACK(source, TYPE_PROC_REF(/datum, _AddComponent), list(/datum/component/beauty, beauty_modifier * amount)), 0)
source.AddElement(/datum/element/beauty, beauty_modifier * amount)

if(istype(source, /obj)) //objs
on_applied_obj(source, amount, material_flags)
Expand Down Expand Up @@ -121,7 +121,7 @@ Simple datum which is instanced once per type and is used for every object of sa
return

///This proc is called when the material is removed from an object.
/datum/material/proc/on_removed(atom/source, material_flags)
/datum/material/proc/on_removed(atom/source, amount, material_flags)
if(material_flags & MATERIAL_COLOR) //Prevent changing things with pre-set colors, to keep colored toolboxes their looks for example
if(color)
source.remove_atom_colour(FIXED_COLOUR_PRIORITY, color)
Expand All @@ -133,6 +133,9 @@ Simple datum which is instanced once per type and is used for every object of sa
if(material_flags & MATERIAL_ADD_PREFIX)
source.name = initial(source.name)

if(beauty_modifier)
source.RemoveElement(/datum/element/beauty, beauty_modifier * amount)

if(istype(source, /obj)) //objs
on_removed_obj(source, material_flags)

Expand Down
4 changes: 2 additions & 2 deletions code/datums/materials/basemats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Unless you know what you're doing, only use the first three numbers. They're in
. = ..()
source.AddComponent(/datum/component/radioactive, amount / 20, source, 0) //half-life of 0 because we keep on going.

/datum/material/uranium/on_removed(atom/source, material_flags)
/datum/material/uranium/on_removed(atom/source, amount, material_flags)
. = ..()
qdel(source.GetComponent(/datum/component/radioactive))

Expand All @@ -109,7 +109,7 @@ Unless you know what you're doing, only use the first three numbers. They're in
source.AddElement(/datum/element/firestacker, amount=1)
source.AddComponent(/datum/component/explodable, 0, 0, amount / 2500, amount / 1250)

/datum/material/plasma/on_removed(atom/source, material_flags)
/datum/material/plasma/on_removed(atom/source, amount, material_flags)
. = ..()
source.RemoveElement(/datum/element/firestacker, amount=1)
qdel(source.GetComponent(/datum/component/explodable))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/materials/meat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
turf_sound_override = FOOTSTEP_MEAT
texture_layer_icon_state = "meat"

/datum/material/meat/on_removed(atom/source, material_flags)
/datum/material/meat/on_removed(atom/source, amount, material_flags)
. = ..()
qdel(source.GetComponent(/datum/component/edible))

Expand Down
2 changes: 1 addition & 1 deletion code/datums/materials/pizza.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
turf_sound_override = FOOTSTEP_MEAT
texture_layer_icon_state = "pizza"

/datum/material/pizza/on_removed(atom/source, material_flags)
/datum/material/pizza/on_removed(atom/source, amount, material_flags)
. = ..()
qdel(source.GetComponent(/datum/component/edible))

Expand Down
22 changes: 14 additions & 8 deletions code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -575,18 +575,21 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/**
* Call back when an atom enters an area
*
* Sends signals COMSIG_AREA_ENTERED and COMSIG_ENTER_AREA (to the atom)
* Sends signals COMSIG_AREA_ENTERED and COMSIG_ENTER_AREA (to a list of atoms)
*
* If the area has ambience, then it plays some ambience music to the ambience channel
*/
/area/Entered(atom/movable/M, area/old_area)
/area/Entered(atom/movable/arrived, area/old_area)
set waitfor = FALSE
SEND_SIGNAL(src, COMSIG_AREA_ENTERED, M, old_area)
SEND_SIGNAL(M, COMSIG_ENTER_AREA, src) //The atom that enters the area
if(!isliving(M))
SEND_SIGNAL(src, COMSIG_AREA_ENTERED, arrived, old_area)
if(!LAZYACCESS(arrived.important_recursive_contents, RECURSIVE_CONTENTS_AREA_SENSITIVE))
return
for(var/atom/movable/recipient as anything in arrived.important_recursive_contents[RECURSIVE_CONTENTS_AREA_SENSITIVE])
SEND_SIGNAL(recipient, COMSIG_ENTER_AREA, src)
if(!isliving(arrived))
return

var/mob/living/L = M
var/mob/living/L = arrived
if(!L.ckey)
return

Expand All @@ -608,11 +611,14 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/**
* Called when an atom exits an area
*
* Sends signals COMSIG_AREA_EXITED and COMSIG_EXIT_AREA (to the atom)
* Sends signals COMSIG_AREA_EXITED and COMSIG_EXIT_AREA (to a list of atoms)
*/
/area/Exited(atom/movable/gone, direction)
SEND_SIGNAL(src, COMSIG_AREA_EXITED, gone, direction)
SEND_SIGNAL(gone, COMSIG_EXIT_AREA, src) //The atom that exits the area
if(!LAZYACCESS(gone.important_recursive_contents, RECURSIVE_CONTENTS_AREA_SENSITIVE))
return
for(var/atom/movable/recipient as anything in gone.important_recursive_contents[RECURSIVE_CONTENTS_AREA_SENSITIVE])
SEND_SIGNAL(recipient, COMSIG_EXIT_AREA, src)


/**
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@
if(custom_materials) //Only runs if custom materials existed at first. Should usually be the case but check anyways
for(var/i in custom_materials)
var/datum/material/custom_material = SSmaterials.GetMaterialRef(i)
custom_material.on_removed(src, material_flags) //Remove the current materials
custom_material.on_removed(src, custom_materials[i] * material_modifier, material_flags) //Remove the current materials

if(!length(materials))
return
Expand Down
Loading
Loading