Skip to content

Commit

Permalink
Auto wiki requisitions (#7298)
Browse files Browse the repository at this point in the history
# About the pull request

Adds autowiki for requisition crates

# Explain why it's good for the game

Less need for manual additions to the wiki.


# Testing Photographs and Procedure

Not Applicable


# Changelog
:cl:
qol: Added auto wiki for requisitions.
/:cl:

---------

Co-authored-by: harryob <[email protected]>
Co-authored-by: harryob <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2024
1 parent a04b081 commit 12bc03d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions code/modules/autowiki/pages/supply_packs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/datum/autowiki/supply_packs
generate_multiple = TRUE
page = "Template:Autowiki/Content/SupplyPacks"


/datum/autowiki/supply_packs/generate_multiple()

var/output = list()

//Gets the subtypes of all supply_packs
for(var/typepath in subtypesof(/datum/supply_packs))
var/datum/supply_packs/my_pack = GLOB.supply_packs_datums[typepath]


var/list/contents = list()
for(var/obj/contents_type in my_pack.contains)
//So long as there is something in the contaienr it will add it to the list
if(!length(my_pack.contains))
return
contents += contents_type::name

var/obj/structure/closet/crate/container_typepath = my_pack.containertype
var/container_filename = container_typepath ? SANITIZE_FILENAME(escape_value(format_text("[container_typepath::icon]-[container_typepath::icon_state]"))) : null
if(container_filename && !fexists("data/autowiki_files/[container_filename].png"))
var/obj/structure/closet/crate/generating_crate = new my_pack.containertype
upload_icon(getFlatIcon(generating_crate, no_anim = TRUE), container_filename)

var/page_name = SANITIZE_FILENAME(replacetext(strip_improper(my_pack.name), " ", "_"))
var/to_add = list(title = "Template:Autowiki/Content/SupplyPack/[page_name]", text = include_template("Autowiki/SupplyPack",list(
"icon" = container_filename,
"name" = my_pack.name,
"cost" = my_pack.cost,
"contents" = contents.Join(", ")
)
))
output += list(to_add)

return output
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,7 @@
#include "code\modules\autowiki\autowiki.dm"
#include "code\modules\autowiki\pages\_page.dm"
#include "code\modules\autowiki\pages\guns.dm"
#include "code\modules\autowiki\pages\supply_packs.dm"
#include "code\modules\autowiki\pages\xeno_stats.dm"
#include "code\modules\buildmode\bm-mode.dm"
#include "code\modules\buildmode\buildmode.dm"
Expand Down

0 comments on commit 12bc03d

Please sign in to comment.