the Portals update

This commit is contained in:
DeityLink
2015-10-09 01:00:13 +02:00
parent 2e704d2f1d
commit cda3e8f94d
26 changed files with 359 additions and 44 deletions

View File

@@ -120,8 +120,18 @@
playSpecials(curturf,effectin,soundin)
if(istype(teleatom,/obj/item/projectile))
var/Xchange = destturf.x - curturf.x
var/Ychange = destturf.y - curturf.y
var/obj/item/projectile/P = teleatom
P.override_starting_X += Xchange
P.override_starting_Y += Ychange
P.override_target_X += Xchange
P.override_target_Y += Ychange
P.reflected = 1//you can now get hit by the projectile you just fired. Careful with portals!
if(force_teleport)
teleatom.forceMove(destturf)
teleatom.forceMove(destturf,1)
playSpecials(destturf,effectout,soundout)
else
if(teleatom.Move(destturf))

View File

@@ -36,7 +36,7 @@ var/global/list/ghdel_profiling = list()
//Detective Work, used for the duplicate data points kept in the scanners
var/list/original_atom
var/list/beams
var/list/beams = list()
// EVENTS
/////////////////////////////

View File

@@ -273,7 +273,7 @@
..()
return
/atom/movable/proc/forceMove(atom/destination)
/atom/movable/proc/forceMove(atom/destination,var/no_tp=0)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/atom/movable/proc/forceMove() called tick#: [world.time]")
if(destination)
if(loc)
@@ -285,8 +285,14 @@
var/area/A = get_area_master(destination)
A.Entered(src)
for(var/atom/movable/AM in loc)
AM.Crossed(src)
if(!no_tp)
for(var/atom/movable/AM in loc)
AM.Crossed(src)
else
for(var/atom/movable/AM in loc)
if(!istype(AM,/obj/effect/portal))//so we don't loop infinitely between the arrival portal and the departure portal.
AM.Crossed(src)
for(var/atom/movable/AM in locked_atoms)
AM.forceMove(loc)

View File

@@ -59,7 +59,6 @@
var/obj/effect/portal/P = new /obj/effect/portal( enter )
P.target = exit
P.icon = 'icons/obj/objects.dmi'
P.failchance = 0
P.icon_state = "anom"
P.name = "wormhole"
spawn(rand(300,600)) //This isn't useful, the new in hand tele will likely override it

View File

@@ -160,7 +160,6 @@ var/specops_shuttle_timeleft = 0
if(L.name == "Marauder Exit")
var/obj/effect/portal/P = new(L.loc)
P.invisibility = 101//So it is not seen by anyone.
P.failchance = 0//So it has no fail chance when teleporting.
P.target = pick(spawn_marauder)//Where the marauder will arrive.
spawn_marauder.Remove(P.target)

View File

@@ -209,6 +209,7 @@
idle_power_usage = 10
active_power_usage = 2000
var/engaged = 0
density = 0
machine_flags = SCREWTOGGLE | CROWDESTROY
@@ -242,13 +243,26 @@
)
RefreshParts()
/*
/obj/machinery/teleport/hub/Bumped(M as mob|obj)
spawn()
if (src.engaged)
teleport(M)
use_power(5000)
return
*/
/obj/machinery/teleport/hub/Crossed(AM as mob|obj)
if(istype(AM,/obj/item/projectile/beam))
var/obj/item/projectile/beam/B = AM
B.wait = 1
if(istype(AM,/obj/effect/beam))
src.Bump(AM)
return
spawn()
if (src.engaged)
teleport(AM)
use_power(5000)
return
/obj/machinery/teleport/hub/proc/teleport(atom/movable/M as mob|obj)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/teleport/hub/proc/teleport() called tick#: [world.time]")

View File

@@ -580,7 +580,6 @@
var/obj/effect/portal/P = new /obj/effect/portal(get_turf(target))
P.target = target_turf
P.icon = 'icons/obj/objects.dmi'
P.failchance = 0
P.icon_state = "anom"
P.name = "wormhole"
do_after_cooldown()

View File

