Two singularities in the world can link on some occasions (#32193)

* 2 Singularities in the world at once have a 10% chance to link

* Sanity

* Sanity

* One important line

* Better selection method

* A white hole?

* A white hole?

* Requested name change

* Requested name change

* Fullstops

* Other.desc

* Sanity

* Changes method

* Fixes

* One line

* This counts too

* Make them act no matter what

* Crystal nerf

* Bracket

* Tweaks odds, does both ways

* While loop stuff, better way maybe

* Possible sanity

* Final stuff

Co-authored-by: kanef <kanef9x@protonmail.com>
This commit is contained in:
kane-f
2022-04-16 15:06:05 +01:00
committed by GitHub
parent 26ef3421bb
commit 41dd41e020
6 changed files with 141 additions and 18 deletions

View File

@@ -1228,7 +1228,7 @@ var/global/list/image/blood_overlays = list()
return return
//handling the pulling of the item for singularity //handling the pulling of the item for singularity
/obj/item/singularity_pull(S, current_size) /obj/item/singularity_pull(S, current_size, repel = FALSE)
if(flags & INVULNERABLE) if(flags & INVULNERABLE)
return return
spawn(0) //this is needed or multiple items will be thrown sequentially and not simultaneously spawn(0) //this is needed or multiple items will be thrown sequentially and not simultaneously
@@ -1239,11 +1239,20 @@ var/global/list/image/blood_overlays = list()
return return
if(current_size >= STAGE_FOUR) if(current_size >= STAGE_FOUR)
//throw_at(S, 14, 3) //throw_at(S, 14, 3)
step_towards(src,S) if(!repel)
step_towards(src, S)
else
step_away(src, S)
sleep(1) sleep(1)
step_towards(src,S) if(!repel)
step_towards(src, S)
else
step_away(src, S)
else if(current_size > STAGE_ONE) else if(current_size > STAGE_ONE)
step_towards(src,S) if(!repel)
step_towards(src, S)
else
step_away(src, S)
else else
..() ..()

View File

@@ -368,14 +368,20 @@ var/global/list/reagents_to_log = list(FUEL, PLASMA, PACID, SACID, AMUTATIONTOXI
to_chat(user, "\the [src] already has a slime extract attached.") to_chat(user, "\the [src] already has a slime extract attached.")
return FALSE return FALSE
/obj/singularity_pull(S, current_size) /obj/singularity_pull(S, current_size, repel = FALSE)
INVOKE_EVENT(src, /event/before_move) INVOKE_EVENT(src, /event/before_move)
if(anchored) if(anchored)
if(current_size >= STAGE_FIVE) if(current_size >= STAGE_FIVE)
anchored = 0 anchored = 0
if(!repel)
step_towards(src, S) step_towards(src, S)
else else
step_away(src, S)
else
if(!repel)
step_towards(src, S) step_towards(src, S)
else
step_away(src, S)
INVOKE_EVENT(src, /event/after_move) INVOKE_EVENT(src, /event/after_move)
/obj/proc/multitool_menu(var/mob/user,var/obj/item/device/multitool/P) /obj/proc/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)

View File

@@ -1494,14 +1494,17 @@
investigation_log(I_SINGULO,"has been consumed by a singularity") investigation_log(I_SINGULO,"has been consumed by a singularity")
gib() gib()
return gain return gain
/mob/living/carbon/human/singularity_pull(S, current_size,var/radiations = 3) /mob/living/carbon/human/singularity_pull(S, current_size, repel = FALSE, var/radiations = 3)
if(src.flags & INVULNERABLE) if(src.flags & INVULNERABLE)
return 0 return 0
if(current_size >= STAGE_THREE) //Pull items from hand if(current_size >= STAGE_THREE) //Pull items from hand
for(var/obj/item/I in held_items) for(var/obj/item/I in held_items)
if(prob(current_size*5) && I.w_class >= ((11-current_size)/2) && u_equip(I,1)) if(prob(current_size*5) && I.w_class >= ((11-current_size)/2) && u_equip(I,1))
step_towards(I, src) if(!repel)
to_chat(src, "<span class = 'warning'>\The [S] pulls \the [I] from your grip!</span>") step_towards(I, S)
else
step_away(I, S)
to_chat(src, "<span class = 'warning'>\The [S] [repel ? "pushes" : "pulls"] \the [I] from your grip!</span>")
if(radiations) if(radiations)
apply_radiation(current_size * radiations, RAD_EXTERNAL) apply_radiation(current_size * radiations, RAD_EXTERNAL)
if(shoes) if(shoes)

View File

@@ -1246,9 +1246,12 @@ Thanks.
gib() gib()
return(gain) return(gain)
/mob/living/singularity_pull(S) /mob/living/singularity_pull(S, current_size, repel = FALSE)
if(!(src.flags & INVULNERABLE)) if(!(src.flags & INVULNERABLE))
if(!repel)
step_towards(src, S) step_towards(src, S)
else
step_away(src, S)
//shuttle_act is called when a shuttle collides with the mob //shuttle_act is called when a shuttle collides with the mob
/mob/living/shuttle_act(datum/shuttle/S) /mob/living/shuttle_act(datum/shuttle/S)

View File

@@ -1,4 +1,5 @@
var/list/global_singularity_pool var/list/obj/machinery/singularity/global_singularity_pool
var/list/obj/machinery/singularity/white_hole_candidates
/obj/machinery/singularity /obj/machinery/singularity
name = "gravitational singularity" //Lower case name = "gravitational singularity" //Lower case
@@ -12,6 +13,8 @@ var/list/global_singularity_pool
luminosity = 6 luminosity = 6
use_power = 0 use_power = 0
var/obj/machinery/singularity/wormhole_out = null
var/obj/machinery/singularity/wormhole_in = null
var/current_size = 1 var/current_size = 1
var/allowed_size = 1 var/allowed_size = 1
var/contained = 1 //Are we going to move around? var/contained = 1 //Are we going to move around?
@@ -31,6 +34,8 @@ var/list/global_singularity_pool
appearance_flags = LONG_GLIDE|TILE_MOVER appearance_flags = LONG_GLIDE|TILE_MOVER
var/chained = 0 //Adminbus chain-grab var/chained = 0 //Adminbus chain-grab
var/modifier = "" //for memes var/modifier = "" //for memes
var/repels = FALSE //For pushing stuff out the other end
var/list/speech_messages = list() //Time is occuring in random pockets. The laws of causality no longer apply.
/obj/machinery/singularity/New(loc, var/starting_energy = 50, var/temp = 0) /obj/machinery/singularity/New(loc, var/starting_energy = 50, var/temp = 0)
//CARN: admin-alert for chuckle-fuckery. //CARN: admin-alert for chuckle-fuckery.
@@ -52,6 +57,59 @@ var/list/global_singularity_pool
if(!global_singularity_pool) if(!global_singularity_pool)
global_singularity_pool = list() global_singularity_pool = list()
global_singularity_pool += src global_singularity_pool += src
if(!white_hole_candidates)
white_hole_candidates = list()
if(!repels && !(src in white_hole_candidates))
white_hole_candidates += src
if(prob(1) && white_hole_candidates.len > 1)
link_a_wormhole()
/obj/machinery/singularity/proc/link_a_wormhole()
var/obj/machinery/singularity/other = null
do
other = pick(white_hole_candidates)
while(white_hole_candidates.len > 1 && other == src)
if(other && other != src)
if(prob(50))
link_wormhole(other)
else
other.link_wormhole(src)
/obj/machinery/singularity/proc/link_wormhole(var/obj/machinery/singularity/other)
if(other)
visible_message("<span class='notice'>[src] pulsates as a distinctive [get_area(other) ? "[get_area(other)]": "place"] becomes visible.</span>")
other.visible_message("<span class='notice'>[other] pulsates as a distinctive [get_area(src) ? "[get_area(src)]": "place"] becomes visible.</span>")
other.name = "white hole"
other.desc = "Every action has an equal and opposite reaction. A black hole sucks time and matter out of the universe, a white hole returns it."
other.repels = TRUE
other.energy = src.energy
other.color= list(-1,0,0,
0,-1,0,
0,0,-1,
1,1,1) //Invert it
wormhole_out = other
other.wormhole_in = src
if(other in white_hole_candidates)
white_hole_candidates -= other
/obj/machinery/singularity/proc/unlink_wormholes()
if(wormhole_out)
visible_message("<span class='warning'>[get_area(wormhole_out) ? "[get_area(wormhole_out)]": "The strange place"] is no longer visible as [src] closes its path to it.</span>")
wormhole_out.name = initial(wormhole_out.name)
wormhole_out.desc = initial(wormhole_out.desc)
wormhole_out.repels = FALSE
wormhole_out.color= initial(wormhole_out.color)
if(!(wormhole_out in white_hole_candidates))
white_hole_candidates += wormhole_out
wormhole_out = null
if(wormhole_in)
visible_message("<span class='warning'>[get_area(wormhole_in) ? "[get_area(wormhole_in)]": "The strange place"] is no longer visible as [src] closes its path to it.</span>")
name = initial(name)
repels = FALSE
color = initial(color)
if(!(src in white_hole_candidates))
white_hole_candidates += src
wormhole_in = null
/obj/machinery/singularity/attack_hand(mob/user as mob) /obj/machinery/singularity/attack_hand(mob/user as mob)
consume(user) consume(user)
@@ -119,6 +177,12 @@ var/list/global_singularity_pool
L.forceMove(get_turf(user)) L.forceMove(get_turf(user))
animate(L, alpha = 255, time = 3 SECONDS) animate(L, alpha = 255, time = 3 SECONDS)
/obj/machinery/singularity/Hear(var/datum/speech/speech, var/rendered_message="")
if(repels && ismob(speech.speaker))
var/mob/M = speech.speaker
if(M.dna) // Wait a minute... I missed a discussion!
speech_messages[M.dna] = speech.message // We all did
/obj/machinery/singularity/process() /obj/machinery/singularity/process()
dissipate() dissipate()
check_energy() check_energy()
@@ -129,6 +193,13 @@ var/list/global_singularity_pool
if(prob(event_chance)) //Chance for it to run a special event TODO: Come up with one or two more that fit. if(prob(event_chance)) //Chance for it to run a special event TODO: Come up with one or two more that fit.
event() event()
eat() eat()
if(repels && speech_messages.len) // I've never seen one before, no one has, but I'm guessing it's a white hole.
for(var/mob/M in viewers(src)) // A white hole?
if((M.dna in speech_messages) && prob(10))
if(prob(90)) // So that thing's spewing time? Back into the universe?
M.say(speech_messages[M.dna])
else
M.say("So what is it?") //Only joking
/obj/machinery/singularity/attack_ai() //To prevent AIs from gibbing themselves when they click on one. /obj/machinery/singularity/attack_ai() //To prevent AIs from gibbing themselves when they click on one.
return return
@@ -351,8 +422,8 @@ var/list/global_singularity_pool
continue continue
try try
var/dist = get_z_dist(X, src) var/dist = get_z_dist(X, src)
if(dist > consume_range) if(dist > consume_range || repels)
X.singularity_pull(src, current_size) X.singularity_pull(src, current_size, repels)
else if(dist <= consume_range) else if(dist <= consume_range)
if(consume(X)) if(consume(X))
ngrabbed++ ngrabbed++
@@ -390,6 +461,12 @@ var/list/global_singularity_pool
newsea.ChangeTurf(/turf/unsimulated/wall/supermatter) newsea.ChangeTurf(/turf/unsimulated/wall/supermatter)
/obj/machinery/singularity/proc/consume(const/atom/A) /obj/machinery/singularity/proc/consume(const/atom/A)
if(repels && !(istype(A,/obj/item/bluespace_crystal)))
return
if(wormhole_out && !(istype(A,/obj/item/bluespace_crystal)))
var/turf/T = get_turf(wormhole_out)
do_teleport(A, T)
else
var/gain = A.singularity_act(current_size,src) var/gain = A.singularity_act(current_size,src)
src.energy += gain src.energy += gain
return gain return gain
@@ -641,9 +718,11 @@ var/list/global_singularity_pool
*/ //Fuck you centcomm */ //Fuck you centcomm
/obj/machinery/singularity/Destroy() /obj/machinery/singularity/Destroy()
unlink_wormholes()
..() ..()
power_machines -= src power_machines -= src
global_singularity_pool -= src global_singularity_pool -= src
white_hole_candidates -= src
/obj/machinery/singularity/bite_act(mob/user) /obj/machinery/singularity/bite_act(mob/user)
consume(user) consume(user)
@@ -920,3 +999,12 @@ var/list/global_singularity_pool
/obj/machinery/singularity/scrungulartiy /obj/machinery/singularity/scrungulartiy
name = "grabibational scrungulartiy" name = "grabibational scrungulartiy"
modifier = "scrung_" modifier = "scrung_"
/obj/machinery/singularity/soutgularity
name = "white hole"
desc = "Every action has an equal and opposite reaction. A black hole sucks time and space out of the universe, a white hole returns it."
repels = TRUE
color= list(-1,0,0,
0,-1,0,
0,0,-1,
1,1,1) //Invert it

View File

@@ -45,6 +45,20 @@
qdel(src) qdel(src)
/obj/item/bluespace_crystal/singularity_act(var/current_size,var/obj/machinery/singularity/S)
if(istype(src,/obj/item/bluespace_crystal/artificial))
return ..()
if(istype(src,/obj/item/bluespace_crystal/flawless) || prob(10))
if(S.wormhole_out || S.wormhole_in)
S.unlink_wormholes()
else if(white_hole_candidates.len > 1)
S.link_a_wormhole()
if(istype(src,/obj/item/bluespace_crystal/flawless) && S.wormhole_out)
var/turf/T = get_turf(S.wormhole_out)
do_teleport(src, T)
return 2
return ..()
// Artifical bluespace crystal, doesn't give you much research. // Artifical bluespace crystal, doesn't give you much research.
/obj/item/bluespace_crystal/artificial /obj/item/bluespace_crystal/artificial