Skip to content

Commit

Permalink
Merge pull request #3364 from MistakeNot4892/devupdate
Browse files Browse the repository at this point in the history
Dev update from staging
  • Loading branch information
MistakeNot4892 authored Sep 22, 2023
2 parents ca45da7 + c7ee45d commit a9ca78d
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 69 deletions.
19 changes: 19 additions & 0 deletions code/_helpers/matrices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@

return list(R + value,R,R,0, G,G + value,G,0, B,B,B + value,0, 0,0,0,1, 0,0,0,0)

#define LUMR 0.2126
#define LUMG 0.7152
#define LUMB 0.0722
/proc/legacy_color_saturation(value)
if(value == 0)
return
value = clamp(value, -100, 100)
if(value > 0)
value *= 3
var/x = 1 + value / 100
var/inv = 1 - x
var/R = LUMR * inv
var/G = LUMG * inv
var/B = LUMB * inv
return list(R + x,R,R, G,G + x,G, B,B,B + x)
#undef LUMR
#undef LUMG
#undef LUMB

/// Changes distance colors have from rgb(127,127,127) grey
/// * 1 is identity. 0 makes everything grey >1 blows out colors and greys
/proc/color_matrix_contrast(value)
Expand Down
5 changes: 2 additions & 3 deletions code/_helpers/medical_scans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@
scan["internal_organs"] += list(O)

scan["missing_organs"] = list()

var/decl/bodytype/root_bodytype = get_bodytype()
for(var/organ_name in root_bodytype.has_organ)
if(!locate(root_bodytype.has_organ[organ_name]) in internal_organs)
if(!GET_INTERNAL_ORGAN(H, organ_name))
scan["missing_organs"] += organ_name
if(H.sdisabilities & BLINDED)
scan["blind"] = TRUE
Expand Down Expand Up @@ -333,7 +332,7 @@
else
dat += subdat
for(var/organ_name in scan["missing_organs"])
if(organ_name != "appendix")
if(organ_name != BP_APPENDIX)
dat += "<tr><td colspan='3'><span class='bad'>No [organ_name] detected.</span></td></tr>"
else
dat += "<tr><td colspan='3'>No [organ_name] detected</td></tr>"
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
icon = 'icons/mob/screen1.dmi'
screen_loc = ui_entire_screen
icon_state = "druggy"
alpha = 127
alpha = 180
blend_mode = BLEND_MULTIPLY

/obj/screen/fullscreen/noise
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/instruments.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/guitar
name = "guitar"
desc = "An antique musical instrument made of wood, originating from Earth. It has six metal strings of different girth and tension. When moved, they vibrate and the waves resonate in the guitar's open body, producing sounds. Obtained notes can be altered by pressing the strings to the neck, affecting the vibration's frequency."
desc = "An antique musical instrument made of wood, originating from Earth. It has six metal strings of different girth and tension. When moved, they vibrate and the waves resonate in the guitar's open body, producing sounds. Obtained notes can be altered by pressing the strings to the neck, affecting the vibration's frequency."
icon = 'icons/obj/items/guitar.dmi'
icon_state = ICON_STATE_WORLD
material = /decl/material/solid/wood
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/client_color_definitions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@
)

/datum/client_color/oversaturated/New()
client_color = color_matrix_saturation(1.4)
client_color = legacy_color_saturation(40)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
#define MAXIMUM_SCIENCE_INTERVAL 900
#define MINIMUM_FOLDING_EVENT_INTERVAL 50
#define MAXIMUM_FOLDING_EVENT_INTERVAL 100
#define SCIENCE_MONEY_PER_MINUTE 0.08 // So little money.
#define SCIENCE_MONEY_PER_SECOND 0.08 // So little money.
#define PROGRAM_STATUS_CRASHED 0
#define PROGRAM_STATUS_RUNNING 1
#define PROGRAM_STATUS_RUNNING_WARM 2
#define PROGRAM_STATUS_RUNNING_SCALDING 3

/datum/computer_file/program/folding
filename = "fldng"
Expand All @@ -20,7 +24,7 @@
var/started_on = 0 // When the program started some science.
var/current_interval = 0 // How long the current interval will be.
var/next_event = 0 // in world timeofday, when the next event is scheduled to pop.
var/crashed = FALSE // Program periodically needs a restart.
var/program_status = PROGRAM_STATUS_RUNNING // Program periodically needs a restart, increases crash chance slightly over time.
var/crashed_at = 0 // When the program crashed.

/datum/computer_file/program/folding/Topic(href, href_list)
Expand All @@ -29,59 +33,64 @@
return
. = TOPIC_REFRESH

