Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One star tech loot spawners spawn One star tech loot #8551

Closed
3 changes: 0 additions & 3 deletions cev_eris.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1848,9 +1848,6 @@
#include "code\modules\mining\drilling\cave_generator.dm"
#include "code\modules\mining\drilling\cave_mineral.dm"
#include "code\modules\mining\drilling\deep_drill.dm"
#include "code\modules\mining\drilling\golem_burrow.dm"
#include "code\modules\mining\drilling\golem_controller.dm"
#include "code\modules\mining\drilling\golem_wave.dm"
#include "code\modules\mining\drilling\scanner.dm"
#include "code\modules\mob\animations.dm"
#include "code\modules\mob\death.dm"
Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/spawner/_spawner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,11 @@

// ITEM - STOCK PARTS and os_tech
#define SPAWN_STOCK_PARTS "stock_parts"
#define SPAWN_STOCK_PARTS_OS "stock_parts_os"

#define SPAWN_TAG_STOCK_PARTS SPAWN_TAG_ITEM+";"+SPAWN_STOCK_PARTS
#define SPAWN_TAG_STOCK_PARTS_TIER_2 SPAWN_TAG_STOCK_PARTS+";"+SPAWN_SCIENCE
#define SPAWN_TAG_STOCK_PARTS_OS SPAWN_TAG_STOCK_PARTS+";"+SPAWN_TAG_TECH_OS+";stock_parts_os"
#define SPAWN_TAG_STOCK_PARTS_OS SPAWN_TAG_STOCK_PARTS+";"+SPAWN_TAG_TECH_OS+";"+SPAWN_STOCK_PARTS_OS

// ITEM - device
#define SPAWN_DEVICE "device"
Expand Down
11 changes: 8 additions & 3 deletions code/game/objects/random/packs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,18 @@ They generally give more random result and can provide more divercity in spawn.
icon_state = "tool-red-low"
spawn_nothing_percentage = 70


/obj/spawner/pack/tech_loot/onestar
name = "Random technical One Star loot"
icon_state = "tool-red"
desc = "This is a random technical loot."
allow_blacklist = TRUE
tags_to_spawn = list(SPAWN_TECH_OS)

/obj/spawner/pack/tech_loot/onestar/item_to_spawn()
return pickweight(list(
/obj/spawner/tool_upgrade/rare/onestar = 10,
/obj/spawner/tool/advanced/onestar = 5,
/obj/spawner/techpart/onestar = 10
))


//This will be spawned in rare closets
/obj/spawner/pack/gun_loot
Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/random/techparts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
name = "low chance random techpart"
icon_state = "tech-orange-low"
spawn_nothing_percentage = 60

/obj/spawner/techpart/onestar
name = "random onestar techpart"
icon_state = "tech-orange"
allow_blacklist = TRUE
tags_to_spawn = list(SPAWN_STOCK_PARTS_OS)
32 changes: 16 additions & 16 deletions code/modules/mining/drilling/cave_generator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
x1_new = x0_new
y0_new = rand(CAVE_MARGIN, y0)
y1_new = rand(y0, CAVE_SIZE - CAVE_MARGIN)
draw_recursive_corridor(x0_new, x1_new, y0_new, y1_new, N - 1)
draw_recursive_corridor(x0_new, x1_new, y0_new, y1_new, N - 1)

// Run one iteration of the cellular automata that processes the initial random noise
/obj/cave_generator/proc/run_cellular_automata()
Expand All @@ -159,7 +159,7 @@
return CAVE_FREE
else if(num_walls >= 5)
return CAVE_WALL

return CAVE_FREE

// Get number of walls in a given range around the target tile
Expand All @@ -172,7 +172,7 @@
return num_walls

// Place points of interest on the map
/obj/cave_generator/proc/generate_pois(seismic_lvl)
/obj/cave_generator/proc/generate_pois(seismic_lvl)

// Reset pois lists
pois_placed = list()
Expand Down Expand Up @@ -217,26 +217,26 @@
pois_placed_pos += list(list(x_corner_bl, y_corner_bl, x_corner_tr, y_corner_tr))