@@ -1,35 +1,102 @@
/obj/effect/portal
name = "portal"
desc = "Looks unstable. Best to test it with the clown."
desc = "There's a hole in the sky... through which I can fly."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "portal"
density = 1
icon_state = "portal0"
density = 0
unacidable = 1//Can't destroy energy portals.
var/failchance = 5
var/obj/item/target = null
var/obj/item/weapon/hand_tele/creator = null
var/obj/target = null
var/obj/item/weapon/creator = null
anchored = 1.0
w_type=NOT_RECYCLABLE
var/undergoing_deletion = 0
var/list/exit_beams = list()
/obj/effect/portal/attack_hand(var/mob/user)
spawn()
src.teleport(user)
/obj/effect/portal/attackby(obj/item/weapon/O as obj, mob/user as mob)
if(O == creator)
user << "<span class='warning'>You close the portal prematurely.</span>"
qdel(src)
else
spawn()
src.teleport(user)
/*
/obj/effect/portal/Bumped(mob/M as mob|obj)
spawn(0)
spawn()
src.teleport(M)
*/
/obj/effect/portal/Crossed(AM as mob|obj)
spawn(0)
if(istype(AM,/obj/item/projectile/beam))
var/obj/item/projectile/beam/B = AM
B.wait = 1
spawn()
src.teleport(AM)
/obj/effect/portal/New()
/obj/effect/portal/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
if(istype(mover,/obj/effect/beam))
return 0
else
return ..()
/obj/effect/portal/New(turf/loc,var/lifespan=300)
..()
spawn(300)
playsound(loc,'sound/effects/portal_open.ogg',60,1)
spawn(lifespan)
qdel(src)
/obj/effect/portal/Destroy()
..()
target = null
if(undergoing_deletion)
return
undergoing_deletion = 1
playsound(loc,'sound/effects/portal_close.ogg',60,1)
purge_beams()
if(target)
if(istype(target,/obj/effect/portal) && !istype(creator,/obj/item/weapon/gun/portalgun))
qdel(target)
target = null
if(creator)
creator.portals -= src
creator = null
if(istype(creator,/obj/item/weapon/hand_tele))
var/obj/item/weapon/hand_tele/H = creator
H.portals -= src
creator = null
else if(istype(creator,/obj/item/weapon/gun/portalgun))
var/obj/item/weapon/gun/portalgun/P = creator
if(src == P.blue_portal)
P.blue_portal = null
P.sync_portals()
else if(src == P.red_portal)
P.red_portal = null
P.sync_portals()
var/datum/effect/effect/system/spark_spread/aeffect = new
aeffect.set_up(5, 1, loc)
aeffect.start()
..()
/obj/effect/portal/cultify()
return
/obj/effect/portal/singuloCanEat()
return 0
/obj/effect/portal/singularity_act()
return
/obj/effect/portal/singularity_pull()
return
/obj/effect/portal/proc/blend_icon(var/obj/effect/portal/P)
var/turf/T = P.loc
var/icon/I1 = icon(icon,"portal_mask")
var/icon/I2 = icon(initial(T.icon),T.icon_state)
I1.Blend(I2,ICON_MULTIPLY)
overlays += I1
/obj/effect/portal/proc/teleport(atom/movable/M as mob|obj)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/effect/portal/proc/teleport() called tick#: [world.time]")
@@ -37,20 +104,57 @@
return
if (M.anchored&&istype(M, /obj/mecha))
return
if (icon_state == "portal1")
return
if (!( target ))
del(src)
if (!target)
visible_message("<span class='warning'>The portal fails to find a destination and dissipates into thin air.</span>")
qdel(src)
return
if (istype(M, /atom/movable))
var/area/A = get_area(target)
if(A && A.anti_ethereal)
visible_message("<span class='sinister'>A dark form vaguely ressembling a hand reaches through the portal and tears it apart before anything can go through.</span>")
del(src)
qdel(src)
else
if(prob(failchance)) //oh dear a problem, put em in deep space
src.icon_state = "portal1"
do_teleport(M, locate(rand(5, world.maxx - 5), rand(5, world.maxy -5), 3), 0)
else
do_teleport(M, target, 1) ///You will appear adjacent to the beacon
do_teleport(M, target, 0, 1, 1, 1, 'sound/effects/portal_enter.ogg', 'sound/effects/portal_exit.ogg')
/obj/effect/portal/beam_connect(var/obj/effect/beam/B)
if(istype(B))
if(B.HasSource(src))
return // Prevent infinite loops.
..()
handle_beams()
/obj/effect/portal/beam_disconnect(var/obj/effect/beam/B)
if(istype(B))
if(B.HasSource(src))
return // Prevent infinite loops.
..()
handle_beams()
/obj/effect/portal/handle_beams()
if(target && istype(target,/obj/effect/portal))
var/obj/effect/portal/PE = target
PE.purge_beams()
add_beams()
/obj/effect/portal/proc/purge_beams()
for(var/obj/effect/beam/BE in exit_beams)
exit_beams -= BE
qdel(BE)
/obj/effect/portal/proc/add_beams()
if((!beams.len) || !target || !istype(target,/obj/effect/portal))
return
var/obj/effect/portal/PE = target
for(var/obj/effect/beam/emitter/BE in beams)
var/list/spawners = list(src)
spawners |= BE.sources
var/obj/effect/beam/emitter/beam = new(PE.loc)
beam.dir = BE.dir
beam.power = BE.power
beam.steps = BE.steps+1
beam.emit(spawn_by=spawners)
PE.exit_beams += beam

