Merge pull request #134 from LetterJay/master

gamemode tweaks/minimap fix
This commit is contained in:
LetterJay
2017-01-06 13:39:41 -05:00
committed by GitHub
10 changed files with 68 additions and 51 deletions

View File

@@ -13,25 +13,55 @@ var/datum/subsystem/minimap/SSminimap
NEW_SS_GLOBAL(SSminimap)
/datum/subsystem/minimap/Initialize(timeofday)
if(!config.generate_minimaps)
world << "Minimap generation disabled... Skipping"
return
var/hash = md5(file2text("_maps/[MAP_PATH]/[MAP_FILE]"))
if(hash == trim(file2text(hash_path())))
return ..()
for(var/z in z_levels)
generate(z)
register_asset("minimap_[z].png", fcopy_rsc(map_path(z)))
fdel(hash_path())
text2file(hash, hash_path())
if(config.generate_minimaps)
if(hash == trim(file2text(hash_path())))
for(var/z in z_levels) //We have these files cached, let's register them
register_asset("minimap_[z].png", fcopy_rsc(map_path(z)))
return ..()
for(var/z in z_levels)
generate(z)
register_asset("minimap_[z].png", fcopy_rsc(map_path(z)))
fdel(hash_path())
text2file(hash, hash_path())
else
world << "<span class='boldannounce'>Minimap generation disabled. Loading from cache...</span>"
var/fileloc = 0
if(check_files(0)) //Let's first check if we have maps cached in the data folder. NOTE: This will override the backup files even if this map is older.
world.log << "cache"
if(hash != trim(file2text(hash_path())))
world << "<span class='boldannounce'>Loaded cached minimap is outdated. There may be minor discrepancies in layout.</span>" //Disclaimer against players saying map is wrong.
fileloc = 0
else
if(!check_files(1))
world << "<span class='boldannounce'>Failed to load backup minimap file. Aborting.</span>" //We couldn't find something. Bail to prevent issues with null files
return
fileloc = 1 //No map image cached with the current map, and we have a backup. Let's fall back to it.
world << "<span class='boldannounce'>No cached minimaps detected. Backup files loaded.</span>"
for(var/z in z_levels)
register_asset("minimap_[z].png", fcopy_rsc(map_path(z,fileloc)))
..()
/datum/subsystem/minimap/proc/hash_path()
return "data/minimaps/[MAP_NAME].md5"
/datum/subsystem/minimap/proc/check_files(backup) // If the backup argument is true, looks in the icons folder. If false looks in the data folder.
for(var/z in z_levels)
if(!fexists(file(map_path(z,backup)))) //Let's make sure we have a file for this map
if(backup)
world.log << "Failed to find backup file for map [MAP_NAME] on zlevel [z]."
return FALSE
return TRUE
/datum/subsystem/minimap/proc/map_path(z)
return "data/minimaps/[MAP_NAME]_[z].png"
/datum/subsystem/minimap/proc/hash_path(backup)
if(backup)
return "icons/minimaps/[MAP_NAME].md5"
else
return "data/minimaps/[MAP_NAME].md5"
/datum/subsystem/minimap/proc/map_path(z,backup)
if(backup)
return "icons/minimaps/[MAP_NAME]_[z].png"
else
return "data/minimaps/[MAP_NAME]_[z].png"
/datum/subsystem/minimap/proc/send(client/client)
for(var/z in z_levels)
@@ -43,24 +73,10 @@ var/datum/subsystem/minimap/SSminimap
// Scale it up to our target size.
minimap.Scale(MINIMAP_SIZE, MINIMAP_SIZE)
var/counter = 512
// Loop over turfs and generate icons.
for(var/T in block(locate(x1, y1, z), locate(x2, y2, z)))
generate_tile(T, minimap)
//byond bug, this fixes OOM crashes by flattening and reseting the minimap icon holder every so and so tiles
counter--
if(counter <= 0)
counter = 512
var/icon/flatten = new /icon()
flatten.Insert(minimap, "", SOUTH, 1, 0)
del(minimap)
minimap = flatten
stoplag() //we have to sleep in order to get byond to clear out the proc's garbage bin
CHECK_TICK
// Create a new icon and insert the generated minimap, so that BYOND doesn't generate different directions.
var/icon/final = new /icon()
final.Insert(minimap, "", SOUTH, 1, 0)
@@ -69,7 +85,7 @@ var/datum/subsystem/minimap/SSminimap
/datum/subsystem/minimap/proc/generate_tile(turf/tile, icon/minimap)
var/icon/tile_icon
var/obj/obj
var/list/obj_icons = list()
var/list/obj_icons
// Don't use icons for space, just add objects in space if they exist.
if(istype(tile, /turf/open/space))
obj = locate(/obj/structure/lattice/catwalk) in tile
@@ -86,18 +102,20 @@ var/datum/subsystem/minimap/SSminimap
tile_icon = new /icon('icons/obj/atmospherics/pipes/transit_tube.dmi', obj.icon_state, obj.dir)
else
tile_icon = new /icon(tile.icon, tile.icon_state, tile.dir)
obj_icons.Cut()
obj_icons = list()
obj = locate(/obj/structure) in tile
if(obj)
obj_icons += getFlatIcon(obj)
obj_icons += new /icon(obj.icon, obj.icon_state, obj.dir, 1, 0)
obj = locate(/obj/machinery) in tile
if(obj)
obj_icons += new /icon(obj.icon, obj.icon_state, obj.dir, 1, 0)
obj = locate(/obj/structure/window) in tile
if(obj)
obj_icons += new /icon('icons/obj/smooth_structures/window.dmi', "window", SOUTH)
obj = locate(/obj/structure/table) in tile
if(obj)
obj_icons += new /icon('icons/obj/smooth_structures/table.dmi', "table", SOUTH)
for(var/I in obj_icons)
var/icon/obj_icon = I
tile_icon.Blend(obj_icon, ICON_OVERLAY)
@@ -107,4 +125,3 @@ var/datum/subsystem/minimap/SSminimap
tile_icon.Scale(TILE_SIZE, TILE_SIZE)
// Add the tile to the minimap.
minimap.Blend(tile_icon, ICON_OVERLAY, ((tile.x - 1) * TILE_SIZE), ((tile.y - 1) * TILE_SIZE))
del(tile_icon)