if(href_list["fix_crash"] && crashed)
current_interval += world.timeofday - crashed_at
crashed = FALSE
if(href_list["fix_crash"] && program_status == PROGRAM_STATUS_CRASHED)
started_on += world.timeofday - crashed_at
program_status = PROGRAM_STATUS_RUNNING

if(href_list["start"] && started_on == 0)
started_on = world.timeofday
current_interval = rand(MINIMUM_SCIENCE_INTERVAL, MAXIMUM_SCIENCE_INTERVAL) SECONDS
next_event = (rand(MINIMUM_FOLDING_EVENT_INTERVAL, MAXIMUM_FOLDING_EVENT_INTERVAL) SECONDS) + world.timeofday

if(href_list["collect"] && started_on > 0 && !crashed)
if(href_list["collect"] && started_on > 0 && program_status != PROGRAM_STATUS_CRASHED)
if(started_on + current_interval > world.timeofday)
return TOPIC_HANDLED // not ready to collect.
var/obj/item/card/id/I = usr.GetIdCard()
if(!I)
to_chat(usr, SPAN_WARNING("Unable to locate ID card for transaction."))
return TOPIC_HANDLED
var/datum/money_account/account = get_account(I.associated_account_number)
var/earned = current_interval * (SCIENCE_MONEY_PER_MINUTE * computer.get_processing_power())
var/earned = (current_interval / 10) * (SCIENCE_MONEY_PER_SECOND * computer.get_processing_power()) //Divide by 10 to convert from ticks to seconds
account.deposit(earned, "Completed FOLDING@SPACE project.")
to_chat(usr, SPAN_NOTICE("Transferred [earned] to your account."))
var/decl/currency/currency = GET_DECL(global.using_map.default_currency)
to_chat(usr, SPAN_NOTICE("Transferred [currency.format_value(earned)] to your account."))
started_on = 0
current_interval = 0

/datum/computer_file/program/folding/process_tick() //Every 50-100 seconds, gives you a 1/3 chance of the program crashing
/datum/computer_file/program/folding/process_tick() //Every 50-100 seconds, gives you a 1/3 chance of the program crashing.
. = ..()
if(!started_on)
return

if(world.timeofday < next_event) //Checks if it's time for the next crash chance
if(world.timeofday < next_event) //Checks if it's time for the next crash chance.
return
var/mob/living/holder = computer.holder.get_recursive_loc_of_type(/mob/living/carbon/human)
if(!crashed)
if(holder)
switch(rand(1,3)) //Gives 1/3 chance of crashing
if(1)
if(program_status > PROGRAM_STATUS_CRASHED)
if(PROGRAM_STATUS_RUNNING_SCALDING >= program_status)
switch(rand(PROGRAM_STATUS_RUNNING,program_status))
if(PROGRAM_STATUS_RUNNING) //Guaranteed 1 tick without crashing.
to_chat(holder, SPAN_WARNING("The [computer] starts to get very warm."))
if(2)
if (program_status == PROGRAM_STATUS_RUNNING)
program_status = PROGRAM_STATUS_RUNNING_WARM
if(PROGRAM_STATUS_RUNNING_WARM) //50% chance on subsequent ticks to make the program able to crash.
to_chat(holder, SPAN_WARNING("The [computer] gets scaldingly hot, burning you!"))
holder.take_overall_damage(0, 0.45)
if(3)
holder?.take_overall_damage(0, 0.45) //It checks holder? so that it doesn't cause a runtime error if no one is holding it.
if (program_status == PROGRAM_STATUS_RUNNING_WARM)
program_status = PROGRAM_STATUS_RUNNING_SCALDING
if(PROGRAM_STATUS_RUNNING_SCALDING) //1/3 chance on all following ticks for the program to crash.
to_chat(holder, SPAN_WARNING("The [computer] pings an error chime."))
crashed = TRUE
program_status = PROGRAM_STATUS_CRASHED
crashed_at = world.timeofday
else
crashed = TRUE
program_status = PROGRAM_STATUS_CRASHED
crashed_at = world.timeofday

next_event = (rand(MINIMUM_FOLDING_EVENT_INTERVAL, MAXIMUM_FOLDING_EVENT_INTERVAL) SECONDS) + world.timeofday //Sets the next crash chance 50-100 seconds from now

/datum/computer_file/program/folding/on_shutdown()
started_on = 0
current_interval = 0
crashed = FALSE
program_status = PROGRAM_STATUS_RUNNING
. = ..()

