Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions code/controllers/subsystem/events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ SUBSYSTEM_DEF(events)
var/wizardmode = FALSE

/datum/controller/subsystem/events/Initialize()
for(var/type in typesof(/datum/round_event_control))
var/datum/round_event_control/event = new type()
// DARKPACK EDIT CHANGE START - EVENTS
for(var/datum/round_event_control/event_typepath as anything in valid_subtypesof(/datum/round_event_control))
if(!event_typepath::darkpack_allowed)
continue
var/datum/round_event_control/event = new event_typepath()
// DARKPACK EDIT CHANGE END
if(!event.typepath)
continue
if(!event.valid_for_map())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
overflow_control = locate(/datum/round_event_control/scrubber_overflow/every_vent) in SSevents.control

/obj/machinery/nuclearbomb/beer/Destroy()
UnregisterSignal(overflow_control, COMSIG_CREATED_ROUND_EVENT)
// DARKPACK EDIT CHANGE - this was causing runtimes as overflow_control is null if the associated event is not in SSevents
if(!isnull(overflow_control))
UnregisterSignal(overflow_control, COMSIG_CREATED_ROUND_EVENT)
// DARKPACK EDIT CHANGE END
. = ..()

/obj/machinery/nuclearbomb/beer/examine(mob/user)
Expand Down
2 changes: 2 additions & 0 deletions code/modules/events/_event.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
/// Flags dictating whether this event should be run on certain kinds of map
var/map_flags = NONE

var/darkpack_allowed = FALSE // DARKPACK EDIT ADD - EVENTS

/datum/round_event_control/New()
if(!length(admin_setup))
return
Expand Down
2 changes: 1 addition & 1 deletion config/game_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ DYNAMIC_CONFIG_ENABLED

## RANDOM EVENTS ###
## Comment this out to disable random events during the round.
#ALLOW_RANDOM_EVENTS
ALLOW_RANDOM_EVENTS

## Uncomment this to disable station traits.
#FORBID_STATION_TRAITS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@

/datum/station_trait/faulty_power_grid/on_round_start()
. = ..()
// Fuck I hate it, rework fusebox code
for(var/obj/fusebox/broken_box in world)
for(var/obj/fusebox/F in GLOB.fuseboxes)
if(prob(75))
continue
broken_box.damaged += rand(50, 200)
broken_box.check_damage()

F.take_damage(rand(50,200))
106 changes: 62 additions & 44 deletions modular_darkpack/modules/electricity/code/fusebox.dm
Comment thread
FalloutFalcon marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
GLOBAL_LIST_EMPTY(fuseboxes)

// The way this completely bypasses the entire power system is so strange
/obj/fusebox
name = "fuse box"
Expand All @@ -7,50 +9,68 @@
base_icon_state = "fusebox"
layer = SIGN_LAYER
anchored = TRUE
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
pixel_y = 32

max_integrity = 100
prevent_destruction = TRUE
//Damage on the fusebox
var/damaged = 0
//If our door is open/closed. bool
var/open = FALSE
Comment thread
chazzyjazzy marked this conversation as resolved.
//Repairing var for the loop
var/repairing = FALSE
//Soundloop for Transformers
var/datum/looping_sound/generator/soundloop

/obj/fusebox/Initialize(mapload)
. = ..()
GLOB.fuseboxes += src

/obj/fusebox/atom_destruction(damage_flag)
. = ..()
power_off()


//they shouldnt really ever be destroyed, but...
Comment thread
chazzyjazzy marked this conversation as resolved.
/obj/fusebox/Destroy()
GLOB.fuseboxes -= src
return ..()

/obj/fusebox/update_icon_state()
. = ..()
if(damaged > 100)
if(atom_integrity <= 0)
icon_state = "[base_icon_state]_off"
else
icon_state = base_icon_state

/obj/fusebox/proc/update_sound_state()
if(!isnull(soundloop))
if(damaged > 100)
if(atom_integrity <= 0)
soundloop.stop()
else
soundloop.start(src)

/obj/fusebox/proc/check_damage(mob/living/user)
if(damaged > 100 && !open)
open = TRUE
var/area/power_area = get_area(src)
power_area.power_light = FALSE
power_area.power_equip = FALSE
power_area.power_environ = FALSE
power_area.power_change()
power_area.fire_controled = FALSE
var/datum/effect_system/basic/spark_spread/local_spark = new(get_turf(src), 5, 1)
local_spark.start()
for(var/obj/machinery/light/L in power_area)
L.update(FALSE)
playsound(loc, 'modular_darkpack/modules/electricity/sounds/generator_break.ogg', 100, TRUE)
user?.electrocute_act(50, src, siemens_coeff = 1, flags = NONE)
/obj/fusebox/proc/power_off()
var/area/power_area = get_area(src)
power_area.power_light = FALSE
power_area.power_equip = FALSE
power_area.power_environ = FALSE
power_area.power_change()
power_area.fire_controled = FALSE
var/datum/effect_system/basic/spark_spread/local_spark = new(get_turf(src), 5, 1)
local_spark.start()
for(var/obj/machinery/light/L in power_area)
L.update(FALSE)
playsound(loc, 'modular_darkpack/modules/electricity/sounds/generator_break.ogg', 100, TRUE)
for(var/mob/living/M in range(1, src))
M.electrocute_act(50, src, siemens_coeff = 1, flags = NONE)
update_icon()
update_sound_state()

/datum/storyteller_roll/fusebox_repair
bumper_text = "electrical repair"
applicable_stats = list(STAT_INTELLIGENCE, STAT_TECHNOLOGY)
difficulty = 7
numerical = TRUE