View File

@@ -14,7 +14,7 @@ var/list/blobs_legit = list() //used for win-score calculations, contains only b
config_tag = "blob"
antag_flag = ROLE_BLOB
required_players = 15
required_players = 10
required_enemies = 1
recommended_enemies = 1

View File

@@ -18,9 +18,9 @@ var/list/slot2type = list("head" = /obj/item/clothing/head/changeling, "wear_mas
antag_flag = ROLE_CHANGELING
restricted_jobs = list("AI", "Cyborg")
protected_jobs = list("Security Officer", "Warden", "Detective", "Head of Security", "Captain")
required_players = 15
required_players = 10
required_enemies = 1
recommended_enemies = 4
recommended_enemies = 1
reroll_friendly = 1

View File

@@ -156,9 +156,9 @@ This file's folder contains:
name = "clockwork cult"
config_tag = "clockwork_cult"
antag_flag = ROLE_SERVANT_OF_RATVAR
required_players = 15
required_players = 10
required_enemies = 2
recommended_enemies = 4
recommended_enemies = 2
enemy_minimum_age = 14
protected_jobs = list("AI", "Cyborg", "Security Officer", "Warden", "Detective", "Head of Security", "Captain") //Silicons can eventually be converted
restricted_jobs = list("Chaplain", "Captain")

View File

@@ -41,9 +41,9 @@
antag_flag = ROLE_CULTIST
restricted_jobs = list("Chaplain","AI", "Cyborg", "Security Officer", "Warden", "Detective", "Head of Security", "Captain", "Head of Personnel")
protected_jobs = list()
required_players = 20
required_enemies = 4
recommended_enemies = 4
required_players = 10
required_enemies = 2
recommended_enemies = 2
enemy_minimum_age = 14
var/finished = 0

View File

@@ -24,7 +24,7 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple"
config_tag = "gang"
antag_flag = ROLE_GANG
restricted_jobs = list("Security Officer", "Warden", "Detective", "AI", "Cyborg","Captain", "Head of Personnel", "Head of Security", "Chief Engineer", "Research Director", "Chief Medical Officer")
required_players = 20
required_players = 10
required_enemies = 2
recommended_enemies = 2
enemy_minimum_age = 14

View File

@@ -24,9 +24,9 @@ var/global/list/global_handofgod_structuretypes = list()
config_tag = "handofgod"
antag_flag = ROLE_HOG_CULTIST //Followers use ROLE_HOG_CULTIST, Gods are picked later on with ROLE_HOG_GOD
required_players = 15
required_enemies = 8
recommended_enemies = 8
required_players = 10
required_enemies = 3
recommended_enemies = 3
restricted_jobs = list("Chaplain","AI", "Cyborg", "Security Officer", "Warden", "Detective", "Head of Security", "Captain", "Head of Personnel")

View File

@@ -5,9 +5,9 @@
/datum/game_mode/nuclear
name = "nuclear emergency"
config_tag = "nuclear"
required_players = 30 // 30 players - 3 players to be the nuke ops = 27 players remaining
required_players = 15 // 30 players - 3 players to be the nuke ops = 27 players remaining
required_enemies = 2
recommended_enemies = 5
recommended_enemies = 2
antag_flag = ROLE_OPERATIVE
enemy_minimum_age = 14
var/const/agents_possible = 5 //If we ever need more syndicate agents.

View File

@@ -15,9 +15,9 @@
config_tag = "revolution"
antag_flag = ROLE_REV
restricted_jobs = list("Security Officer", "Warden", "Detective", "AI", "Cyborg","Captain", "Head of Personnel", "Head of Security", "Chief Engineer", "Research Director", "Chief Medical Officer")
required_players = 20
required_players = 10
required_enemies = 1
recommended_enemies = 3
recommended_enemies = 2
enemy_minimum_age = 14
var/finished = 0

View File

@@ -1,7 +1,7 @@
/datum/game_mode/wizard/raginmages
name = "ragin' mages"
config_tag = "raginmages"
required_players = 15
required_players = 10
use_huds = 1
var/max_mages = 0
var/making_mage = 0