Lagholes now wormholes

This commit is contained in:
Jon
2018-10-22 18:54:26 +01:00
parent 19325c20be
commit 46b8f0eab0
6 changed files with 156 additions and 25 deletions
+56 -2
View File
@@ -1,14 +1,30 @@
/proc/wormhole_event()
/proc/wormhole_event(var/wormholeAmount = 600, var/event_duration = 3000)
spawn()
// Begone you disgusting fucking piece of garbage - Jon
/*
var/list/pick_turfs = list()
for(var/turf/simulated/floor/T in turfs)
if(T.z in using_map.station_levels)
pick_turfs += T
*/
if(pick_turfs.len)
//All ready. Announce that bad juju is afoot.
command_announcement.Announce("Space-time anomalies detected on the station. There is no additional data.", "Anomaly Alert", new_sound = 'sound/AI/spanomalies.ogg')
var/end_time = world.time + event_duration
var/list/wormholes = list()
// Unfortunately, this code is shit. I will not explain why but I'll give one reason. While(1)
// I dont want to explain why I think that that fucking line is retarded. I think it's self
// explanatory, I can write for over 2000 words explaining why no programmer should EVER do that
// unless they want to lag the game intentionally like a douchebag. Remember this proc is being
// called on WORLD. MEANING, IF YOU MAKE WORLD SLEEP. YOU MAKE THE SERVER SLEEP YOU DINGUS.
// OH MY GOD WHO THE FUCK WOULD EVEN THINK OF THIS!!!
//
// - Jon, better code below this.
/*
//prob(20) can be approximated to 1 wormhole every 5 turfs!
//admittedly less random but totally worth it >_<
var/event_duration = 3000 //~5 minutes in ticks
@@ -47,6 +63,16 @@
create_wormhole(enter,exit)
sleep(sleep_duration) //have a well deserved nap!
*/
// Now that we made the announcement, might as well get the wormholes spawning!
for(var/i in 0 to wormholeAmount) // For every 0 to wormhole amount.
var/turf/T = pick(pick_turfs) //Pick random turfs from the list we made earlier.
wormholes += new /obj/effect/portal/worm(T, null, null, 1)// Spawn the wormhole, ITS THAT EASY?!?!
while(wormholes.len > 0)
if(end_time < world.time)
wormholes.Cut() //we've run into overtime. End the event
//maybe this proc can even be used as an admin tool for teleporting players without ruining immulsions?
@@ -59,4 +85,32 @@
P.icon_state = "anom"
P.name = "wormhole"
spawn(rand(300,600))
qdel(P)
qdel(P)
/obj/effect/portal/worm
name = "wormhole"
icon_state = "anom"
icon = 'icons/obj/objects.dmi'
desc = "It looks highly unstable; It could close at any moment."
failchance = 0
/obj/effect/portal/worm/attack_hand(mob/user)
teleport(user)
/obj/effect/portal/worm/attackby(obj/item/I, mob/user, params)
teleport(user)
/obj/effect/portal/worm/teleport(atom/movable/M)
if(istype(M, /obj/effect)) //sparks don't teleport
return
if(M.anchored && istype(M, /obj/mecha))
return
if(istype(M, /atom/movable))
var/turf/target
if(portals.len)
var/obj/effect/portal/P = pick(portals)
if(P && isturf(P.loc))
target = P.loc
if(!target) return
do_teleport(M, target, 1, 1, 0, 0) ///You will appear adjacent to the beacon
+44 -18
View File
@@ -1,4 +1,9 @@
GLOBAL_LIST_BOILERPLATE(all_portals, /obj/effect/portal)
//GLOBAL_LIST_BOILERPLATE(all_portals, /obj/effect/portal)
// No fucking idea what this proc does but it doesn't seem to
// help when we need to refere to the global portals list.
var/global/list/portals = list() // Just a list for portals <3
/obj/effect/portal
name = "portal"
@@ -13,28 +18,43 @@ GLOBAL_LIST_BOILERPLATE(all_portals, /obj/effect/portal)
anchored = 1.0
/obj/effect/portal/Bumped(mob/M as mob|obj)
spawn(0)
src.teleport(M)
return
return
// spawn(0)
// src.teleport(M)
// return
// return
teleport(M)
/obj/effect/portal/Crossed(AM as mob|obj)
spawn(0)
src.teleport(AM)
return
return
// spawn(0)
// src.teleport(AM)
// return
// return
teleport(AM)
/obj/effect/portal/attack_hand(mob/user as mob)
spawn(0)
src.teleport(user)
return
return
// spawn(0)
// src.teleport(user)
// return
// return
teleport(user)
/obj/effect/portal/New()
spawn(300)
qdel(src)
return
return
/obj/effect/portal/New(loc, turf/target, creator=null, lifespan=300)
//I'm actually concerned with the ammount of spaghet on my plate today. - Jon
// spawn(300)
// qdel(src)
// return
// return
portals += src
src.loc = loc
src.target = target
src.creator = creator
if(lifespan > 0)
spawn(lifespan)
qdel(src)
/obj/effect/portal/Destroy()
portals -= src
return ..()
/obj/effect/portal/proc/teleport(atom/movable/M as mob|obj)
if(istype(M, /obj/effect)) //sparks don't teleport
@@ -53,3 +73,9 @@ GLOBAL_LIST_BOILERPLATE(all_portals, /obj/effect/portal)
else
do_teleport(M, target, 1) ///You will appear adjacent to the beacon
// New addition to remove portals via multitools like on codebases like Paradise. - Jon
/obj/effect/portal/attackby(obj/item/A, mob/user)
if(istype(A, /obj/item/device/multitool))
qdel(src)
@@ -156,7 +156,7 @@ Frequency:
if ((user.get_active_hand() != src || user.stat || user.restrained()))
return
var/count = 0 //num of portals from this teleport in world
for(var/obj/effect/portal/PO in all_portals)
for(var/obj/effect/portal/PO in portals)
if(PO.creator == src) count++
if(count >= 3)
user.show_message("<span class='notice'>\The [src] is recharging!</span>")
+55 -1
View File
@@ -2,8 +2,62 @@
startWhen = 0
endWhen = 80
var/list/pick_turfs = list()
var/list/wormholes = list()
var/shift_frequency = 3
var/number_of_wormholes = 400
/datum/event/wormholes/setup()
endWhen = rand(40, 80)
/datum/event/wormholes/start()
wormhole_event()
for(var/turf/simulated/floor/T in turfs)
if(T.z in using_map.station_levels)
pick_turfs += T
for(var/i in 1 to number_of_wormholes)
var/turf/T = pick(pick_turfs)
wormholes += new /obj/effect/portal/worm(T, null, null, -1)
/datum/event/wormholes/tick()
if(activeFor % shift_frequency == 0)
for(var/obj/effect/portal/worm/O in wormholes)
var/turf/T = pick(pick_turfs)
if(T) O.loc = T
/datum/event/wormholes/end()
for(var/obj/effect/portal/worm/O in wormholes)
qdel(O)
command_announcement.Announce("There are no more space-time anomalies detected on the station.", "Anomaly Alert")
/obj/effect/portal/worm
name = "wormhole"
icon_state = "anom"
icon = 'icons/obj/objects.dmi'
desc = "It looks highly unstable; It could close at any moment."
failchance = 0
/obj/effect/portal/worm/attack_hand(mob/user)
teleport(user)
/obj/effect/portal/worm/attackby(obj/item/I, mob/user, params)
teleport(user)
/obj/effect/portal/worm/teleport(atom/movable/M)
if(istype(M, /obj/effect)) //sparks don't teleport
return
if(M.anchored && istype(M, /obj/mecha))
return
if(istype(M, /atom/movable))
var/turf/target
if(portals.len)
var/obj/effect/portal/P = pick(portals)
if(P && isturf(P.loc))
target = P.loc
if(!target) return
do_teleport(M, target, 1, 1, 0, 0) ///You will appear adjacent to the beacon
@@ -112,8 +112,6 @@ proc/get_fusion_reaction(var/p_react, var/s_react, var/m_energy)
/decl/fusion_reaction/phoron_supermatter/handle_reaction_special(var/obj/effect/fusion_em_field/holder)
wormhole_event()
var/turf/origin = get_turf(holder)
holder.Rupture()
qdel(holder)
-1
View File
@@ -518,7 +518,6 @@
#include "code\game\gamemodes\events\clang.dm"
#include "code\game\gamemodes\events\dust.dm"
#include "code\game\gamemodes\events\power_failure.dm"
#include "code\game\gamemodes\events\wormholes.dm"
#include "code\game\gamemodes\events\holidays\Christmas.dm"
#include "code\game\gamemodes\events\holidays\Holidays.dm"
#include "code\game\gamemodes\events\holidays\Other.dm"