Skip to content

Commit d7e3fb9

Browse files
SantaKO1Dimach
authored andcommitted
add: Singulo and tesla now on NovaRat (#32)
1 parent 0fb40c7 commit d7e3fb9

27 files changed

+1162
-12
lines changed

code/__DEFINES/_flags.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
208208
/// Zaps with this flag will generate less power through tesla coils
209209
#define ZAP_LOW_POWER_GEN (1<<6)
210210

211-
#define ZAP_DEFAULT_FLAGS ZAP_MOB_STUN | ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE
211+
#define ZAP_DEFAULT_FLAGS ZAP_MOB_STUN | ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE | ZAP_GENERATES_POWER
212212
#define ZAP_FUSION_FLAGS ZAP_OBJ_DAMAGE | ZAP_MOB_DAMAGE | ZAP_MOB_STUN
213213
#define ZAP_SUPERMATTER_FLAGS ZAP_GENERATES_POWER
214214

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// CONSTRUCTION STATES
2+
#define PA_CONSTRUCTION_UNSECURED 0
3+
#define PA_CONSTRUCTION_UNWIRED 1
4+
#define PA_CONSTRUCTION_PANEL_OPEN 2
5+
#define PA_CONSTRUCTION_COMPLETE 3
6+
7+
// POWER STATES
8+
#define PARTICLE_STRENGTH_WEAK 0
9+
#define PARTICLE_STRENGTH_NORMAL 1
10+
#define PARTICLE_STRENGTH_STRONG 2
11+
#define PARTICLE_STRENGTH_MAX 3
12+
13+
#define ENERGY_REQ_SINGULARITY_CREATION 200
14+
15+
#define SINGULARITY_EFFECT_ANIM_TIME 62

code/datums/components/singularity.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
if (STAGE_ONE)
287287
steps = 1
288288
if (STAGE_TWO)
289-
steps = 3//Yes this is right
289+
steps = 2//Yes this is right
290290
if (STAGE_THREE)
291291
steps = 3
292292
if (STAGE_FOUR)

code/modules/power/singularity/field_generator.dm

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ no power level overlay is currently in the overlays list.
5252
///Check for asynk cleanups for this and the connected gens
5353
var/clean_up = FALSE
5454

55+
var/shield_floor = TRUE
5556
/datum/armor/field_generator
5657
melee = 25
5758
bullet = 10
@@ -337,7 +338,8 @@ no power level overlay is currently in the overlays list.
337338

338339
connected_gens |= found_generator
339340
found_generator.connected_gens |= src
340-
shield_floor(TRUE)
341+
if(shield_floor)
342+
shield_floor(TRUE)
341343
update_appearance()
342344

343345

code/modules/power/singularity/singularity.dm

+9-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
/// What the game tells ghosts when you make one
4949
var/ghost_notification_message = "IT'S LOOSE"
5050

51+
invisibility = INVISIBILITY_MAXIMUM
52+
5153
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE | PASSCLOSEDTURF | PASSMACHINE | PASSSTRUCTURE | PASSDOORS
5254
flags_1 = SUPERMATTER_IGNORES_1
5355
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | SHUTTLE_CRUSH_PROOF
@@ -56,6 +58,10 @@
5658
/obj/singularity/Initialize(mapload, starting_energy = 50)
5759
. = ..()
5860

61+
new /obj/effect/singularity_creation(loc)
62+
63+
addtimer(CALLBACK(src, PROC_REF(make_visible)), SINGULARITY_EFFECT_ANIM_TIME)
64+
5965
energy = starting_energy
6066

6167
START_PROCESSING(SSsinguloprocess, src)
@@ -165,13 +171,14 @@
165171
if(prob(event_chance))
166172
event()
167173
dissipate(seconds_per_tick)
174+
hawking_pulse(seconds_per_tick)
168175
check_energy()
169176

170177
/obj/singularity/proc/dissipate(seconds_per_tick)
171178
if (!dissipate)
172179
return
173180

174-
time_since_last_dissipiation += seconds_per_tick
181+
time_since_last_dissipiation += seconds_per_tick SECONDS
175182

176183
// Uses a while in case of especially long delta times
177184
while (time_since_last_dissipiation >= dissipate_delay)
@@ -449,7 +456,7 @@
449456
)
450457

451458
/obj/singularity/proc/emp_area()
452-
empulse(src, 8, 10)
459+
empulse(src, 5, 8)
453460

454461
/obj/singularity/singularity_act()
455462
var/gain = (energy/2)

code/modules/power/tesla/energy_ball.dm