View File

@@ -124,6 +124,7 @@ Frequency:
/*
* Hand-tele
*/
#define HANDTELE_MAX_CHARGES 3
/obj/item/weapon/hand_tele
name = "hand tele"
desc = "A portable item using blue-space technology."
@@ -138,6 +139,8 @@ Frequency:
w_type = RECYK_ELECTRONIC
origin_tech = "magnets=1;bluespace=3"
var/list/portals = list()
var/charges = HANDTELE_MAX_CHARGES//how many pairs of portal can the hand-tele sustain at once. a new charge is added every 30 seconds until the maximum is reached..
var/recharging = 0
/obj/item/weapon/hand_tele/attack_self(mob/user as mob)
var/turf/current_location = get_turf(user)//What turf is the user on?
@@ -172,18 +175,45 @@ Frequency:
var/t1 = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") in L
if ((user.get_active_hand() != src || user.stat || user.restrained()))
if((user.get_active_hand() != src || user.stat || user.restrained()))
return
if(portals.len >= 3)
if(charges < 1)
user.show_message("<span class='notice'>\The [src] is recharging!</span>")
return
var/T = L[t1]
for(var/mob/O in hearers(user, null))
O.show_message("<span class='notice'>Locked In.</span>", 2)
var/obj/effect/portal/P = new /obj/effect/portal( get_turf(src) )
P.target = T
P.creator = src
portals += P
if(prob(5))
T = locate(rand(7, world.maxx - 7), rand(7, world.maxy -7), 3)
var/turf/U = get_turf(src)
U.visible_message("<span class='notice'>Locked In.</span>")
var/obj/effect/portal/P1 = new (U)
var/obj/effect/portal/P2 = new (get_turf(T))
P1.target = P2
P2.target = P1
P2.icon_state = "portal1"
P1.creator = src
P2.creator = src
P1.blend_icon(P2)
P2.blend_icon(P1)
portals += P1
portals += P2
src.add_fingerprint(user)
charges--
if(!recharging)
recharging = 1
spawn()
recharges()
/obj/item/weapon/hand_tele/proc/recharges()
sleep(300)
charges = max(charges+1,HANDTELE_MAX_CHARGES)
if(charges == HANDTELE_MAX_CHARGES)
recharging = 0
return
recharges()
#undef HANDTELE_MAX_CHARGES

View File

@@ -182,7 +182,7 @@
return 0
return 1 //Nothing found to block so return success!
/turf/Entered(atom/movable/Obj,atom/OldLoc)
/turf/Entered(atom/movable/Obj,atom/OldLoc,var/ignore_portals=0)
var/loopsanity = 100
if(ismob(Obj))

View File

@@ -148,4 +148,4 @@ var/list/obj/machinery/prism/prism_list = list()
else
icon_state = "prism_off"
qdel(beam)
beam=null
beam=null

View File

