mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #219 from caelaislinn/master
new conveyors, diverters, partially fixed ultralight, new helper proc
This commit is contained in:
@@ -140,6 +140,7 @@
|
||||
#define FILE_DIR "code/unused/pda2"
|
||||
#define FILE_DIR "code/unused/spacecraft"
|
||||
#define FILE_DIR "code/WorkInProgress"
|
||||
#define FILE_DIR "code/WorkInProgress/Cael_Aislinn"
|
||||
#define FILE_DIR "code/WorkInProgress/mapload"
|
||||
#define FILE_DIR "code/WorkInProgress/Mini"
|
||||
#define FILE_DIR "code/WorkInProgress/organs"
|
||||
@@ -999,6 +1000,7 @@
|
||||
#include "code\WorkInProgress\buildmode.dm"
|
||||
#include "code\WorkInProgress\detective_work.dm"
|
||||
#include "code\WorkInProgress\explosion_particles.dm"
|
||||
#include "code\WorkInProgress\Cael_Aislinn\MultiZ.dm"
|
||||
#include "code\WorkInProgress\mapload\dmm_suite.dm"
|
||||
#include "code\WorkInProgress\mapload\reader.dm"
|
||||
#include "code\WorkInProgress\Mini\atmos_control.dm"
|
||||
|
||||
189
code/WorkInProgress/Cael_Aislinn/MultiZ.dm
Normal file
189
code/WorkInProgress/Cael_Aislinn/MultiZ.dm
Normal file
@@ -0,0 +1,189 @@
|
||||
/obj/multiz
|
||||
icon = 'multiz.dmi'
|
||||
density = 0
|
||||
opacity = 0
|
||||
anchored = 1
|
||||
var/istop = 1
|
||||
|
||||
CanPass(obj/mover, turf/source, height, airflow)
|
||||
return airflow || !density
|
||||
|
||||
/obj/multiz/proc/targetZ()
|
||||
return src.z + (istop ? 1 : -1)
|
||||
|
||||
/obj/multiz/ladder
|
||||
icon_state = "ladderdown"
|
||||
name = "ladder"
|
||||
desc = "A Ladder. You climb up and down it."
|
||||
|
||||
/obj/multiz/ladder/New()
|
||||
..()
|
||||
if (!istop)
|
||||
icon_state = "ladderup"
|
||||
else
|
||||
icon_state = "ladderdown"
|
||||
|
||||
/obj/multiz/ladder/attack_paw(var/mob/M)
|
||||
return attack_hand(M)
|
||||
|
||||
/obj/multiz/ladder/attackby(var/W, var/mob/M)
|
||||
return attack_hand(M)
|
||||
|
||||
/obj/multiz/ladder/attack_hand(var/mob/M)
|
||||
M.Move(locate(src.x, src.y, targetZ()))
|
||||
/*
|
||||
/obj/multiz/ladder/blob_act()
|
||||
var/newblob = 1
|
||||
for(var/obj/blob in locate(src.x, src.y, targetZ()))
|
||||
newblob = 0
|
||||
if(newblob)
|
||||
new /obj/blob(locate(src.x, src.y, targetZ()))
|
||||
*/
|
||||
//Stairs. var/dir on all four component objects should be the dir you'd walk from top to bottom
|
||||
//active = bump to move down
|
||||
//active/bottom = bump to move up
|
||||
//enter = decorative downwards stairs
|
||||
//enter/bottom = decorative upward stairs
|
||||
/obj/multiz/stairs
|
||||
name = "Stairs"
|
||||
desc = "Stairs. You walk up and down them."
|
||||
icon_state = "ramptop"
|
||||
|
||||
/obj/multiz/stairs/New()
|
||||
icon_state = istop ^ istype(src, /obj/multiz/stairs/active) ? "ramptop" : "rampbottom"
|
||||
|
||||
/obj/multiz/stairs/enter/bottom
|
||||
istop = 0
|
||||
|
||||
/obj/multiz/stairs/active
|
||||
density = 1
|
||||
|
||||
/obj/multiz/stairs/active/Bumped(var/atom/movable/M)
|
||||
if(istype(src, /obj/multiz/stairs/active/bottom) && !locate(/obj/multiz/stairs/enter) in M.loc)
|
||||
return //If on bottom, only let them go up stairs if they've moved to the entry tile first.
|
||||
//If it's the top, they can fall down just fine.
|
||||
if(ismob(M) && M:client)
|
||||
M:client.moving = 1
|
||||
M.Move(locate(src.x, src.y, targetZ()))
|
||||
if (ismob(M) && M:client)
|
||||
M:client.moving = 0
|
||||
|
||||
/obj/multiz/stairs/active/Click()
|
||||
if(!istype(usr,/mob/dead/observer))
|
||||
return ..()
|
||||
usr.client.moving = 1
|
||||
usr.Move(locate(src.x, src.y, targetZ()))
|
||||
usr.client.moving = 0
|
||||
/obj/multiz/stairs/active/bottom
|
||||
istop = 0
|
||||
opacity = 1
|
||||
|
||||
/turf/simulated/floor/open
|
||||
name = "open space"
|
||||
intact = 0
|
||||
icon_state = "open"
|
||||
pathweight = 100000 //Seriously, don't try and path over this one numbnuts
|
||||
var/icon/darkoverlays = null
|
||||
var/turf/floorbelow
|
||||
//floorstrength = 1
|
||||
mouse_opacity = 2
|
||||
|
||||
New()
|
||||
..()
|
||||
spawn(1)
|
||||
if(!istype(src, /turf/simulated/floor/open)) //This should not be needed but is.
|
||||
return
|
||||
floorbelow = locate(x, y, z + 1)
|
||||
if(floorbelow)
|
||||
//Fortunately, I've done this before. - Aryn
|
||||
if(istype(floorbelow,/turf/space) || floorbelow.z > 4)
|
||||
new/turf/space(src)
|
||||
else if(!istype(floorbelow,/turf/simulated/floor))
|
||||
new/turf/simulated/floor/plating(src)
|
||||
else
|
||||
//if(ticker)
|
||||
//find_zone()
|
||||
update()
|
||||
else
|
||||
new/turf/space(src)
|
||||
|
||||
Del()
|
||||
. = ..()
|
||||
|
||||
Enter(var/atom/movable/AM)
|
||||
if (..()) //TODO make this check if gravity is active (future use) - Sukasa
|
||||
spawn(1)
|
||||
if(AM)
|
||||
AM.Move(locate(x, y, z + 1))
|
||||
if (istype(AM, /mob))
|
||||
AM:bruteloss += 20 //You were totally doin it wrong. 5 damage? Really? - Aryn
|
||||
AM:weakened = max(AM:weakened,5)
|
||||
AM:updatehealth()
|
||||
return ..()
|
||||
|
||||
attackby()
|
||||
//nothing
|
||||
|
||||
proc/update() //Update the overlayss to make the openspace turf show what's down a level
|
||||
if(!floorbelow) return
|
||||
/*src.clearoverlays()
|
||||
src.addoverlay(floorbelow)
|
||||
for(var/obj/o in floorbelow.contents)
|
||||
src.addoverlay(image(o, dir=o.dir, layer = TURF_LAYER+0.05*o.layer))
|
||||
var/image/I = image('ULIcons.dmi', "[min(max(floorbelow.LightLevelRed - 4, 0), 7)]-[min(max(floorbelow.LightLevelGreen - 4, 0), 7)]-[min(max(floorbelow.LightLevelBlue - 4, 0), 7)]")
|
||||
I.layer = TURF_LAYER + 0.2
|
||||
src.addoverlay(I)
|
||||
I = image('ULIcons.dmi', "1-1-1")
|
||||
I.layer = TURF_LAYER + 0.2
|
||||
src.addoverlay(I)*/
|
||||
|
||||
var/maxZ = 1
|
||||
var/minZ = 1
|
||||
|
||||
// Maybe it's best to have this hardcoded for whatever we'd add to the map, in order to avoid exploits
|
||||
// (such as mining base => admin station)
|
||||
// Note that this assumes the ship's top is at z=1 and bottom at z=4
|
||||
/obj/item/weapon/tank/jetpack/proc/move_z(cardinal, mob/user as mob)
|
||||
if (user.z > 1)
|
||||
user << "\red There is nothing of interest in that direction."
|
||||
return
|
||||
if(allow_thrust(0.01, user))
|
||||
switch(cardinal)
|
||||
if (UP) // Going up!
|
||||
if(user.z > maxZ) // If we aren't at the very top of the ship
|
||||
var/turf/T = locate(user.x, user.y, user.z - 1)
|
||||
// You can only jetpack up if there's space above, and you're sitting on either hull (on the exterior), or space
|
||||
//if(T && istype(T, /turf/space) && (istype(user.loc, /turf/space) || istype(user.loc, /turf/space/*/hull*/)))
|
||||
//check through turf contents to make sure there's nothing blocking the way
|
||||
if(T && istype(T, /turf/space))
|
||||
var/blocked = 0
|
||||
for(var/atom/A in T.contents)
|
||||
if(T.density)
|
||||
blocked = 1
|
||||
user << "\red You bump into [T.name]."
|
||||
break
|
||||
if(!blocked)
|
||||
user.Move(T)
|
||||
else
|
||||
user << "\red You bump into the ship's plating."
|
||||
else
|
||||
user << "\red The ship's gravity well keeps you in orbit!" // Assuming the ship starts on z level 1, you don't want to go past it
|
||||
|
||||
if (DOWN) // Going down!
|
||||
if (user.z < 1) // If we aren't at the very bottom of the ship, or out in space
|
||||
var/turf/T = locate(user.x, user.y, user.z + 1)
|
||||
// You can only jetpack down if you're sitting on space and there's space down below, or hull
|
||||
if(T && (istype(T, /turf/space) || istype(T, /turf/space/*/hull*/)) && istype(user.loc, /turf/space))
|
||||
var/blocked = 0
|
||||
for(var/atom/A in T.contents)
|
||||
if(T.density)
|
||||
blocked = 1
|
||||
user << "\red You bump into [T.name]."
|
||||
break
|
||||
if(!blocked)
|
||||
user.Move(T)
|
||||
else
|
||||
user << "\red You bump into the ship's plating."
|
||||
else
|
||||
user << "\red The ship's gravity well keeps you in orbit!"
|
||||
|
||||
BIN
code/WorkInProgress/Cael_Aislinn/multiz.dmi
Normal file
BIN
code/WorkInProgress/Cael_Aislinn/multiz.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
code/WorkInProgress/Cael_Aislinn/multiz_pipe.dmi
Normal file
BIN
code/WorkInProgress/Cael_Aislinn/multiz_pipe.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1453,3 +1453,21 @@ proc/safepick(list/list)
|
||||
return
|
||||
return pick(list)
|
||||
|
||||
proc/get_opposite(var/checkdir)
|
||||
switch(checkdir)
|
||||
if(NORTH)
|
||||
return SOUTH
|
||||
if(SOUTH)
|
||||
return NORTH
|
||||
if(EAST)
|
||||
return WEST
|
||||
if(WEST)
|
||||
return EAST
|
||||
if(NORTHEAST)
|
||||
return SOUTHWEST
|
||||
if(NORTHWEST)
|
||||
return SOUTHEAST
|
||||
if(SOUTHEAST)
|
||||
return NORTHWEST
|
||||
if(SOUTHWEST)
|
||||
return NORTHEAST
|
||||
@@ -9,46 +9,71 @@
|
||||
anchored = 1
|
||||
var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off
|
||||
var/operable = 1 // true if can operate (no broken segments in this belt run)
|
||||
var/forwards // this is the default (forward) direction, set by the map dir
|
||||
var/backwards // hopefully self-explanatory
|
||||
var/forwards // this is the default (forward) direction, set by the map dir, can be 0
|
||||
var/backwards // hopefully self-explanatory, can be 0
|
||||
var/movedir // the actual direction to move stuff in
|
||||
|
||||
var/list/affecting // the list of all items that will be moved this ptick
|
||||
var/id = "" // the control ID - must match controller ID
|
||||
|
||||
//these ones below for backwards compatibility
|
||||
|
||||
// following two only used if a diverter is present
|
||||
var/divert_from = 0 // if non-zero, direction to divert items
|
||||
var/divert_to = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense)
|
||||
var/basedir // this is the default (forward) direction, set by the map dir
|
||||
// note dir var can vary when the direction changes
|
||||
|
||||
//cael - corner icon bug that needs a manual fix
|
||||
//note: for now, the sprites/anis and their directions are mostly independant from the actual conveyor move directions
|
||||
//if no conveyor move directions are specified, they are calculated from the sprite dir
|
||||
var/reverseSpriteMoveDir = 0
|
||||
|
||||
// create a conveyor
|
||||
/obj/machinery/conveyor/New()
|
||||
..()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
forwards = NORTH
|
||||
backwards = SOUTH
|
||||
if(SOUTH)
|
||||
forwards = SOUTH
|
||||
backwards = NORTH
|
||||
if(EAST)
|
||||
forwards = EAST
|
||||
backwards = WEST
|
||||
if(WEST)
|
||||
forwards = WEST
|
||||
backwards = EAST
|
||||
if(NORTHEAST)
|
||||
forwards = EAST
|
||||
backwards = SOUTH
|
||||
if(NORTHWEST)
|
||||
forwards = SOUTH
|
||||
backwards = WEST
|
||||
if(SOUTHEAST)
|
||||
forwards = NORTH
|
||||
backwards = EAST
|
||||
if(SOUTHWEST)
|
||||
forwards = WEST
|
||||
backwards = NORTH
|
||||
//added these to allow for custom conveyor dirs defined in map
|
||||
if(!forwards)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
forwards = NORTH
|
||||
if(SOUTH)
|
||||
forwards = SOUTH
|
||||
if(EAST)
|
||||
forwards = EAST
|
||||
if(WEST)
|
||||
forwards = WEST
|
||||
if(NORTHEAST)
|
||||
forwards = EAST
|
||||
if(NORTHWEST)
|
||||
forwards = WEST
|
||||
if(SOUTHEAST)
|
||||
forwards = EAST
|
||||
if(SOUTHWEST)
|
||||
forwards = WEST
|
||||
if(!backwards)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
backwards = SOUTH
|
||||
if(SOUTH)
|
||||
backwards = NORTH
|
||||
if(EAST)
|
||||
backwards = WEST
|
||||
if(WEST)
|
||||
backwards = EAST
|
||||
if(NORTHEAST)
|
||||
backwards = SOUTH
|
||||
if(NORTHWEST)
|
||||
backwards = SOUTH
|
||||
if(SOUTHEAST)
|
||||
backwards = NORTH
|
||||
if(SOUTHWEST)
|
||||
backwards = NORTH
|
||||
|
||||
/obj/machinery/conveyor/proc/setmove()
|
||||
if(operating == 1)
|
||||
if(operating > 0)
|
||||
movedir = forwards
|
||||
else
|
||||
else if(operating < 0)
|
||||
movedir = backwards
|
||||
update()
|
||||
|
||||
@@ -61,7 +86,7 @@
|
||||
operating = 0
|
||||
if(stat & NOPOWER)
|
||||
operating = 0
|
||||
icon_state = "conveyor[operating]"
|
||||
icon_state = "conveyor[operating * (reverseSpriteMoveDir?-1:1)]"
|
||||
|
||||
// machine process
|
||||
// move items to the target location
|
||||
@@ -72,6 +97,17 @@
|
||||
return
|
||||
use_power(100)
|
||||
|
||||
// update if diverter present
|
||||
// if movedir == forwards, therefore if divert_to != 0 and divert_from == backwards, then set movedir = divert_to
|
||||
// if movedir == backwards, therefore if divert_to != 0 and divert_from == forwards, then set movedir = divert_to
|
||||
//if(divert_to && divert_from == (movedir == backwards ? forwards : backwards ) )
|
||||
//movedir = divert_to
|
||||
if(divert_to)
|
||||
if( movedir == forwards && divert_from == backwards )
|
||||
movedir = divert_to
|
||||
else if( movedir == backwards && divert_from == forwards )
|
||||
movedir = divert_to
|
||||
|
||||
affecting = loc.contents - src // moved items will be all in loc
|
||||
spawn(1) // slight delay to prevent infinite propagation due to map order
|
||||
var/items_moved = 0
|
||||
@@ -221,3 +257,129 @@
|
||||
if(S.id == src.id)
|
||||
S.position = position
|
||||
S.update()
|
||||
|
||||
// converyor diverter
|
||||
// extendable arm that can be switched so items on the conveyer are diverted sideways
|
||||
// situate in same turf as conveyor
|
||||
// only works if belts is running proper direction
|
||||
//
|
||||
//
|
||||
/obj/machinery/diverter
|
||||
icon = 'recycling.dmi'
|
||||
icon_state = "diverter0"
|
||||
name = "diverter"
|
||||
desc = "A diverter arm for a conveyor belt."
|
||||
anchored = 1
|
||||
layer = FLY_LAYER
|
||||
var/obj/machinery/conveyor/conv // the conveyor this diverter works on
|
||||
var/deployed = 0 // true if diverter arm is extended
|
||||
var/operating = 0 // true if arm is extending/contracting
|
||||
var/divert_to // the dir that diverted items will be moved
|
||||
var/divert_from // the dir items must be moving to divert
|
||||
|
||||
// create a diverter
|
||||
// set up divert_to and divert_from directions depending on dir state
|
||||
/obj/machinery/diverter/New()
|
||||
..()
|
||||
//cael - the icon states are all derped, so these won't make sense.
|
||||
//just place the diverter according to which icon state is correct
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
divert_to = WEST//
|
||||
divert_from = SOUTH//
|
||||
if(SOUTH)
|
||||
divert_to = EAST//
|
||||
divert_from = SOUTH//NORTH
|
||||
if(EAST)
|
||||
divert_to = EAST//
|
||||
divert_from = NORTH//SOUTH
|
||||
if(WEST)
|
||||
divert_to = WEST//
|
||||
divert_from = NORTH//
|
||||
if(NORTHEAST)
|
||||
divert_to = NORTH//
|
||||
divert_from = WEST//EAST
|
||||
if(NORTHWEST)
|
||||
divert_to = NORTH//
|
||||
divert_from = EAST//WEST
|
||||
if(SOUTHEAST)
|
||||
divert_to = SOUTH//
|
||||
divert_from = WEST//EAST
|
||||
if(SOUTHWEST)
|
||||
divert_to = SOUTH//
|
||||
divert_from = EAST//WEST
|
||||
spawn(2)
|
||||
// wait for map load then find the conveyor in this turf
|
||||
conv = locate() in src.loc
|
||||
if(conv) // divert_from dir must match possible conveyor movement
|
||||
if(conv.backwards != divert_from && conv.backwards != turn(divert_from,180) )
|
||||
del(src) // if no dir match, then delete self
|
||||
set_divert()
|
||||
update()
|
||||
|
||||
// update the icon state depending on whether the diverter is extended
|
||||
/obj/machinery/diverter/proc/update()
|
||||
icon_state = "diverter[deployed]"
|
||||
|
||||
// call to set the diversion vars of underlying conveyor
|
||||
/obj/machinery/diverter/proc/set_divert()
|
||||
if(conv)
|
||||
if(deployed)
|
||||
conv.divert_to = divert_to
|
||||
conv.divert_from = divert_from
|
||||
else
|
||||
conv.divert_to = 0
|
||||
conv.divert_from = 0
|
||||
conv.setmove()
|
||||
|
||||
|
||||
// *** TESTING click to toggle
|
||||
/obj/machinery/diverter/Click()
|
||||
toggle()
|
||||
|
||||
|
||||
// toggle between arm deployed and not deployed, showing animation
|
||||
//
|
||||
/obj/machinery/diverter/proc/toggle()
|
||||
if( stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
if(operating)
|
||||
return
|
||||
|
||||
use_power(50)
|
||||
operating = 1
|
||||
if(deployed)
|
||||
flick("diverter10",src)
|
||||
icon_state = "diverter0"
|
||||
sleep(10)
|
||||
deployed = 0
|
||||
else
|
||||
flick("diverter01",src)
|
||||
icon_state = "diverter1"
|
||||
sleep(10)
|
||||
deployed = 1
|
||||
operating = 0
|
||||
update()
|
||||
set_divert()
|
||||
|
||||
// don't allow movement into the 'backwards' direction if deployed
|
||||
/obj/machinery/diverter/CanPass(atom/movable/O, var/turf/target)
|
||||
var/direct = get_dir(O, target)
|
||||
if(direct == divert_to) // prevent movement through body of diverter
|
||||
return 0
|
||||
if(!deployed)
|
||||
return 1
|
||||
return(direct != divert_from)
|
||||
|
||||
// don't allow movement through the arm if deployed
|
||||
/obj/machinery/diverter/CheckExit(atom/movable/O, var/turf/target)
|
||||
var/direct = get_dir(O, target)
|
||||
if(direct == turn(divert_to,180)) // prevent movement through body of diverter
|
||||
return 0
|
||||
if(!deployed)
|
||||
return 1
|
||||
return(direct != turn(divert_from,180))
|
||||
|
||||
//divert_to = NORTH
|
||||
//divert_from = EAST
|
||||
@@ -227,11 +227,13 @@ atom/proc/Del()
|
||||
|
||||
return
|
||||
|
||||
atom/proc/movable/Move()
|
||||
// formerly atom/proc/movable/Move(), this now overwrites other shit causing random inexplicable problems.
|
||||
// need to find a way to plug it in to the root without overriding, might just do the snowflake treatment
|
||||
/*atom/proc/Move()
|
||||
ul_Extinguish()
|
||||
..()
|
||||
ul_Illuminate()
|
||||
return
|
||||
return*/
|
||||
|
||||
turf
|
||||
var
|
||||
|
||||
980
maps/Antiqua.dmm
980
maps/Antiqua.dmm
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user