+7
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@
236236
/obj/structure/lattice = FALSE,
237237
/obj/structure/grille = FALSE,
238238
/obj/structure/frame/machine = FALSE,
239+
/obj/machinery/particle_accelerator/control_box = FALSE,
240+
/obj/structure/particle_accelerator/fuel_chamber = FALSE,
241+
/obj/structure/particle_accelerator/particle_emitter/center = FALSE,
242+
/obj/structure/particle_accelerator/particle_emitter/left = FALSE,
243+
/obj/structure/particle_accelerator/particle_emitter/right = FALSE,
244+
/obj/structure/particle_accelerator/power_box = FALSE,
245+
/obj/structure/particle_accelerator/end_cap = FALSE,
239246
))
240247

241248
//Ok so we are making an assumption here. We assume that view() still calculates from the center out.

modular_nova/master_files/code/modules/research/techweb/all_nodes.dm

+6
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,9 @@
257257
"borg_upgrade_welding",
258258
)
259259
return ..()
260+
// ENGINEERING
261+
/datum/techweb_node/engineering/New()
262+
design_ids += list(
263+
"rad_collector",
264+
)
265+
return ..()

modular_nova/modules/aesthetics/emitter/code/emitter.dm

-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,3 @@
66

77
/obj/machinery/field/generator
88
icon = 'modular_nova/modules/aesthetics/emitter/icons/field_generator.dmi'
9-
10-
11-
/obj/machinery/power/rad_collector
12-
icon = 'modular_nova/modules/aesthetics/emitter/icons/emitter.dmi'
13-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/datum/export/large/collector
2+
cost = CARGO_CRATE_VALUE * 2
3+
unit_name = "radiation collector"
4+
export_types = list(/obj/machinery/power/energy_accumulator/rad_collector)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/datum/supply_pack/engine/collector
2+
name = "Radiation Collector Crate"
3+
desc = "Contains three radiation collectors. Useful for collecting energy off nearby Supermatter Crystals, Singularities or Teslas!"
4+
cost = CARGO_CRATE_VALUE * 8
5+
contains = list(
6+
/obj/machinery/power/energy_accumulator/rad_collector,
7+
/obj/machinery/power/energy_accumulator/rad_collector,
8+
/obj/machinery/power/energy_accumulator/rad_collector,
9+
)
10+
crate_name = "collector crate"
11+
12+
/datum/supply_pack/engine/particle_accelerator
13+
name = "Particle Accelerator Crate"
14+
desc = "A supermassive black hole or hyper-powered teslaball are the perfect way to spice up any party! This \"My First Apocalypse\" kit contains everything you need to build your own Particle Accelerator! Ages 10 and up."
15+
cost = 10000
16+
contains = list(/obj/structure/particle_accelerator/fuel_chamber,
17+
/obj/machinery/particle_accelerator/control_box,
18+
/obj/structure/particle_accelerator/particle_emitter/center,
19+
/obj/structure/particle_accelerator/particle_emitter/left,
20+
/obj/structure/particle_accelerator/particle_emitter/right,
21+
/obj/structure/particle_accelerator/power_box,
22+
/obj/structure/particle_accelerator/end_cap)
23+
crate_name = "particle accelerator crate"
24+
25+
/datum/supply_pack/engine/sing_gen
26+
name = "Singularity Generator Crate"
27+
desc = "The key to unlocking the power of Lord Singuloth. Particle Accelerator not included."
28+
cost = 25000
29+
contains = list(/obj/machinery/singularity_generator)
30+
crate_name = "singularity generator crate"
31+
32+
/datum/supply_pack/engine/tesla_gen
33+
name = "Tesla Generator Crate"
34+
desc = "The key to unlocking the power of the Tesla energy ball. Particle Accelerator not included."
35+
cost = 25000 // bullshit 25k
36+
contains = list(/obj/machinery/singularity_generator/tesla)
37+
crate_name = "tesla generator crate"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
//radiation needs to be over this amount to get power
2+
#define RAD_COLLECTOR_THRESHOLD 80
3+
//amount of joules created for each rad point over RAD_COLLECTOR_THRESHOLD
4+
#define RAD_COLLECTOR_COEFFICIENT 200
5+
6+
/obj/machinery/power/energy_accumulator/rad_collector
7+
name = "Hawking Radiation Collector Array"
8+
desc = "A device which uses hawking radiation generated from singularities and plasma to produce power."
9+
icon = 'modular_nova/modules/aesthetics/emitter/icons/emitter.dmi'
10+
icon_state = "ca"
11+
req_access = list(ACCESS_ENGINE_EQUIP, ACCESS_ATMOSPHERICS)
12+
max_integrity = 350
13+
integrity_failure = 0.2
14+
rad_insulation = RAD_EXTREME_INSULATION
15+
circuit = /obj/item/circuitboard/machine/rad_collector
16+
/// Stores the loaded tank instance
17+
var/obj/item/tank/internals/plasma/loaded_tank = null
18+
/// Is the collector working?
19+
var/active = FALSE
20+
/// Is the collector locked with an id?
21+
var/locked = FALSE
22+
/// Amount of gas removed per tick
23+
var/drain_ratio = 0.5
24+
/// Multiplier for the amount of gas removed per tick
25+
var/power_production_drain = 0.001
26+
/// Base efficiency
27+
var/efficiency_multiplier = 1.0
28+
29+
/obj/machinery/power/energy_accumulator/rad_collector/anchored
30+
anchored = TRUE
31+
32+
/obj/machinery/power/energy_accumulator/rad_collector/process(delta_time)
33+
if(!loaded_tank)
34+
return
35+
var/datum/gas_mixture/tank_mix = loaded_tank.return_air()
36+
if(!tank_mix.gases[/datum/gas/plasma])
37+
investigate_log("<font color='red'>out of fuel</font>.", INVESTIGATE_ENGINE)
38+
playsound(src, 'sound/machines/ding.ogg', 50, TRUE)
39+
eject()
40+
return
41+
var/gasdrained = min(power_production_drain * drain_ratio * delta_time, tank_mix.gases[/datum/gas/plasma][MOLES])
42+
tank_mix.gases[/datum/gas/plasma][MOLES] -= gasdrained
43+
tank_mix.assert_gas(/datum/gas/tritium)
44+
tank_mix.gases[/datum/gas/tritium][MOLES] += gasdrained
45+
tank_mix.garbage_collect()
46+
47+
. = ..()
48+
49+
/obj/machinery/power/energy_accumulator/rad_collector/interact(mob/user)
50+
if(!anchored)
51+
return
52+
if(locked)
53+
to_chat(user, span_warning("The controls are locked!"))
54+
return
55+
toggle_power()
56+
user.visible_message(span_notice("[user.name] turns the [src.name] [active? "on":"off"]."), \
57+
span_notice("You turn the [src.name] [active? "on":"off"]."))
58+
var/datum/gas_mixture/tank_mix = loaded_tank?.return_air()
59+
var/fuel
60+
if(loaded_tank)
61+
fuel = tank_mix.gases[/datum/gas/plasma]
62+
fuel = fuel ? fuel[MOLES] : 0
63+
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"<font color='red'>It is empty</font>"].", INVESTIGATE_ENGINE)
64+
65+
/obj/machinery/power/energy_accumulator/rad_collector/can_be_unfasten_wrench(mob/user, silent)
66+
if(!loaded_tank)
67+
return ..()
68+
if(!silent)
69+
to_chat(user, span_warning("Remove the plasma tank first!"))
70+
return FAILED_UNFASTEN
71+
72+
/obj/machinery/power/energy_accumulator/rad_collector/attackby(obj/item/item, mob/user, params)
73+
if(istype(item, /obj/item/tank/internals/plasma))
74+
if(!anchored)
75+
to_chat(user, span_warning("[src] needs to be secured to the floor first!"))
76+
return TRUE
77+
if(loaded_tank)
78+
to_chat(user, span_warning("There's already a plasma tank loaded!"))
79+
return TRUE
80+
if(panel_open)
81+
to_chat(user, span_warning("Close the maintenance panel first!"))
82+
return TRUE
83+
if(!user.transferItemToLoc(item, src))
84+
return
85+
loaded_tank = item
86+
update_appearance()
87+
else if(item.GetID())
88+
if(!allowed(user))
89+
to_chat(user, span_danger("Access denied."))
90+
return TRUE
91+
if(!active)
92+
to_chat(user, span_warning("The controls can only be locked when \the [src] is active!"))
93+
return TRUE
94+
locked = !locked
95+
to_chat(user, span_notice("You [locked ? "lock" : "unlock"] the controls."))
96+
return TRUE
97+
else
98+
return ..()
99+
100+
/obj/machinery/power/energy_accumulator/rad_collector/wrench_act(mob/living/user, obj/item/item)
101+
. = ..()
102+
default_unfasten_wrench(user, item)
103+
return TRUE
104+
105+
/obj/machinery/power/energy_accumulator/rad_collector/screwdriver_act(mob/living/user, obj/item/item)
106+
if(..())
107+
return TRUE
108+
if(!loaded_tank)
109+
default_deconstruction_screwdriver(user, icon_state, icon_state, item)
110+
return TRUE
111+
to_chat(user, span_warning("Remove the plasma tank first!"))
112+
return TRUE
113+
114+
/obj/machinery/power/energy_accumulator/rad_collector/crowbar_act(mob/living/user, obj/item/I)
115+
if(loaded_tank)
116+
if(!locked)
117+
eject()
118+
return TRUE
119+
to_chat(user, span_warning("The controls are locked!"))
120+
return TRUE
121+
if(default_deconstruction_crowbar(I))
122+
return TRUE
123+
to_chat(user, span_warning("There isn't a tank loaded!"))
124+
return TRUE
125+
126+
/obj/machinery/power/energy_accumulator/rad_collector/return_analyzable_air()
127+
if(!loaded_tank)
128+
return null
129+
return loaded_tank.return_analyzable_air()
130+
131+
/obj/machinery/power/energy_accumulator/rad_collector/examine(mob/user)
132+
. = ..()
133+
if(!active)
134+
. += span_notice("<b>[src]'s display displays the words:</b> \"Power production mode. Please insert <b>Plasma</b>.\"")
135+
. += span_notice("[src]'s display states that it has stored <b>[display_joules(get_stored_joules())]</b>, and is processing <b>[display_power(get_power_output())]</b>.")
136+
137+
/obj/machinery/power/energy_accumulator/rad_collector/atom_break(damage_flag)
138+
. = ..()
139+
if(.)
140+
eject()
141+
142+
/obj/machinery/power/energy_accumulator/rad_collector/RefreshParts()
143+
. = ..()
144+
145+
// Reset the upgrades to base values
146+
efficiency_multiplier = 1.0
147+
148+
// Calculate efficiency based on micro-laser parts
149+
for(var/datum/stock_part/micro_laser/laser in component_parts)
150+
efficiency_multiplier += (laser.tier - 1) * 0.2 // Each tier above 1 increases efficiency by 20%
151+
152+
/obj/machinery/power/energy_accumulator/rad_collector/proc/eject()
153+
locked = FALSE
154+
var/obj/item/tank/internals/plasma/tank = loaded_tank
155+
if (!tank)
156+
return
157+
tank.forceMove(drop_location())
158+
tank.layer = initial(tank.layer)
159+
tank.plane = initial(tank.plane)
160+
loaded_tank = null
161+
if(active)
162+
toggle_power()
163+
else
164+
update_appearance()
165+
166+
/obj/machinery/power/energy_accumulator/rad_collector/proc/hawking_pulse(atom/source, pulse_strength)
167+
if(loaded_tank && active && pulse_strength > RAD_COLLECTOR_THRESHOLD)
168+
// Adjust energy calculation based on efficiency multiplier
169+
stored_energy += joules_to_energy((pulse_strength - RAD_COLLECTOR_THRESHOLD) * RAD_COLLECTOR_COEFFICIENT * efficiency_multiplier)
170+
new /obj/effect/temp_visual/hawking_radiation(get_turf(src))
171+
172+
/obj/machinery/power/energy_accumulator/rad_collector/update_overlays()
173+
. = ..()
174+
if(loaded_tank)
175+
. += "ptank"
176+
if(machine_stat & (NOPOWER|BROKEN))
177+
return
178+
if(active)
179+
. += "on" // SKYRAT EDIT CHANGE - ORIGINAL. += loaded_tank ? "on" : "error"
180+
181+
/obj/machinery/power/energy_accumulator/rad_collector/proc/toggle_power()
182+
active = !active
183+
if(active)
184+
icon_state = "ca_on"
185+
flick("ca_active", src)
186+
else
187+
icon_state = "ca"
188+
flick("ca_deactive", src)
189+
update_appearance()
190+
return
191+
192+
#undef RAD_COLLECTOR_THRESHOLD
193+
#undef RAD_COLLECTOR_COEFFICIENT
194+
195+
196+
/obj/item/circuitboard/machine/rad_collector
197+
name = "Radiation Collector(hawking)"
198+
greyscale_colors = CIRCUIT_COLOR_ENGINEERING
199+
build_path = /obj/machinery/power/energy_accumulator/rad_collector
200+
req_components = list(
201+
/datum/stock_part/micro_laser = 1,
202+
/obj/item/stack/cable_coil = 2,
203+
/obj/item/stack/sheet/glass = 2)
204+
needs_anchored = FALSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/obj/machinery/door/airlock/external/glass/emp_proof
2+
name = "emp proof airlock"
3+
4+
/obj/machinery/door/airlock/external/glass/emp_proof/emp_act(severity)
5+
return
6+
7+
/obj/machinery/power/apc/auto_name/emp_proof
8+
name = "emp proof apc"
9+
10+
/obj/machinery/power/apc/auto_name/emp_proof/emp_act(severity)
11+
return
12+
13+
MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name/emp_proof, APC_PIXEL_OFFSET)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/datum/design/board/rad_collector
2+
name = "Machine Design (Radiation Collector Board)"
3+
desc = "The circuit board for a radiation collector array."
4+
id = "rad_collector"
5+
build_path = /obj/item/circuitboard/machine/rad_collector
6+
category = list ("Misc. Machinery")
7+
departmental_flags = DEPARTMENT_BITFLAG_ENGINEERING | DEPARTMENT_BITFLAG_SCIENCE

0 commit comments

Comments
 (0)