Files
Bubberstation/code/game/objects/effects/portals.dm
T
Whoneedspacee 6a70a982df [Ready] Megafauna VR Training Simulator (#42353)
* lava arena is now not the default for swoop attack

adds mass fire attack, sends fire lines out from the drake in 360 degrees

lava pools now have a chance to be spawned with the fire breath attack

adds greater delay for lava pools on lesser ash drake so they don't just all instantly get placed

lava arena doesn't needlessly recalculate the turfs it will be using every pass now

enraged state, procs when you try to escape from the lava arena attack without fighting it normally, colors the drake turns its brightness up as it glows, then shoots out fire everywhere, also heals the drake for 250 health.

fixes a bug where fire lines wouldn't appear if their range would put the calculated end turf outside the map

fixes a bug where indestructible open turfs would turn into basalt on the lava arena attack

fixes a bug where lava arena safe spots would be on indestructible closed turfs

drake swoops now have a greater default recovery time

* fixes stupid text error

* adds vr mining sleepers to the lavaland mining base which can be used to train with megafauna and test out other items

removes useless code from colossus's file including having a dead icon of the drake and butchering results

adds virtual versions of each megafauna which don't drop any items and are deleted upon death

adds the vr mining map

* adds virtual megafauna spawners and their respective icons, spawn 1 megafauna at their location and are indestructible

changes default virtual megafauna hunter gear to be more like the default mining gear

* adds more items to spawning in mining vr

megafauna spawner nests can no longer be pushed

virtual megafauna now have a limit to how far they can move away from their nest

adds arenas and fast bluespace tile paths to each megafauna spawner and gives the mining base some walls to protect it

* adds mining vr map to the away mission config

adds perm portals, linked two way portals who are linked by id and can be set in mapping files by editing instance

adds megafauna portals for the arenas

fixes up some junk on the mining vr map

adds a spawn delay for megafauna spawners after the linked megafaunas death

fixes a bug where bubblegum could teleport outside of his arena

* adds true spawn var to bubblegum to easily handle clones / virtual versions of it spawning

fixes bug where virtual legion would release the real legion when damaged

moves vr mining code to the away missions code to adhere to contributing.md

* converts map files to tgm

adds arena cleanup and fixes runtime bugs on virtual megafauna spawn and death

* reverts local drake changes

* fixes bug where drake corpses still had a gps signal

removes worthless include

* adds the crusher trophies to the vr mining kit

no more granting null achievements you stinky virtual megafauna

this map really didn't need to be 255x255 im sorry

* even smaller map wowee also please compile

* adds respawning item crates for the lavaland items and healing junk

even smaller map and some filler spaces for possible future bosses

removes lavaland map changes

mining vr now works properly with other vr maps and is randomly selected working with normal vr sleepers on station

fixes permanent being permanant my bad

* lavaland map stop being changed

* maybe a bit overkill with the amount of healing items

* reordering i guess but why is the rum gone

* work please

* Update Lavaland.dmm

* Update Lavaland.dmm

* adds force stop option to portals so you can choose to not chain teleports with non linked portals.dm

permanent portals now can be var edited mid game and still work (cool admin events? idk)

permanent portals are no longer deleted if they don't have a linked portal

adds one way portals, portals that lead somewhere but have no return portal. basically non hardlinked portals but able to be done in map and edit stuff

adds recall portals for the vr megafauna arenas, one way portals but you can recall to them by using a one time use spell (no it is not tied to your real mind it is tied to the vr mind)

virtual megafauna can no longer escape their arenas

moves some virtual megafauna procs to the main megafauna file to reduce needless code

* recall portals can now be chained and the portal recall spell can now go back in a stack reverse style

* adds boss rush mode, fight all of the bosses successively with only one break in the middle without dying

object spawners can now choose their datum spawner type through a var

moves some virtual megafauna code from the megafauna file to the megafauna spawner datum

* adds new goodies to the end of the boss rush

removes a lot of the copy pastad code in the vr megafauna

adds true spawn var, decides whether or not the megafauna should grant achievements or have an internal gps, used for bubblegum hallucinations and virtual megafauna

internal gps are now added on the base megafauna path

hierophant's crusher trophy no longer spawns at its beacon (let's be honest some people missed it because of this) so it works properly with the crusher loot var
2019-02-11 12:01:51 -05:00

240 lines
7.9 KiB
Plaintext