@@ -0,0 +1,112 @@
/obj/item/weapon/gun/portalgun //-by Deity Link
name = "\improper Portal Gun"
desc = "There's a hole in the sky... through which I can fly."
icon = 'icons/obj/gun_experimental.dmi'
icon_state = "portalgun0"
item_state = "portalgun0"
slot_flags = SLOT_BELT
origin_tech = "materials=7;bluespace=6;magnets=5"
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/guns_experimental.dmi', "right_hand" = 'icons/mob/in-hand/right/guns_experimental.dmi')
recoil = 0
flags = FPRINT
w_class = 3.0
fire_delay = 0
fire_sound = 'sound/weapons/portalgun_blue.ogg'
var/setting = 0 //0 = Blue, 1 = Red.
var/obj/effect/portal/blue_portal = null
var/obj/effect/portal/red_portal = null
/obj/item/weapon/gun/portalgun/examine(mob/user)
..()
switch(setting)
if(0)
user << "It's current setting is <font color='#0066FF'>blue</font>."
if(1)
user << "It's current setting is <font color='#FF6600'>red</font>."
/obj/item/weapon/gun/portalgun/Destroy()
if(blue_portal)
qdel(blue_portal)
blue_portal = null
if(red_portal)
qdel(red_portal)
red_portal = null
..()
/obj/item/weapon/gun/portalgun/process_chambered()
if(in_chamber) return 1
in_chamber = new/obj/item/projectile/portalgun(src)
var/obj/item/projectile/portalgun/P = in_chamber
P.icon_state = "portalgun[setting]"
P.setting = setting
return 1
/obj/item/weapon/gun/portalgun/attack_self(mob/user)
switch(setting)
if(0)
setting = 1
fire_sound = 'sound/weapons/portalgun_red.ogg'
user << "Now set to fire <font color='#FF6600'>red portals</font>."
if(1)
setting = 0
fire_sound = 'sound/weapons/portalgun_blue.ogg'
user << "Now set to fire <font color='#0066FF'>blue portals</font>."
update_icon()
user.regenerate_icons()
/obj/item/weapon/gun/portalgun/update_icon()
icon_state = "portalgun[setting]"
item_state = "portalgun[setting]"
/obj/item/weapon/gun/portalgun/proc/open_portal(var/proj_setting,var/turf/T,var/atom/A = null)
if(!T)
return
var/obj/effect/portal/new_portal = new(T,3000)//Portal Gun-made portals stay open for 5 minutes by default.
switch(setting)
if(0)
if(blue_portal)
qdel(blue_portal)
blue_portal = null
blue_portal = new_portal
blue_portal.creator = src
if(1)
if(red_portal)
qdel(red_portal)
red_portal = null
red_portal = new_portal
red_portal.icon_state = "portal1"
red_portal.creator = src
sync_portals()
if(A && isliving(A))
new_portal.Crossed(A)
/obj/item/weapon/gun/portalgun/proc/sync_portals()
if(!blue_portal)
if(red_portal)
red_portal.overlays.len = 0
red_portal.target = null
return
if(!red_portal)
if(blue_portal)
blue_portal.overlays.len = 0
blue_portal.target = null
return
//connecting the portals
blue_portal.target = red_portal
red_portal.target = blue_portal
//updating their sprites
blue_portal.blend_icon(red_portal)
red_portal.blend_icon(blue_portal)
//updating the emitter beams that move through them
blue_portal.purge_beams()
red_portal.purge_beams()
blue_portal.add_beams()
red_portal.add_beams()

View File

@@ -266,6 +266,7 @@ var/list/beam_master = list()
flag = "laser"
eyeblur = 4
var/frequency = 1
var/wait = 0
/obj/item/projectile/beam/OnFired() //if assigned, allows for code when the projectile gets fired
target = get_turf(original)
@@ -340,14 +341,18 @@ var/list/beam_master = list()
var/atom/step = get_step(src, dB)
if(!step)
bullet_die()
world << "Move()"
src.Move(step)
world << "Proj at ([x],[y])"
error += distA
target_dir = null
else
var/atom/step = get_step(src, dA)
if(!step)
bullet_die()
world << "Move()"
src.Move(step)
world << "Proj at ([x],[y])"
error -= distB
target_dir = dA
if(error < 0)
@@ -417,6 +422,9 @@ var/list/beam_master = list()
if(tS)
timestopped = loc.timestopped
tS = 0
if(wait)
sleep(wait)
wait = 0
while((loc.timestopped || timestopped) && !first)
sleep(3)
first = 0

View File

@@ -279,3 +279,36 @@ obj/item/projectile/kinetic/New()
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
/obj/item/projectile/portalgun
name = "portal gun shot"
icon = 'icons/obj/projectiles_experimental.dmi'
icon_state = "portalgun"
damage = 0
nodamage = 1
kill_count = 500//enough to cross a ZLevel...twice!
var/setting = 0
/obj/item/projectile/portalgun/bump_original_check()//so players can aim at floors
if(!bumped)
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
/obj/item/projectile/portalgun/Bump(atom/A as mob|obj|turf|area)
if(bumped)
return
bumped = 1
if(!istype(shot_from,/obj/item/weapon/gun/portalgun))
bullet_die()
return
var/obj/item/weapon/gun/portalgun/P = shot_from
if(isliving(A))
forceMove(get_step(loc,dir))
if(!(locate(/obj/effect/portal) in loc))
P.open_portal(setting,loc,A)
bullet_die()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1499,6 +1499,7 @@
#include "code\modules\projectiles\guns\hookshot.dm"
#include "code\modules\projectiles\guns\lawgiver.dm"
#include "code\modules\projectiles\guns\projectile.dm"
#include "code\modules\projectiles\guns\special.dm"
#include "code\modules\projectiles\guns\energy\gravitywell.dm"
#include "code\modules\projectiles\guns\energy\laser.dm"
#include "code\modules\projectiles\guns\energy\nuclear.dm"