// Check if a potential poi does not overlap with already placed pois
/obj/cave_generator/proc/check_poi_overlap(x_bl, y_bl, size_x, size_y)
/obj/cave_generator/proc/check_poi_overlap(x_bl, y_bl, size_x, size_y)
if(!pois_placed.len)
// No overlap since no poi has been placed yet
return TRUE

var/x_tr = x_bl + size_x
var/y_tr = y_bl + size_y
for(var/k = 1 to pois_placed.len)
// If bottom left corner is on the right or above the top right corner of already placed poi, then it's clear
// If top right corner is on the left or under the bottom left corner of already placed poi, then it's clear
// Otherwise it means they overlap
var/list/placed_pos = pois_placed_pos[k]

if(!(x_bl > placed_pos[3] || y_bl > placed_pos[4] || x_tr < placed_pos[1] || y_tr < placed_pos[2]))
return FALSE
// No overlap
return TRUE

// Generate mineral veins once cave layout has been decided
/obj/cave_generator/proc/generate_mineral_veins(seismic_lvl)
/obj/cave_generator/proc/generate_mineral_veins(seismic_lvl)
var/x_vein = 0
var/y_vein = 0
var/N_veins = rand(15, 20 * (1 + 0.5 * (seismic_lvl - SEISMIC_MIN) / (SEISMIC_MAX - SEISMIC_MIN)))
Expand All @@ -250,7 +250,7 @@
// Find a free spot in the cave
/obj/cave_generator/proc/find_free_spot(x_start, y_start, x_margin = 0, y_margin = 0)

var/x0 = x_start - 1
var/x0 = x_start - 1
var/x1 = x_start + 1
var/y0 = y_start - 1
var/y1 = y_start + 1
Expand All @@ -270,14 +270,14 @@
y_start = y1
else
found = FALSE

if(!found)
x0--
x1++
y0--
y1++
edge = (x0 <= 1 + x_margin) || (x1 >= CAVE_SIZE - x_margin) || (y0 <= 1 + y_margin) || (y1 >= CAVE_SIZE - y_margin)

// Hit an edge before finding an available spot
if(!found)
return list(FALSE, 0, 0)
Expand Down Expand Up @@ -421,7 +421,7 @@

// Find closest available spot (wall tile near a free tile)
var/search_for = map[x_start][y_start] == CAVE_FREE ? CAVE_WALL : CAVE_FREE
var/x0 = x_start - 1
var/x0 = x_start - 1
var/x1 = x_start + 1
var/y0 = y_start - 1
var/y1 = y_start + 1
Expand All @@ -447,14 +447,14 @@
y_start = y1
else
found = FALSE

if(!found)
x0--
x1++
y0--
y1++
edge = (x0 == 1) || (x1 == CAVE_SIZE) || (y0 == 1) || (y1 == CAVE_SIZE)

// Hit an edge before finding an available spot
if(!found)
return 0
Expand All @@ -477,7 +477,7 @@
var/datum/cave_vein/CV = new vein_path()

// Place mineral vein at the available spot in a recursive manner
place_recursive_mineral(x_start, y_start, CV.p_spread, CV.size_max, CV.size_min, CV.mineral)
place_recursive_mineral(x_start, y_start, CV.p_spread, CV.size_max, CV.size_min, CV.mineral)
return 1

// Place a mineral vein in a recursive manner
Expand Down Expand Up @@ -580,7 +580,7 @@
/obj/cave_generator/proc/place_pois()
if(!LAZYLEN(pois_placed))
return

for(var/k = 1 to LAZYLEN(pois_placed))
var/turf/corner_turf = get_turf(locate(x + pois_placed_pos[k][1], y + pois_placed_pos[k][2], z))
pois_placed[k].load(corner_turf)
Expand All @@ -597,7 +597,7 @@
else
golem_type = pick(GLOB.golems_normal)
// Spawn golem at free location
new golem_type(get_turf(locate(x + i, y + j, z)), drill=null, parent=null)
new golem_type(get_turf(locate(x + i, y + j, z)))

//////////////////////////////
// Mineral veins for the cave generator
Expand Down
Loading
Loading