From f9a3951139b9909a77e80be3fc0bda49bf15842c Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Mon, 18 May 2015 15:24:35 -0700 Subject: [PATCH] MT/TS: Rails This commit converts the MT/TS control system from a debugging move panel to a on-rails system. The controlpad has been repurposed as an on/off button. --- code/modules/tram/tram.dm | 47 ++++++++++++++++++++++---- code/modules/tram/tram_control_pad.dm | 22 +++++++++--- code/modules/tram/tram_floor.dm | 1 + code/modules/tram/tram_rail.dm | 6 ++++ icons/obj/tram/tram_rail.dmi | Bin 0 -> 1471 bytes paradise.dme | 1 + 6 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 code/modules/tram/tram_rail.dm create mode 100644 icons/obj/tram/tram_rail.dmi diff --git a/code/modules/tram/tram.dm b/code/modules/tram/tram.dm index 8137450331d..b5186662811 100644 --- a/code/modules/tram/tram.dm +++ b/code/modules/tram/tram.dm @@ -12,23 +12,44 @@ var/list/collide_list = list() var/list/stored_anchor = list() + var/last_played_rail + + var/automode = 0 + var/list/blacklist = list(/obj/tram/rail,/atom/movable/lighting_overlay) /obj/tram/tram_controller/New() - init_floors() //Search and link floors - init_walls() //Search and link walls spawn(1) - init_tram() //Combine walls and floors and anything inside the tram - init_controllers() //Find control pads - gen_collision() //Generate collision system - processing_objects.Add(src) //Add to processing objects manually + init_floors() //Search and link floors + init_walls() //Search and link walls + spawn(1) + init_tram() //Combine walls and floors and anything inside the tram + init_controllers() //Find control pads + gen_collision() //Generate collision system + processing_objects.Add(src) //Add to processing objects manually /obj/tram/tram_controller/process() update_tram() //Update combine to account for new mobs and/or objects + if(automode) + tram_rail_follow() /obj/tram/tram_controller/proc/update_tram() tram.Cut() init_tram() +/obj/tram/tram_controller/proc/tram_rail_follow() + var/stored_rail = null + for(var/obj/tram/rail/RT in get_turf(src)) + if(RT.godir) + handle_move(RT.godir) + last_played_rail = RT + return + stored_rail = RT + for(var/cdir in cardinal) + for(var/obj/tram/rail/R in get_step(src,cdir)) + if(R != last_played_rail) + handle_move(get_dir(src,R)) + last_played_rail = stored_rail + //INITIALIZATION PROCS /obj/tram/tram_controller/proc/init_floors() @@ -66,6 +87,7 @@ var/turf/T = get_turf(OT) for(var/atom/movable/AM in T) //Including anything inside of it if(AM in tram) continue + if(is_type_in_list(AM, blacklist)) continue tram += AM /obj/tram/tram_controller/proc/init_controllers() @@ -129,6 +151,17 @@ if(A.density) if(tram.Find(A)) continue collisions += cdir + for(var/obj/tram/floor/F in tram_floors) + for(var/cdir in cardinal) + var/turf/T = get_step(F, cdir) + if(istype(T)) + if(T.density) + collisions += cdir + if(!T.density) + for(var/atom/movable/A in T) + if(A.density) + if(tram.Find(A)) continue + collisions += cdir collide_list = collisions /obj/tram/tram_controller/proc/handle_move(var/dir) @@ -138,5 +171,7 @@ for(var/atom/movable/A in tram) var/turf/T = get_step(A,dir) A.forceMove(T) //Move everything inside the tram and the tram itself manually + if(A.light_range) + A.set_light() gen_collision() //Generate collision again return 1 \ No newline at end of file diff --git a/code/modules/tram/tram_control_pad.dm b/code/modules/tram/tram_control_pad.dm index 33cc7807bbb..1176ae5a3a9 100644 --- a/code/modules/tram/tram_control_pad.dm +++ b/code/modules/tram/tram_control_pad.dm @@ -4,16 +4,28 @@ icon = 'icons/obj/airlock_machines.dmi' icon_state = "airlock_control_standby" var/obj/tram/tram_controller/tram_linked + var/list/cdir2readable = list("North","South",null,"East",null,null,null,"West") /obj/tram/controlpad/attack_hand(var/mob/user) + usr.set_machine(src) if(!tram_linked) return var/dat = "Tram Controller" - for(var/cdir in cardinal) - dat += "
Move to: [cdir]" + dat += "
Tram engine: [tram_linked.automode ? "On" : "Off"]" + dat += "
Close console" user << browse(dat, "window=trampad") onclose(user,"trampad") /obj/tram/controlpad/Topic(href, href_list) - if(href_list["movedir"]) - var/dir = text2num(href_list["movedir"]) - tram_linked.handle_move(dir) \ No newline at end of file + if(..()) + usr << browse(null, "window=publiclibrary") + onclose(usr, "publiclibrary") + return + + if(href_list["engine_toggle"]) + tram_linked.automode = !tram_linked.automode + else if(href_list["close"]) + usr.unset_machine() + usr << browse(null, "window=trampad") + + src.add_fingerprint(usr) + src.updateUsrDialog() \ No newline at end of file diff --git a/code/modules/tram/tram_floor.dm b/code/modules/tram/tram_floor.dm index 245136d3c95..74c863dde53 100644 --- a/code/modules/tram/tram_floor.dm +++ b/code/modules/tram/tram_floor.dm @@ -4,6 +4,7 @@ icon_state = "floor" var/obj/tram/tram_controller/controller anchored = 1 + layer = TURF_LAYER + 0.2 /obj/tram/floor/proc/spread_floors() var/turf/T = get_turf(src) diff --git a/code/modules/tram/tram_rail.dm b/code/modules/tram/tram_rail.dm new file mode 100644 index 00000000000..bf14d23fea3 --- /dev/null +++ b/code/modules/tram/tram_rail.dm @@ -0,0 +1,6 @@ +/obj/tram/rail + name = "tram rail" + desc = "A guiding rail for trams" + icon = 'icons/obj/tram/tram_rail.dmi' + icon_state = "rail" + var/godir = null \ No newline at end of file diff --git a/icons/obj/tram/tram_rail.dmi b/icons/obj/tram/tram_rail.dmi new file mode 100644 index 0000000000000000000000000000000000000000..abe799beef24f9d432be7290052cfd3a7d411f42 GIT binary patch literal 1471 zcmZ{kc`(}x5XXOs7iXpFj3W085=Rwv1SLTmv?3_sDUqVlc&<8H9mlA< zw2nH*T~#_f+PdPZlvEIBg=k6QCdCr>3x%>lZCPl6EyJRi~`6v`>)Y5F=k|jSh@4DbAXdC3!A(t4C3ZC3H>Zg_ z*K6l5CIQDGY|eUGZK3sF90AO)FSxa&4Zy!0szUw`mHGQgZwHq~vCNo=!xILsMcMRv zeh{s6t{4e0!`tmn&eta0o7z6W%qIydGHhB*TY*V>*c9)n>}n!wh8-DZawI-7JQmfL z#X5Dj>*c0L540pCPQ_0-jHsg+SH$d8SBl)*5OO_|^Z%$l9c^!D!n7my-}1}UvEVjl z8D-1WW6N`}>32?gfEJ-vwdICS4zlclw@xIYQeA)VMn^R0%M$n7&d4xvWrIZMe+`{3d_Zj73_A2m^yUIaz*O^pO zp5NivRgAacjN7%>Xc8uC`@6e5S~PuO5jiDt!_rfznj@>AO@c;|YKZR*L6J2Au4w~l zQYvZCD2q8*nhfbR)ai$go(lkH0&d)_aPXR|P&JGquW12;r#3WSf}IDbpk#h&VJb)= zT%Jkl=dZk+MW@f4aOh|b&-+X(E}*wXLdo2OS=vF!p2x!T>?&w81>#tDfxe>o9o6JM zIdt(-(+6{C209nNRE72s0A1*4b(yF37+W`@2CBcZq%o7`Z)RuZ*}h};JIYTzmg>hm z;z`6OyJ~DYJ%HnMEX*V5^S*Vp)r!zE*z|q8%?aw{G>gTOS`AG9-FM&b-0{^R)~)dw z>y=yU)9tp3=piFa_JZihNRlI}?JjYWcVJM}9v&c=UX@i@jo*ne+ zg}niAwor`~Si`^!K&9CDDE%7M*iDDPpGknDLwi&3tgYhJ;9k2=ER&F(7?(|+q{fL% z>x}?-Wb7__N*wvXo$4sjO6!W^sTNV!7rP+Z4CWlAaDp6Cr7^u3G!#BPva;9Yyiuk_ zeopFg{444+%9||DMY^o&dsSi<>L~QMg7$>w$H!zSE11dqWW8NjJAwR7$9f0;%KlWa zZs_5Dc+a&3^SSr5(=f)wB)2S`0}(H>_77e%BEjke9{rCW%BZs-selS6FaAdcY_B>Z J>MSvde*+in#)SX? literal 0 HcmV?d00001 diff --git a/paradise.dme b/paradise.dme index a8aca9daaf6..c5628c027ab 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1757,6 +1757,7 @@ #include "code\modules\tram\tram.dm" #include "code\modules\tram\tram_control_pad.dm" #include "code\modules\tram\tram_floor.dm" +#include "code\modules\tram\tram_rail.dm" #include "code\modules\tram\tram_wall.dm" #include "code\modules\vehicle\vehicle.dm" #include "code\modules\vehicle\train\train.dm"