/datum/nano_module/program/folding
Expand Down Expand Up @@ -109,7 +118,7 @@
data["computing"] = !!prog.started_on
data["time_remaining"] = ((prog.started_on + prog.current_interval) - world.timeofday) / 10
data["completed"] = prog.started_on + prog.current_interval <= world.timeofday
data["crashed"] = prog.crashed
data["crashed"] = (prog.program_status <= PROGRAM_STATUS_CRASHED)
data["science_string"] = pick(science_strings)

ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open)
Expand Down
7 changes: 5 additions & 2 deletions code/modules/organs/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,11 @@
if(!splatter)
splatter = new decal_type(T)

var/obj/effect/decal/cleanable/blood/drip/drop = splatter
if(istype(drop) && drips && drips.len && !large)
if(QDELETED(splatter))
return

if(istype(splatter, /obj/effect/decal/cleanable/blood/drip) && drips && drips.len && !large)
var/obj/effect/decal/cleanable/blood/drip/drop = splatter
drop.overlays |= drips
drop.drips |= drips

Expand Down
2 changes: 2 additions & 0 deletions code/modules/projectiles/ammunition/boxes.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/obj/item/ammo_magazine/speedloader
name = "speed loader"
desc = "A speed loader for revolvers."
icon = 'icons/obj/ammo/speedloader.dmi'
icon_state = ICON_STATE_WORLD
caliber = CALIBER_PISTOL_MAGNUM
Expand Down
3 changes: 1 addition & 2 deletions code/modules/projectiles/guns/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,14 @@ var/global/list/registered_cyborg_weapons = list()

/obj/item/gun/energy/proc/update_charge_meter()
if(use_single_icon)
overlays += mutable_appearance(icon, "[get_world_inventory_state()][get_charge_ratio()]", indicator_color)
add_overlay(mutable_appearance(icon, "[get_world_inventory_state()][get_charge_ratio()]", indicator_color))
return
if(power_supply)
if(modifystate)
icon_state = "[modifystate][get_charge_ratio()]"
else
icon_state = "[initial(icon_state)][get_charge_ratio()]"


//For removable cells.
/obj/item/gun/energy/attack_hand(mob/user)
if(!user.is_holding_offhand(src) || isnull(accepts_cell_type) || isnull(power_supply) || !user.check_dexterity(DEXTERITY_HOLD_ITEM, TRUE))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/energy/laser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

/obj/item/gun/energy/laser/practice/on_update_icon()
. = ..()
overlays += mutable_appearance(icon, "[icon_state]_stripe", COLOR_ORANGE)
add_overlay(mutable_appearance(icon, "[icon_state]_stripe", COLOR_ORANGE))

/obj/item/gun/energy/laser/practice/proc/hacked()
return projectile_type != /obj/item/projectile/beam/practice
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/energy/secure.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

/obj/item/gun/energy/laser/secure/on_update_icon()
. = ..()
overlays += mutable_appearance(icon, "[icon_state]_stripe", COLOR_BLUE_GRAY)
add_overlay(mutable_appearance(icon, "[icon_state]_stripe", COLOR_BLUE_GRAY))
1 change: 0 additions & 1 deletion code/modules/projectiles/guns/launcher/pneumatic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
icon_state = "[get_world_inventory_state()]-tank"
else
icon_state = get_world_inventory_state()

update_held_icon()

/obj/item/gun/launcher/pneumatic/adjust_mob_overlay(var/mob/living/user_mob, var/bodytype, var/image/overlay, var/slot, var/bodypart)
Expand Down
17 changes: 7 additions & 10 deletions code/modules/projectiles/guns/magnetic/magnetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,23 @@

/obj/item/gun/magnetic/on_update_icon()
. = ..()
var/list/overlays_to_add = list()
if(removable_components)
if(cell)
overlays_to_add += image(icon, "[icon_state]_cell")
add_overlay("[icon_state]_cell")
if(capacitor)
overlays_to_add += image(icon, "[icon_state]_capacitor")
add_overlay(icon, "[icon_state]_capacitor")
if(!cell || !capacitor)
overlays_to_add += image(icon, "[icon_state]_red")
add_overlay(icon, "[icon_state]_red")
else if(capacitor.charge < power_cost)
overlays_to_add += image(icon, "[icon_state]_amber")
add_overlay(icon, "[icon_state]_amber")
else
overlays_to_add += image(icon, "[icon_state]_green")
add_overlay(icon, "[icon_state]_green")
if(loaded)
overlays_to_add += image(icon, "[icon_state]_loaded")
add_overlay(icon, "[icon_state]_loaded")
var/obj/item/magnetic_ammo/mag = loaded
if(istype(mag))
if(mag.remaining)
overlays_to_add += image(icon, "[icon_state]_ammo")