/proc/create_portal_pair(turf/source, turf/destination, _creator = null, _lifespan = 300, accuracy = 0, newtype = /obj/effect/portal, atmos_link_override)
if(!istype(source) || !istype(destination))
return
var/turf/actual_destination = get_teleport_turf(destination, accuracy)
var/obj/effect/portal/P1 = new newtype(source, _creator, _lifespan, null, FALSE, null, atmos_link_override)
var/obj/effect/portal/P2 = new newtype(actual_destination, _creator, _lifespan, P1, TRUE, null, atmos_link_override)
if(!istype(P1)||!istype(P2))
return
P1.link_portal(P2)
P1.hardlinked = TRUE
return list(P1, P2)
/obj/effect/portal
name = "portal"
desc = "Looks unstable. Best to test it with the clown."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "portal"
anchored = TRUE
var/mech_sized = FALSE
var/obj/effect/portal/linked
var/hardlinked = TRUE //Requires a linked portal at all times. Destroy if there's no linked portal, if there is destroy it when this one is deleted.
var/teleport_channel = TELEPORT_CHANNEL_BLUESPACE
var/creator
var/turf/hard_target //For when a portal needs a hard target and isn't to be linked.
var/atmos_link = FALSE //Link source/destination atmos.
var/turf/open/atmos_source //Atmos link source
var/turf/open/atmos_destination //Atmos link destination
var/allow_anchored = FALSE
var/innate_accuracy_penalty = 0
var/last_effect = 0
/obj/effect/portal/anom
name = "wormhole"
icon = 'icons/obj/objects.dmi'
icon_state = "anom"
layer = RIPPLE_LAYER
mech_sized = TRUE
teleport_channel = TELEPORT_CHANNEL_WORMHOLE
/obj/effect/portal/Move(newloc)
for(var/T in newloc)
if(istype(T, /obj/effect/portal))
return FALSE
return ..()
/obj/effect/portal/attackby(obj/item/W, mob/user, params)
if(user && Adjacent(user))
user.forceMove(get_turf(src))
return TRUE
/obj/effect/portal/Crossed(atom/movable/AM, oldloc, force_stop = 0)
if(force_stop)
return ..()
if(isobserver(AM))
return ..()
if(linked && (get_turf(oldloc) == get_turf(linked)))
return ..()
if(!teleport(AM))
return ..()
/obj/effect/portal/attack_tk(mob/user)
return
/obj/effect/portal/attack_hand(mob/user)
. = ..()
if(.)
return
if(get_turf(user) == get_turf(src))
teleport(user)
if(Adjacent(user))
user.forceMove(get_turf(src))
/obj/effect/portal/Initialize(mapload, _creator, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override, atmos_link_override)
. = ..()
GLOB.portals += src
if(!istype(_linked) && automatic_link)
. = INITIALIZE_HINT_QDEL
CRASH("Somebody fucked up.")
if(_lifespan > 0)
QDEL_IN(src, _lifespan)
if(!isnull(atmos_link_override))
atmos_link = atmos_link_override
link_portal(_linked)
hardlinked = automatic_link
creator = _creator
if(isturf(hard_target_override))
hard_target = hard_target_override
/obj/effect/portal/singularity_pull()
return
/obj/effect/portal/singularity_act()
return
/obj/effect/portal/proc/link_portal(obj/effect/portal/newlink)
linked = newlink
if(atmos_link)
link_atmos()
/obj/effect/portal/proc/link_atmos()
if(atmos_source || atmos_destination)
unlink_atmos()
if(!isopenturf(get_turf(src)))
return FALSE
if(linked)
if(isopenturf(get_turf(linked)))
atmos_source = get_turf(src)
atmos_destination = get_turf(linked)
else if(hard_target)
if(isopenturf(hard_target))
atmos_source = get_turf(src)
atmos_destination = hard_target
else
return FALSE
if(!istype(atmos_source) || !istype(atmos_destination))
return FALSE
LAZYINITLIST(atmos_source.atmos_adjacent_turfs)
LAZYINITLIST(atmos_destination.atmos_adjacent_turfs)
if(atmos_source.atmos_adjacent_turfs[atmos_destination] || atmos_destination.atmos_adjacent_turfs[atmos_source]) //Already linked!
return FALSE
atmos_source.atmos_adjacent_turfs[atmos_destination] = TRUE
atmos_destination.atmos_adjacent_turfs[atmos_source] = TRUE
atmos_source.air_update_turf(FALSE)
atmos_destination.air_update_turf(FALSE)
/obj/effect/portal/proc/unlink_atmos()
if(istype(atmos_source))
if(istype(atmos_destination) && !atmos_source.Adjacent(atmos_destination) && !CANATMOSPASS(atmos_destination, atmos_source))
LAZYREMOVE(atmos_source.atmos_adjacent_turfs, atmos_destination)
atmos_source = null
if(istype(atmos_destination))
if(istype(atmos_source) && !atmos_destination.Adjacent(atmos_source) && !CANATMOSPASS(atmos_source, atmos_destination))
LAZYREMOVE(atmos_destination.atmos_adjacent_turfs, atmos_source)
atmos_destination = null
/obj/effect/portal/Destroy() //Calls on_portal_destroy(destroyed portal, location of destroyed portal) on creator if creator has such call.
if(creator && hascall(creator, "on_portal_destroy"))
call(creator, "on_portal_destroy")(src, src.loc)
creator = null
GLOB.portals -= src
unlink_atmos()
if(hardlinked && !QDELETED(linked))
QDEL_NULL(linked)
else
linked = null
return ..()
/obj/effect/portal/attack_ghost(mob/dead/observer/O)
if(!teleport(O, TRUE))
return ..()
/obj/effect/portal/proc/teleport(atom/movable/M, force = FALSE)
if(!force && (!istype(M) || iseffect(M) || (ismecha(M) && !mech_sized) || (!isobj(M) && !ismob(M)))) //Things that shouldn't teleport.
return
var/turf/real_target = get_link_target_turf()
if(!istype(real_target))
return FALSE
if(!force && (!ismecha(M) && !istype(M, /obj/item/projectile) && M.anchored && !allow_anchored))
return
if(ismegafauna(M))
message_admins("[M] has used a portal at [ADMIN_VERBOSEJMP(src)] made by [usr].")
var/no_effect = FALSE
if(last_effect == world.time)
no_effect = TRUE
else
last_effect = world.time
if(do_teleport(M, real_target, innate_accuracy_penalty, no_effects = no_effect, channel = teleport_channel))
if(istype(M, /obj/item/projectile))
var/obj/item/projectile/P = M
P.ignore_source_check = TRUE
return TRUE
return FALSE
/obj/effect/portal/proc/get_link_target_turf()
var/turf/real_target
if(!istype(linked) || QDELETED(linked))
if(hardlinked)
qdel(src)
if(!istype(hard_target) || QDELETED(hard_target))
hard_target = null
return
else
real_target = hard_target
linked = null
else
real_target = get_turf(linked)
return real_target
/obj/effect/portal/permanent
name = "permanent portal"
desc = "An unwavering portal that will never fade."
var/id // var edit or set id in map editor
hardlinked = FALSE // dont qdel my portal nerd
/obj/effect/portal/permanent/Initialize(mapload, _creator, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override, atmos_link_override)
. = ..()
set_linked()
/obj/effect/portal/permanent/proc/get_linked()
if(!id)
return
for(var/obj/effect/portal/permanent/P in GLOB.portals - src)
if(P.id && P.id == id) // gets portals with the same id, there should only be two permanent portals with the same id
return P
/obj/effect/portal/permanent/proc/set_linked()
var/obj/effect/portal/permanent/other = get_linked()
if(!other)
return
other.linked = src
linked = other
/obj/effect/portal/permanent/teleport(atom/movable/M, force = FALSE)
if(!linked) // try to search for a new one if something was var edited etc
set_linked()
. = ..()
/obj/effect/portal/permanent/one_way // doesn't have a return portal
name = "one-way portal"
desc = "You get the feeling that this might not be the safest thing you've ever done."
var/keep // if this is a portal that should be kept
/obj/effect/portal/permanent/one_way/set_linked()
var/obj/effect/portal/permanent/one_way/other = get_linked()
if(!other)
return
hard_target = get_turf(other)
other.hard_target = get_turf(src)
if(!other.keep)
qdel(other)
if(!keep)
qdel(src)
/obj/effect/portal/permanent/one_way/keep // because its nice to be able to tell which is which on the map
keep = TRUE
/obj/effect/portal/permanent/one_way/destroy
keep = FALSE