mirror of
https://github.com/KabKebab/GS13.git
synced 2026-07-11 07:59:08 +01:00
Merge pull request #618 from ArchieBeepBoop/funnygenerator
TEG Power Feedback, Runtime and Engine Weights
This commit is contained in:
@@ -11,7 +11,26 @@
|
||||
var/lastgen = 0
|
||||
var/lastgenlev = -1
|
||||
var/lastcirc = "00"
|
||||
|
||||
var/overloaded = 0
|
||||
var/running = 0
|
||||
var/boost = 0
|
||||
var/grump = 0 // best var 2013
|
||||
var/grumping = 0 // is the engine currently doing grumpy things
|
||||
var/list/grump_prefix = list("an upsetting", "an unsettling",
|
||||
"a scary", "a loud", "a sassy", "a grouchy", "a grumpy",
|
||||
"an awful", "a horrible", "a despicable", "a pretty rad", "a godawful")
|
||||
var/list/grump_suffix = list("noise", "racket", "ruckus", "sound", "clatter", "fracas", "hubbub")
|
||||
var/sound_engine1 = 'sound/machines/tractor_running.ogg'
|
||||
var/sound_engine2 = 'sound/machines/engine_highpower.ogg'
|
||||
var/sound_tractorrev = 'sound/machines/tractorrev.ogg'
|
||||
var/sound_engine_alert1 = 'sound/machines/engine_alert1.ogg'
|
||||
var/sound_engine_alert2 = 'sound/machines/engine_alert2.ogg'
|
||||
var/sound_engine_alert3 = 'sound/machines/engine_alert3.ogg'
|
||||
var/sound_bigzap = 'sound/effects/elec_bigzap.ogg'
|
||||
var/sound_bellalert = 'sound/machines/bellalert.ogg'
|
||||
var/sound_warningbuzzer = 'sound/machines/warning-buzzer.ogg'
|
||||
var/list/sounds_engine = list(sound('sound/machines/tractor_running2.ogg'),sound('sound/machines/tractor_running3.ogg'))
|
||||
var/list/sounds_enginegrump = list(sound('sound/machines/engine_grump1.ogg'),sound('sound/machines/engine_grump2.ogg'),sound('sound/machines/engine_grump3.ogg'),sound('sound/machines/engine_grump4.ogg'))
|
||||
|
||||
/obj/machinery/power/generator/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -101,6 +120,108 @@
|
||||
add_avail(power_output)
|
||||
lastgenlev = power_output
|
||||
lastgen -= power_output
|
||||
if (lastgenlev > 0)
|
||||
if(grump < 0) // grumpcode
|
||||
grump = 0 // no negative grump plz
|
||||
grump++ // get grump'd
|
||||
if(grump >= 100 && prob(5))
|
||||
playsound(src.loc, pick(sounds_enginegrump), 70, 0)
|
||||
src.visible_message("<span class='alert'>[src] makes [pick(grump_prefix)] [pick(grump_suffix)]!</span>")
|
||||
grump -= 5
|
||||
if(!running)
|
||||
playsound(src.loc, sound_tractorrev, 55, 0)
|
||||
running = 1
|
||||
else
|
||||
running = 0
|
||||
var/genlev = (lastgenlev/1000000)
|
||||
switch(genlev)
|
||||
if(0)
|
||||
return
|
||||
if(0.2 to 1)
|
||||
playsound(src.loc, sound_engine1, 60, 0)
|
||||
if(prob(5))
|
||||
playsound(src.loc, pick(sounds_engine), 70, 0)
|
||||
if(1 to 10)
|
||||
playsound(src.loc, sound_engine1, 60, 0)
|
||||
if(11 to 100)
|
||||
playsound(src.loc, sound_engine2, 60, 0)
|
||||
if(101 to 500)
|
||||
playsound(src.loc, sound_bellalert, 60, 0)
|
||||
if(prob(5))
|
||||
do_sparks(5,FALSE,src)
|
||||
if(501 to 1000)
|
||||
playsound(src.loc, sound_warningbuzzer, 50, 0)
|
||||
if (prob(5))
|
||||
src.visible_message("<span class='alert'>[src] starts smoking!</span>")
|
||||
if (!grumping && grump >= 100 && prob(5))
|
||||
grumping = 1
|
||||
playsound(src.loc, "sound/machines/engine_grump1.ogg", 50, 0)
|
||||
grumping = 0
|
||||
grump -= 10
|
||||
if(1001 to 5000)
|
||||
if (prob(5))
|
||||
playsound(src.loc, sound_engine_alert1, 55, 0)
|
||||
if (prob(5))
|
||||
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, 1, extrarange = 10)
|
||||
zapStuff(src, 5, min(genlev, 20000))
|
||||
if (!grumping && grump >= 100 && prob(5))
|
||||
grumping = 1
|
||||
playsound(src.loc, "sound/machines/engine_grump1.ogg", 50, 0)
|
||||
grumping = 0
|
||||
grump -= 30
|
||||
|
||||
if(5001 to 10000)
|
||||
if (prob(15))
|
||||
playsound(src.loc, sound_engine_alert2, 55, 0)
|
||||
if (prob(10)) // lowering a bit more
|
||||
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, 1, extrarange = 10)
|
||||
zapStuff(src, 5, min(genlev, 20000))
|
||||
if (prob(5))
|
||||
src.visible_message("<span class='alert'>[src] starts smoking!</span>")
|
||||
if (!grumping && grump >= 100 && prob(10)) // probably not good if this happens several times in a row
|
||||
grumping = 1
|
||||
playsound(src.loc, "sound/weapons/rocket.ogg", 50, 0)
|
||||
var/firesize = rand(1,4)
|
||||
for(var/atom/movable/M in view(firesize, src.loc)) // fuck up those jerkbag engineers
|
||||
if(M.anchored) continue
|
||||
if(ismob(M))
|
||||
var/mob/living/L = M
|
||||
L.adjustBruteLoss(10)
|
||||
if(ismob(M))
|
||||
var/atom/targetTurf = get_edge_target_turf(M, get_dir(src, get_step_away(M, src)))
|
||||
M.throw_at(targetTurf, 200, 4)
|
||||
else if (prob(15)) // cut down the number of other junk things that get blown around
|
||||
var/atom/targetTurf = get_edge_target_turf(M, get_dir(src, get_step_away(M, src)))
|
||||
M.throw_at(targetTurf, 200, 4)
|
||||
grumping = 0
|
||||
grump -= 30
|
||||
if(10001 to INFINITY)
|
||||
playsound(src.loc, sound_engine_alert3, 55, 0)
|
||||
if(!grumping && grump >= 100 && prob(6))
|
||||
grumping = 1
|
||||
src.visible_message("<span class='alert'><b>[src] [pick("resonates", "shakes", "rumbles", "grumbles", "vibrates", "roars")] [pick("dangerously", "strangely", "ominously", "frighteningly", "grumpily")]!</b></span>")
|
||||
playsound(src.loc, "sound/effects/explosionfar.ogg", 65, 1)
|
||||
for (var/obj/structure/window/W in range(6, src.loc)) // smash nearby windows
|
||||
if (W.max_integrity >= 80) // plasma glass or better, no break please and thank you
|
||||
continue
|
||||
if (prob(get_dist(W,src.loc)*6))
|
||||
continue
|
||||
W.deconstruct(FALSE)
|
||||
for (var/mob/living/M in range(6, src.loc))
|
||||
shake_camera(M, 3, 16)
|
||||
grumping = 0
|
||||
grump -= 30
|
||||
if (prob(33)) // lowered because all the DEL procs related to zap are stacking up in the profiler
|
||||
if(prob(5))
|
||||
playsound(src.loc, sound_bigzap, 100, 1, extrarange = 10)
|
||||
zapStuff(src, 5, min(genlev, 30000)) //BIG ZAP
|
||||
else
|
||||
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, 1, extrarange = 10)
|
||||
zapStuff(src, 5, min(genlev, 20000))
|
||||
if(prob(5))
|
||||
src.visible_message("<span class='alert'>[src] [pick("rumbles", "groans", "shudders", "grustles", "hums", "thrums")] [pick("ominously", "oddly", "strangely", "oddly", "worringly", "softly", "loudly")]!</span>")
|
||||
else if (prob(2))
|
||||
src.visible_message("<span class='alert'><b>[src] hungers!</b></span>")
|
||||
..()
|
||||
|
||||
/obj/machinery/power/generator/proc/get_menu(include_link = TRUE)
|
||||
@@ -232,3 +353,71 @@
|
||||
if(cold_circ)
|
||||
cold_circ.generator = null
|
||||
cold_circ = null
|
||||
|
||||
/obj/machinery/power/generator/proc/zapStuff(atom/zapstart, range = 3, power)
|
||||
. = zapstart.dir
|
||||
if(power < 1000)
|
||||
return
|
||||
|
||||
var/target_atom
|
||||
var/mob/living/target_mob
|
||||
var/obj/machinery/target_machine
|
||||
var/obj/structure/target_structure
|
||||
var/list/arctargetsmob = list()
|
||||
var/list/arctargetsmachine = list()
|
||||
var/list/arctargetsstructure = list()
|
||||
|
||||
if(prob(20)) //let's not hit all the engineers with every beam and/or segment of the arc
|
||||
for(var/mob/living/Z in oview(zapstart, range+2))
|
||||
arctargetsmob += Z
|
||||
if(arctargetsmob.len)
|
||||
var/mob/living/H = pick(arctargetsmob)
|
||||
var/atom/A = H
|
||||
target_mob = H
|
||||
target_atom = A
|
||||
|
||||
else
|
||||
for(var/obj/machinery/X in oview(zapstart, range+2))
|
||||
arctargetsmachine += X
|
||||
if(arctargetsmachine.len)
|
||||
var/obj/machinery/M = pick(arctargetsmachine)
|
||||
var/atom/A = M
|
||||
target_machine = M
|
||||
target_atom = A
|
||||
|
||||
else
|
||||
for(var/obj/structure/Y in oview(zapstart, range+2))
|
||||
arctargetsstructure += Y
|
||||
if(arctargetsstructure.len)
|
||||
var/obj/structure/O = pick(arctargetsstructure)
|
||||
var/atom/A = O
|
||||
target_structure = O
|
||||
target_atom = A
|
||||
|
||||
if(target_atom)
|
||||
zapstart.Beam(target_atom, icon_state="nzcrentrs_power", time=5)
|
||||
var/zapdir = get_dir(zapstart, target_atom)
|
||||
if(zapdir)
|
||||
. = zapdir
|
||||
|
||||
if(target_mob)
|
||||
target_mob.electrocute_act(rand(5,10), "Discharge Bolt", 1, stun = 0)
|
||||
if(prob(15))
|
||||
zapStuff(target_mob, 5, power / 2)
|
||||
zapStuff(target_mob, 5, power / 2)
|
||||
else
|
||||
zapStuff(target_mob, 5, power / 1.5)
|
||||
|
||||
else if(target_machine)
|
||||
if(prob(15))
|
||||
zapStuff(target_machine, 5, power / 2)
|
||||
zapStuff(target_machine, 5, power / 2)
|
||||
else
|
||||
zapStuff(target_machine, 5, power / 1.5)
|
||||
|
||||
else if(target_structure)
|
||||
if(prob(15))
|
||||
zapStuff(target_structure, 5, power / 2)
|
||||
zapStuff(target_structure, 5, power / 2)
|
||||
else
|
||||
zapStuff(target_structure, 5, power / 1.5)
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
var/boom_message = "[ADMIN_LOOKUPFLW(P.firer)] triggered a fueltank explosion via projectile."
|
||||
GLOB.bombers += boom_message
|
||||
message_admins(boom_message)
|
||||
P.firer.log_message("triggered a fueltank explosion via projectile.", LOG_ATTACK)
|
||||
P.firer?.log_message("triggered a fueltank explosion via projectile.", LOG_ATTACK)
|
||||
boom()
|
||||
|
||||
/obj/structure/reagent_dispensers/fueltank/attackby(obj/item/I, mob/living/user, params)
|
||||
|
||||
Reference in New Issue
Block a user