mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Mining vault changes.
This commit is contained in:
@@ -185,6 +185,7 @@
|
||||
#include "code\game\atoms.dm"
|
||||
#include "code\game\atoms_movable.dm"
|
||||
#include "code\game\communications.dm"
|
||||
#include "code\game\mining_surprise.dm"
|
||||
#include "code\game\response_team.dm"
|
||||
#include "code\game\shuttle_engines.dm"
|
||||
#include "code\game\skincmd.dm"
|
||||
|
||||
@@ -1,63 +1,8 @@
|
||||
|
||||
var/global/list/space_surprises = list( /obj/item/clothing/mask/facehugger =4,
|
||||
/obj/item/weapon/pickaxe/silver =4,
|
||||
/obj/item/weapon/pickaxe/drill =4,
|
||||
/obj/item/weapon/pickaxe/jackhammer =4,
|
||||
//mob/living/simple_animal/hostile/carp =3,
|
||||
/obj/item/weapon/pickaxe/diamond =3,
|
||||
/obj/item/weapon/pickaxe/diamonddrill =3,
|
||||
/obj/item/weapon/pickaxe/gold =3,
|
||||
/obj/item/weapon/pickaxe/plasmacutter =2,
|
||||
/obj/structure/closet/syndicate/resources =2,
|
||||
/obj/item/weapon/melee/energy/sword/pirate =1,
|
||||
/obj/mecha/working/ripley/mining =1
|
||||
)
|
||||
|
||||
var/global/list/spawned_surprises = list()
|
||||
|
||||
var/global/max_secret_rooms = 3
|
||||
|
||||
proc/spawn_room(var/atom/start_loc,var/x_size,var/y_size,var/wall,var/floor , var/clean = 0 , var/name)
|
||||
var/list/room_turfs = list("walls"=list(),"floors"=list())
|
||||
|
||||
//world << "Room spawned at [start_loc.x],[start_loc.y],[start_loc.z]"
|
||||
if(!wall)
|
||||
wall = pick(/turf/simulated/wall/r_wall,/turf/simulated/wall,/obj/effect/alien/resin)
|
||||
if(!floor)
|
||||
floor = pick(/turf/simulated/floor,/turf/simulated/floor/engine)
|
||||
|
||||
for(var/x = 0,x<x_size,x++)
|
||||
for(var/y = 0,y<y_size,y++)
|
||||
var/turf/T
|
||||
var/cur_loc = locate(start_loc.x+x,start_loc.y+y,start_loc.z)
|
||||
if(clean)
|
||||
for(var/O in cur_loc)
|
||||
del(O)
|
||||
|
||||
var/area/asteroid/artifactroom/A = new
|
||||
if(name)
|
||||
A.name = name
|
||||
else
|
||||
A.name = "Artifact Room #[start_loc.x][start_loc.y][start_loc.z]"
|
||||
|
||||
|
||||
|
||||
if(x == 0 || x==x_size-1 || y==0 || y==y_size-1)
|
||||
if(wall == /obj/effect/alien/resin)
|
||||
T = new floor(cur_loc)
|
||||
new /obj/effect/alien/resin(T)
|
||||
else
|
||||
T = new wall(cur_loc)
|
||||
room_turfs["walls"] += T
|
||||
else
|
||||
T = new floor(cur_loc)
|
||||
room_turfs["floors"] += T
|
||||
|
||||
A.contents += T
|
||||
|
||||
|
||||
return room_turfs
|
||||
|
||||
/* Le broken.
|
||||
proc/admin_spawn_room_at_pos()
|
||||
var/wall
|
||||
var/floor
|
||||
@@ -82,81 +27,60 @@ proc/admin_spawn_room_at_pos()
|
||||
if(x && y && z && wall && floor && x_len && y_len)
|
||||
spawn_room(locate(x,y,z),x_len,y_len,wall,floor,clean)
|
||||
return
|
||||
*/
|
||||
|
||||
proc/check_complex_placement(var/turf/T,var/size_x,var/size_y,var/ignore_walls=0)
|
||||
var/list/surroundings = list()
|
||||
|
||||
surroundings |= range(7, locate(T.x,T.y,T.z))
|
||||
surroundings |= range(7, locate(T.x+size_x,T.y,T.z))
|
||||
surroundings |= range(7, locate(T.x,T.y+size_y,T.z))
|
||||
surroundings |= range(7, locate(T.x+size_x,T.y+size_y,T.z))
|
||||
|
||||
if(locate(/area/mine/explored) in surroundings) // +5s are for view range
|
||||
return 0
|
||||
|
||||
if(locate(/turf/space) in surroundings)
|
||||
return 0
|
||||
|
||||
/* /vg/: Allow combining rooms.
|
||||
if(locate(/area/asteroid/artifactroom) in surroundings)
|
||||
return 0
|
||||
|
||||
proc/make_mining_asteroid_secret(var/size = 5)
|
||||
var/valid = 0
|
||||
if(locate(/turf/unsimulated/floor/asteroid) in surroundings)
|
||||
return 0
|
||||
*/
|
||||
|
||||
// /vg/: Stop spawning shit inside of the vox hideout
|
||||
if(locate(/turf/simulated/wall) in surroundings && !ignore_walls)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
proc/make_mining_asteroid_secret()
|
||||
var/turf/T = null
|
||||
var/sanity = 0
|
||||
var/list/room = null
|
||||
var/list/turfs = null
|
||||
|
||||
|
||||
turfs = get_area_turfs(/area/mine/unexplored)
|
||||
|
||||
if(!turfs.len)
|
||||
return 0
|
||||
|
||||
while(!valid)
|
||||
valid = 1
|
||||
while(1)
|
||||
sanity++
|
||||
if(sanity > 100)
|
||||
testing("Tried to place complex too many times. Aborting.")
|
||||
return 0
|
||||
|
||||
T=pick(turfs)
|
||||
if(!T)
|
||||
return 0
|
||||
|
||||
var/list/surroundings = list()
|
||||
var/complex_type=pick(mining_surprises)
|
||||
var/mining_surprise/complex = new complex_type
|
||||
|
||||
surroundings += range(7, locate(T.x,T.y,T.z))
|
||||
surroundings += range(7, locate(T.x+size,T.y,T.z))
|
||||
surroundings += range(7, locate(T.x,T.y+size,T.z))
|
||||
surroundings += range(7, locate(T.x+size,T.y+size,T.z))
|
||||
if(complex.spawn_complex(T))
|
||||
spawned_surprises += complex
|
||||
return 1
|
||||
|
||||
if(locate(/area/mine/explored) in surroundings) // +5s are for view range
|
||||
valid = 0
|
||||
continue
|
||||
|
||||
if(locate(/turf/space) in surroundings)
|
||||
valid = 0
|
||||
continue
|
||||
|
||||
if(locate(/area/asteroid/artifactroom) in surroundings)
|
||||
valid = 0
|
||||
continue
|
||||
|
||||
if(locate(/turf/unsimulated/floor/asteroid) in surroundings)
|
||||
valid = 0
|
||||
continue
|
||||
|
||||
if(!T)
|
||||
return 0
|
||||
|
||||
room = spawn_room(T,size,size,,,1)
|
||||
|
||||
if(room)
|
||||
T = pick(room["floors"])
|
||||
if(T)
|
||||
var/surprise = null
|
||||
valid = 0
|
||||
while(!valid)
|
||||
surprise = pickweight(space_surprises)
|
||||
if(surprise in spawned_surprises)
|
||||
if(prob(20))
|
||||
valid++
|
||||
else
|
||||
continue
|
||||
else
|
||||
valid++
|
||||
|
||||
spawned_surprises.Add(surprise)
|
||||
new surprise(T)
|
||||
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
var/mob/living/M = src
|
||||
M.take_organ_damage(20)
|
||||
|
||||
// Like Del(), but for qdel.
|
||||
// Called BEFORE qdel moves shit.
|
||||
/atom/proc/QDel()
|
||||
return
|
||||
|
||||
/atom/proc/assume_air(datum/gas_mixture/giver)
|
||||
del(giver)
|
||||
|
||||
225
code/game/mining_surprise.dm
Normal file
225
code/game/mining_surprise.dm
Normal file
@@ -0,0 +1,225 @@
|
||||
#define CONTIGUOUS_WALLS 1
|
||||
#define CONTIGUOUS_FLOORS 2
|
||||
|
||||
|
||||
var/global/list/mining_surprises = typesof(/mining_surprise)-/mining_surprise
|
||||
|
||||
/surprise_room
|
||||
var/list/floors[0]
|
||||
var/list/walls[0]
|
||||
|
||||
var/size_x=0
|
||||
var/size_y=0
|
||||
|
||||
/mining_surprise
|
||||
var/name = "Hidden Complex"
|
||||
|
||||
//: Types of floor to use
|
||||
var/list/floortypes[0]
|
||||
var/list/walltypes[0]
|
||||
var/list/spawntypes[0]
|
||||
|
||||
var/max_richness=2
|
||||
|
||||
//: How many rooms?
|
||||
var/complex_max_size=1
|
||||
|
||||
var/room_size_max=5
|
||||
|
||||
var/flags=0
|
||||
|
||||
var/list/rooms=list()
|
||||
var/list/goodies=list()
|
||||
var/list/candidates=list()
|
||||
|
||||
var/area/asteroid/artifactroom/complex_area
|
||||
|
||||
proc/spawn_complex(var/atom/start_loc)
|
||||
name = "[initial(name)] #[rand(100,999)]"
|
||||
complex_area = new
|
||||
complex_area.name = name
|
||||
var/atom/pos=start_loc
|
||||
var/nrooms=complex_max_size
|
||||
var/maxtries=50
|
||||
var/l_size_x=0
|
||||
var/l_size_y=0
|
||||
while(nrooms && maxtries)
|
||||
var/sx=rand(3,room_size_max)
|
||||
var/sy=rand(3,room_size_max)
|
||||
var/o_x=l_size_x?rand(0,l_size_x):0
|
||||
var/o_y=l_size_y?rand(0,l_size_y):0
|
||||
var/atom/npos
|
||||
switch(pick(cardinal))
|
||||
if(NORTH)
|
||||
npos=locate(pos.x+o_x, pos.y+sy-1, pos.z)
|
||||
if(SOUTH)
|
||||
npos=locate(pos.x+o_x, pos.y-sy+1, pos.z)
|
||||
if(WEST)
|
||||
npos=locate(pos.x-sx-1, pos.y+o_y, pos.z)
|
||||
if(EAST)
|
||||
npos=locate(pos.x+sx+1, pos.y+o_y, pos.z)
|
||||
if(spawn_room(npos,sx,sy,1))
|
||||
pos=npos
|
||||
l_size_x=sx
|
||||
l_size_y=sy
|
||||
else if(complex_max_size==nrooms)
|
||||
// Failed to make first room, abort.
|
||||
del(complex_area)
|
||||
return 0
|
||||
else
|
||||
maxtries--
|
||||
continue
|
||||
nrooms--
|
||||
postProcessComplex()
|
||||
message_admins("Complex spawned at [formatJumpTo(start_loc)]")
|
||||
return 1
|
||||
|
||||
proc/postProcessRoom(var/surprise_room/room)
|
||||
for(var/turf/floor in room.floors)
|
||||
for(var/turf/T in floor.AdjacentTurfs())
|
||||
if(T in room.floors)
|
||||
candidates|=T
|
||||
break
|
||||
|
||||
proc/postProcessComplex()
|
||||
for(var/i=0;i<=rand(0,max_richness);i++)
|
||||
var/turf/T = pick(candidates)
|
||||
var/thing = pickweight(spawntypes)
|
||||
if(thing==null)
|
||||
continue
|
||||
new thing(T)
|
||||
message_admins("Goodie [thing] spawned at [formatJumpTo(T)]")
|
||||
|
||||
proc/spawn_room(var/atom/start_loc, var/x_size, var/y_size, var/clean=0)
|
||||
if(!check_complex_placement(start_loc,x_size,y_size))
|
||||
return 0
|
||||
|
||||
// If walls/floors are contiguous, pick them out.
|
||||
var/wall_type
|
||||
if(flags & CONTIGUOUS_WALLS)
|
||||
wall_type = pickweight(walltypes)
|
||||
|
||||
var/floor_type
|
||||
if(flags & CONTIGUOUS_FLOORS)
|
||||
floor_type = pickweight(floortypes)
|
||||
|
||||
|
||||
var/list/walls[0]
|
||||
var/list/floors[0]
|
||||
for(var/x = 0,x<x_size,x++)
|
||||
for(var/y = 0,y<y_size,y++)
|
||||
var/turf/cur_loc = locate(start_loc.x+x,start_loc.y+y,start_loc.z)
|
||||
|
||||
if(clean)
|
||||
for(var/O in cur_loc)
|
||||
qdel(O)
|
||||
|
||||
if(x == 0 || x==x_size-1 || y==0 || y==y_size-1)
|
||||
walls |= cur_loc
|
||||
else
|
||||
floors |= cur_loc
|
||||
|
||||
var/surprise_room/room = new
|
||||
for(var/turf/turf in walls)
|
||||
|
||||
if(!(flags & CONTIGUOUS_WALLS))
|
||||
wall_type=pickweight(walltypes)
|
||||
|
||||
var/turf/T
|
||||
if(dd_hasprefix("[wall_type]","/obj"))
|
||||
if(!(flags & CONTIGUOUS_FLOORS))
|
||||
floor_type=pickweight(floortypes)
|
||||
T=new floor_type(turf)
|
||||
new wall_type(T)
|
||||
else
|
||||
//testing("Creating wall of type [wall_type].")
|
||||
T=new wall_type(turf)
|
||||
|
||||
room.walls += T
|
||||
complex_area.contents += T
|
||||
|
||||
for(var/turf/turf in floors)
|
||||
if(!(flags & CONTIGUOUS_FLOORS))
|
||||
floor_type=pickweight(floortypes)
|
||||
|
||||
var/turf/T = new floor_type(turf)
|
||||
room.floors += T
|
||||
complex_area.contents += T
|
||||
|
||||
postProcessRoom(room)
|
||||
|
||||
rooms += room
|
||||
|
||||
message_admins("Room spawned at [formatJumpTo(start_loc)]")
|
||||
|
||||
return 1
|
||||
|
||||
/mining_surprise/human_vault
|
||||
name="Hidden Complex"
|
||||
floortypes = list(
|
||||
/turf/simulated/floor/airless=95,
|
||||
/turf/simulated/floor/plating/airless=5
|
||||
)
|
||||
walltypes = list(
|
||||
/turf/simulated/wall=100
|
||||
)
|
||||
spawntypes = list(
|
||||
/obj/item/weapon/pickaxe/silver =4,
|
||||
/obj/item/weapon/pickaxe/drill =4,
|
||||
/obj/item/weapon/pickaxe/jackhammer =4,
|
||||
/obj/item/weapon/pickaxe/diamond =3,
|
||||
/obj/item/weapon/pickaxe/diamonddrill =3,
|
||||
/obj/item/weapon/pickaxe/gold =3,
|
||||
/obj/item/weapon/pickaxe/plasmacutter =2,
|
||||
/obj/structure/closet/syndicate/resources =2,
|
||||
/obj/item/weapon/melee/energy/sword/pirate =1,
|
||||
/obj/mecha/working/ripley/mining =1
|
||||
)
|
||||
complex_max_size=2
|
||||
|
||||
flags = CONTIGUOUS_WALLS | CONTIGUOUS_FLOORS
|
||||
|
||||
/mining_surprise/alien_nest
|
||||
name="Hidden Nest"
|
||||
floortypes = list(
|
||||
/turf/unsimulated/floor/asteroid=100
|
||||
)
|
||||
|
||||
walltypes = list(
|
||||
/obj/effect/alien/resin/wall=90,
|
||||
/obj/effect/alien/resin/membrane=10
|
||||
)
|
||||
|
||||
spawntypes = list(
|
||||
/obj/effect/decal/mecha_wreckage/ripley =4,
|
||||
/obj/item/clothing/mask/facehugger =4,
|
||||
/obj/mecha/working/ripley/mining =1
|
||||
)
|
||||
|
||||
complex_max_size=6
|
||||
room_size_max=7
|
||||
|
||||
var/const/eggs_left=10 // Per complex
|
||||
var/turf/weeds[0] // Turfs with weeds.
|
||||
postProcessComplex()
|
||||
..()
|
||||
var/list/all_floors=list()
|
||||
for(var/surprise_room/room in rooms)
|
||||
var/list/w_cand=room.floors
|
||||
var/egged=0
|
||||
while(w_cand.len)
|
||||
var/turf/weed_turf = pick(w_cand)
|
||||
if(locate(/obj/effect/alien) in weed_turf)
|
||||
continue
|
||||
w_cand -= weed_turf
|
||||
if(weed_turf && !egged)
|
||||
new /obj/effect/alien/weeds/node(weed_turf)
|
||||
weeds += weed_turf
|
||||
egged=1
|
||||
else
|
||||
all_floors |= room.floors
|
||||
|
||||
for(var/e=0;e<eggs_left;e++)
|
||||
var/turf/egg_turf = pick(all_floors)
|
||||
if(egg_turf && !(locate(/obj/effect/alien) in egg_turf))
|
||||
new /obj/effect/alien/egg(egg_turf)
|
||||
@@ -32,6 +32,8 @@
|
||||
var/health = 200
|
||||
//var/mob/living/affecting = null
|
||||
|
||||
var/qdel=0 // Flag to let Del() know we're getting eaten by qdel.
|
||||
|
||||
wall
|
||||
name = "resin wall"
|
||||
desc = "Purple slime solidified into a wall."
|
||||
@@ -49,11 +51,20 @@
|
||||
var/turf/T = get_turf(src)
|
||||
T.thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
|
||||
|
||||
|
||||
/obj/effect/alien/resin/Del()
|
||||
if(!qdel)
|
||||
var/turf/T = get_turf(src)
|
||||
T.thermal_conductivity = initial(T.thermal_conductivity)
|
||||
..()
|
||||
|
||||
/obj/effect/alien/resin/QDel()
|
||||
qdel=1
|
||||
var/turf/T = get_turf(src)
|
||||
T.thermal_conductivity = initial(T.thermal_conductivity)
|
||||
..()
|
||||
|
||||
|
||||
/obj/effect/alien/resin/proc/healthcheck()
|
||||
if(health <=0)
|
||||
density = 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user