/obj/fusebox/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(tool.tool_behaviour == TOOL_WIRECUTTER)
if(!repairing)
Expand All @@ -59,32 +79,31 @@
repairing = FALSE
return ITEM_INTERACT_BLOCKING

damaged = 0
update_icon_state()
update_sound_state()
playsound(get_turf(src),'modular_darkpack/modules/electricity/sounds/fusebox_fix.ogg', 50, FALSE)
var/area/power_area = get_area(src)
power_area.power_light = TRUE
power_area.power_equip = TRUE
power_area.power_environ = TRUE
power_area.power_change()
if(initial(power_area.fire_controled))
power_area.fire_controled = TRUE
for(var/obj/machinery/light/L in power_area)
L.update(FALSE)
var/datum/storyteller_roll/fusebox_repair/fusebox_roll = new()
var/successes = fusebox_roll.st_roll(user, src)
var/repair_amount = successes * 40
if(repair_amount > 0)
repair_damage(repair_amount)
update_icon_state()
update_sound_state()
playsound(get_turf(src), 'modular_darkpack/modules/electricity/sounds/fusebox_fix.ogg', 50, FALSE)
var/area/power_area = get_area(src)
power_area.power_light = TRUE
power_area.power_equip = TRUE
power_area.power_environ = TRUE
power_area.power_change()
if(initial(power_area.fire_controled))
power_area.fire_controled = TRUE
for(var/obj/machinery/light/L in power_area)
L.update(FALSE)

repairing = FALSE
return ITEM_INTERACT_SUCCESS
repairing = FALSE
return ITEM_INTERACT_SUCCESS
if(repair_amount <= 0)
user.electrocute_act(50, src, siemens_coeff = 1, flags = NONE)

return NONE

// This sucks. Snowflaking its own integrity system is always bad.
/obj/fusebox/attackby(obj/item/attacking_item, mob/user, list/modifiers, list/attack_modifiers)
. = ..()
if(attacking_item.force)
damaged += attacking_item.force
check_damage(user)

// transformers (another type of fusebox)
/obj/fusebox/transformer
name = "transformer"
Expand All @@ -96,4 +115,3 @@
/obj/fusebox/transformer/Initialize(mapload)
. = ..()
soundloop = new(src, TRUE)

2 changes: 2 additions & 0 deletions modular_darkpack/modules/events/attributions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
thank you to yfjesse on freesound.org for news_notification.ogg
https://freesound.org/people/yfjesse/sounds/235911/
4 changes: 4 additions & 0 deletions modular_darkpack/modules/events/code/_darkpack_event.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/round_event_control/darkpack
darkpack_allowed = TRUE

// note - no need for a /datum/round_event/darkpack subtype. they only fire if the above exists.
30 changes: 30 additions & 0 deletions modular_darkpack/modules/events/code/blackout_event.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/datum/round_event_control/darkpack/blackout
name = "Blackout"
typepath = /datum/round_event/blackout
weight = 6
min_players = 5
max_occurrences = 2
earliest_start = 10 MINUTES
category = EVENT_CATEGORY_ENGINEERING
description = "A cascading failure in the city's power grid."
darkpack_allowed = TRUE

/datum/round_event/blackout
start_when = 1
announce_when = 5

/datum/round_event/blackout/announce(fake)
priority_announce(
"A breaking news notification has appeared on your phone - rolling blackouts are affecting your area due to inclement weather.",
"Local BREAKING NEWS Alert",
'modular_darkpack/modules/events/sounds/news_notification.ogg',
ANNOUNCEMENT_TYPE_PRIORITY,
color_override = "red",
)

/datum/round_event/blackout/start()
for(var/obj/fusebox/F in GLOB.fuseboxes)
if(prob(50))
continue
F.take_damage(101)
F.power_off()
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
var/obj/fusebox/fuse = target

// Break the fusebox
fuse.damaged += 101
fuse.check_damage(owner, TRUE)
fuse.take_damage(101)
fuse.power_off()

var/datum/effect_system/basic/spark_spread/spark_system = new(get_turf(target), 5, 1)
spark_system.start()
Expand Down
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// DM Environment file for tgstation.dme.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\dwelling\code\objs\dwelling_window_defs.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\dwelling\code\areas\area_dwelling_instances.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\dwelling\code\area_dwelling.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\dwelling\code\obj_dwelling.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\dwelling\code\_dwelling_gvars_defines.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\latejoin_antagonists\code\latejoin_subsystem.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\economy\code\stocks_license.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\powers\code\discipline\mytherceria.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\powers\code\discipline\healer_valeren.dm.

Check failure on line 1 in tgstation.dme

View workflow job for this annotation

GitHub Actions / Run Linters / linters

Ticked File Enforcement

Missing include for modular_darkpack\modules\drugs\code\bloodpacks\bloodpack_adulteration.dm.
// All manual changes should be made outside the BEGIN_ and END_ blocks.
// New source code should be placed in .dm files: choose File/New --> Code File.

Expand Down Expand Up @@ -7221,6 +7221,8 @@
#include "modular_darkpack\modules\ert\code\outfits\first_team_outfits.dm"
#include "modular_darkpack\modules\ert\code\outfits\national_guard_outfits.dm"
#include "modular_darkpack\modules\ert\code\outfits\swat_outfits.dm"
#include "modular_darkpack\modules\events\code\_darkpack_event.dm"
#include "modular_darkpack\modules\events\code\blackout_event.dm"
#include "modular_darkpack\modules\external_organs\code\gargoyle_wings.dm"
#include "modular_darkpack\modules\external_organs\code\gargoyle_wings_sprite_accessory_datum.dm"
#include "modular_darkpack\modules\fire\code\fire.dm"
Expand Down
Loading