overlays += overlays_to_add
add_overlay(icon, "[icon_state]_ammo")

/obj/item/gun/magnetic/proc/show_ammo(var/mob/user)
if(loaded)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
/obj/item/gun/projectile/on_update_icon()
..()
if(ammo_indicator)
overlays += get_ammo_indicator()
add_overlay(get_ammo_indicator())

/obj/item/gun/projectile/proc/get_ammo_indicator()
var/base_state = get_world_inventory_state()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/projectile/automatic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/obj/item/gun/projectile/automatic/smg/on_update_icon()
..()
if(ammo_magazine)
overlays += image(icon, "[get_world_inventory_state()]mag-[round(ammo_magazine.stored_ammo.len,5)]")
add_overlay("[get_world_inventory_state()]mag-[round(length(ammo_magazine.stored_ammo),5)]")

/obj/item/gun/projectile/automatic/assault_rifle
name = "assault rifle"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/projectile/revolver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/obj/item/gun/projectile/revolver/capgun/on_update_icon()
. = ..()
if(cap)
overlays += image(icon, "[icon_state]-toy")
add_overlay("[icon_state]-toy")

/obj/item/gun/projectile/revolver/capgun/attackby(obj/item/wirecutters/W, mob/user)
if(!istype(W) || !cap)
Expand Down
15 changes: 7 additions & 8 deletions code/modules/surgery/_surgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var/global/list/surgery_tool_exception_cache = list()

/* SURGERY STEPS */
/decl/surgery_step
abstract_type = /decl/surgery_step
var/name
var/description
var/list/allowed_tools // type path referencing tools that can be used for this step, and how well are they suited for it
Expand All @@ -32,7 +33,9 @@ var/global/list/surgery_tool_exception_cache = list()
var/hidden_from_codex // Is this surgery a secret?
var/list/additional_codex_lines
var/expected_mob_type = /mob/living/carbon/human
abstract_type = /decl/surgery_step

/decl/surgery_step/proc/is_self_surgery_permitted(var/mob/target, var/bodypart)
return TRUE

/decl/surgery_step/validate()
. = ..()
Expand Down Expand Up @@ -226,8 +229,7 @@ var/global/list/surgery_tool_exception_cache = list()
var/list/all_surgeries = decls_repository.get_decls_of_subtype(/decl/surgery_step)
for(var/decl in all_surgeries)
var/decl/surgery_step/S = all_surgeries[decl]
if(S.name && S.tool_quality(src) && S.can_use(user, M, zone, src))

if(S.tool_quality(src) && S.can_use(user, M, zone, src) && (M != user || S.is_self_surgery_permitted(M, zone)))
var/image/radial_button = image(icon = icon, icon_state = icon_state)
radial_button.name = S.name
LAZYSET(possible_surgeries, S, radial_button)
Expand Down Expand Up @@ -307,11 +309,8 @@ var/global/list/surgery_tool_exception_cache = list()
. = OPERATE_DENY
if(. != OPERATE_DENY && M == user)
var/hitzone = check_zone(user.get_target_zone(), M)
var/list/badzones = list(BP_HEAD)
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(M, M.get_active_held_item_slot())
if(E)
badzones |= E.organ_tag
badzones |= E.parent_organ
if(hitzone in badzones)
if(E && (E.organ_tag == hitzone || E.parent_organ == hitzone))
to_chat(user, SPAN_WARNING("You can't operate on the same arm you're using to hold the surgical tool!"))
return OPERATE_DENY
. = min(., OPERATE_OKAY) // it's awkward no matter what
12 changes: 5 additions & 7 deletions code/modules/synthesized_instruments/event_manager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@
var/active = 0
var/kill_loop = 0


/datum/musical_event_manager/proc/push_event(datum/sound_player/source, datum/sound_token/token, time, volume)
if (istype(source) && istype(token) && volume >= 0 && volume <= 100)
src.events += new /datum/musical_event(source, token, time, volume)



/datum/musical_event_manager/proc/handle_events()
var/list/datum/musical_event/left_events = list()
while (1)
Expand All @@ -73,8 +70,6 @@

addtimer(CALLBACK(src, .proc/handle_events), 0)



/datum/musical_event_manager/proc/deactivate()
if (src.kill_loop) return 0
if (src.active) src.kill_loop = 1
Expand All @@ -85,6 +80,9 @@
src.suspended = 0
return 1


/datum/musical_event_manager/proc/is_overloaded()
return src.events.len > global.musical_config.max_events
return src.events.len > global.musical_config.max_events

/datum/musical_event_manager/Destroy()
deactivate()
return ..()
Loading

0 comments on commit a9ca78d

Please sign in to comment.