Skip to content

Commit

Permalink
make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Jul 30, 2024
1 parent c2d2f41 commit b66b656
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion code/__HELPERS/cmp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ GLOBAL_LIST_INIT(cmp_field, "name")
/proc/cmp_typepaths_asc(A, B)
return sorttext("[B]","[A]")

/proc/cmp_typepaths_name_asc(A, B)
/proc/cmp_typepaths_name_asc(atom/A, atom/B)
return sorttext(initial(A.name), initial(B.name))

/// Compares mobs based on their timeofdeath value in ascending order
Expand Down
2 changes: 2 additions & 0 deletions code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
// #define TESTING
// #define REFERENCE_TRACKING
// #define GC_FAILURE_HARD_LOOKUP

#define AUTOWIKI
18 changes: 10 additions & 8 deletions code/modules/autowiki/pages/guns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


/datum/autowiki/guns/generate_multiple()
var/output = ""
var/output = list()

var/list/gun_to_ammo = list()

Expand All @@ -14,18 +14,19 @@
LAZYADD(gun_to_ammo[initial(typepath.gun_type)], typepath)

var/list/unique_typepaths = list()
for(var/typepath in sort_list(subtypesof(/obj/item/weapon/gun), GLOBAL_PROC_REF(cmp_typepaths_name_asc)))
for(var/obj/item/weapon/gun/typepath as anything in sort_list(subtypesof(/obj/item/weapon/gun), GLOBAL_PROC_REF(cmp_typepaths_name_asc)))
if(initial(typepath.name) in unique_typepaths)
continue

unique_typepaths[typepath.name] = typepath
unique_typepaths[initial(typepath.name)] = typepath

for(var/name in unique_typepaths)
var/typepath = unique_typepaths[name]

for(var/typepath in unique_typepaths)
var/obj/item/weapon/gun/generating_gun = typepath
if(isnull(initial(generating_gun.icon_state)))
continue // Skip guns with no icon_state (e.g. base types)

generating_gun = new typepath()
generating_gun = new typepath
var/filename = SANITIZE_FILENAME(escape_value(format_text(generating_gun.name)))
var/list/gun_data = generating_gun.ui_data()

Expand Down Expand Up @@ -116,8 +117,9 @@
upload_icon(generated_icon, filename)
gun_data["icon"] = filename

var/page_name = replacetext(strip_improper(generating_gun.name), " ", "_")
output += list(title = "Autowiki/Gun/[page_name]", text = include_template("Autowiki/Gun", gun_data))
var/page_name = SANITIZE_FILENAME(replacetext(strip_improper(generating_gun.name), " ", "_"))
var/to_add = list(title = "Autowiki/Content/Gun/[page_name]", text = include_template("Autowiki/Gun", gun_data))
output += list(to_add)

qdel(generating_gun)

Expand Down

0 comments on commit b66b656

Please sign in to comment.