Skip to content

Commit

Permalink
Ship table autowiki
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSuckerberg committed Dec 11, 2024
1 parent de52db7 commit fc9d499
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 53 deletions.
16 changes: 10 additions & 6 deletions code/__DEFINES/factions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
#define FACTION_PLAYER_ROUMAIN "playerRoumain"
#define FACTION_PLAYER_GEZENA "playerGezena"

#define FACTION_SYNDICATE "Syndicate"
#define FACTION_SYNDICATE "Syndicate Coalition"
#define FACTION_NGR "New Gorlex Republic"
#define FACTION_CYBERSUN "CyberSun"
#define FACTION_HARDLINERS "Hardliners"
#define FACTION_CYBERSUN "Cybersun Industries"
#define FACTION_HARDLINERS "Gorlex Hardliners"
#define FACTION_SUNS "Student-Union of Naturalistic Sciences"
#define FACTION_SOLGOV "SolGov"
#define FACTION_SOLGOV "Solar Confederation"
#define FACTION_SRM "Saint-Roumain Militia"
#define FACTION_INTEQ "Inteq Risk Management Group"
#define FACTION_CLIP "CLIP Minutemen"
#define FACTION_CLIP "Confederated League of Independent Planets"
#define FACTION_NT "Nanotrasen"
#define FACTION_NS_LOGI "N+S Logistics"
#define FACTION_VIGILITAS "Vigilitas Interstellar"
#define FACTION_FRONTIERSMEN "Frontiersmen Fleet"
#define FACTION_PGF "Pan-Gezenan Federation"
#define FACTION_PGF "Pan-Gezena Federation"
#define FACTION_INDEPENDENT "Independent"

#define PREFIX_SYNDICATE list("SEV", "SSV")
Expand All @@ -44,3 +44,7 @@
#define PREFIX_FRONTIERSMEN list("FFV")
#define PREFIX_PGF list("PGF", "PGFMC", "PGFN")
#define PREFIX_INDEPENDENT list("SV", "IMV", "ISV")
#define PREFIX_NONE list()

#define FACTION_SORT_DEFAULT 0
#define FACTION_SORT_INDEPENDENT 100
3 changes: 3 additions & 0 deletions code/__HELPERS/cmp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,6 @@ GLOBAL_VAR_INIT(cmp_field, "name")
if(A.dock_width == B.dock_width)
return A.dock_height - B.dock_height
return A.dock_width - B.dock_width

/proc/cmp_factions_asc(datum/faction/a, datum/faction/b)
return initial(b.order) - initial(a.order) || sorttext(initial(b.name), initial(a.name))
27 changes: 22 additions & 5 deletions code/modules/autowiki/pages/ships.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,26 @@
wiki_dummy.setDir(SOUTH)
for(var/datum/job/job as anything in crew)
var/filename = SANITIZE_FILENAME(escape_value(format_text(initial(job.outfit.name))))
var/hudname = "[filename]-hud"

output += include_template("Autowiki/ShipCrewMember", list(
"name" = escape_value(job.name),
"officer" = job.officer ? "Yes" : "No",
"slots" = crew[job],
"icon" = filename
"icon" = filename,
"hudicon" = hudname
))

//Only generate each unique outfit once
if(filename in job_icon_list)
continue
if(!(filename in job_icon_list))
upload_icon(get_dummy_image(job), filename)
job_icon_list += filename
if(!(hudname in job_icon_list))
var/icon/hudicon = get_hud_image(job)
if(hudicon)
upload_icon(hudicon, hudname)
job_icon_list += hudname

upload_icon(get_dummy_image(job, filename), filename)

return output

Expand All @@ -93,6 +100,16 @@

//Make all icons 32x32 for wiki sizing consistency
if(wiki_icon.Height() != 32 || wiki_icon.Width() != 32)
wiki_icon.Crop(1, 1, 32, 32)
wiki_icon.Crop(0, 0, 32, 32)

return wiki_icon

/datum/autowiki/ship/proc/get_hud_image(datum/job/to_equip)
if(!icon_exists('icons/mob/hud.dmi', "hud[initial(to_equip.outfit.faction_icon)]"))
return FALSE

var/icon/hudicon = icon('icons/mob/hud.dmi', "hud[initial(to_equip.outfit.faction_icon)]")
hudicon.Blend(icon('icons/mob/hud.dmi', "hud[initial(to_equip.outfit.job_icon)]"), ICON_OVERLAY)
hudicon.Crop(0, 16, 9, 24)

return hudicon
54 changes: 54 additions & 0 deletions code/modules/autowiki/pages/shiptable.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/datum/autowiki/ship_table
page = "Template:Autowiki/Content/ShipTable"

/datum/autowiki/ship_table/generate()
var/list/factions = list()

for(var/path in SSfactions.factions)
var/datum/faction/faction = SSfactions.factions[path]
factions |= faction.parent_faction
factions = sortList(factions, GLOBAL_PROC_REF(cmp_factions_asc))

for(var/shipname in SSmapping.shuttle_templates)
var/datum/map_template/shuttle/ship = SSmapping.shuttle_templates[shipname]
if(!ship.faction)
continue

LAZYADD(factions[ship.faction.parent_faction], ship)

return include_template("Autowiki/ShipTable", list(
"rows" = generate_rows(factions)
))

/datum/autowiki/ship_table/proc/generate_rows(list/factions)
var/list/output = list()
for(var/type in factions)
var/datum/faction/current = SSfactions.factions[type]
var/list/ships = factions[type]

var/list/ships_output = list()
for(var/datum/map_template/shuttle/ship as anything in ships)
var/shorter_name = replacetext(ship.short_name, "-class", "")
var/ship_name = "\[\[[ship.name]|[shorter_name]\]\]"
if(!ship.enabled)
ships_output += include_template("Tooltip", list(
"1" = ship_name,
"2" = "This ship is admin-spawn only.",
"3" = "f00" //red
))
continue
ships_output += ship_name

output += include_template("Autowiki/ShipTable/Row", list(
"name" = "\[\[[current.name]\]\]",
"color" = current.color,
"ships" = ships_output.Join(", ")
))

output += include_template("Autowiki/ShipTable/Row", list(
"name" = "Removed/Deprecated",
"color" = "C8C8C8",
"ships" = "{{{removed}}}" //allows for manual editing
))

return output.Join("\n")
26 changes: 13 additions & 13 deletions code/modules/cargo/packs/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
desc = "Contains a civilian variant of the Ringneck pistol, produced by Scarborough Arms and chambered in 10mm."
cost = 1000
contains = list(/obj/item/storage/guncase/pistol/ringneck)
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/gun/cm23
name = "CM-23 Pistol Crate"
Expand Down Expand Up @@ -73,7 +73,7 @@
desc = "Contains a compact armor-piercing sidearm, chambered in 5.7mm"
cost = 1250
contains = list(/obj/item/storage/guncase/pistol/asp)
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -121,15 +121,15 @@
desc = "Contains a civilian variant of the Viper revolver, chambered in .357 magnum."
cost = 2500
contains = list(/obj/item/storage/guncase/pistol/viper)
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 5

/datum/supply_pack/gun/a357
name = "R-23 'Viper' Revolver Crate"
desc = "Contains a double-action military variant of the Viper revolver, chambered in .357 magnum."
cost = 3000
contains = list(/obj/item/storage/guncase/pistol/a357)
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -283,7 +283,7 @@
contains = list(/obj/item/storage/guncase/bulldog)
cost = 4000
crate_name = "shotgun crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -327,7 +327,7 @@
cost = 3000
contains = list(/obj/item/storage/guncase/cobra)
crate_name = "SMG crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 10

/datum/supply_pack/gun/vector
Expand Down Expand Up @@ -395,7 +395,7 @@
cost = 2500
contains = list(/obj/item/storage/guncase/rattlesnake)
crate_name = "Machinepistol crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -425,7 +425,7 @@
cost = 3000
contains = list(/obj/item/storage/guncase/sidewinder)
crate_name = "SMG crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -512,7 +512,7 @@
cost = 5000
contains = list(/obj/item/storage/guncase/hydra)
crate_name = "rifle crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -565,7 +565,7 @@
cost = 3500
contains = list(/obj/item/storage/guncase/sbr80)
crate_name = "dmr crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -605,15 +605,15 @@
cost = 3500
contains = list(/obj/item/storage/guncase/boomslang)
crate_name = "dmr crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/gun/boomslang10
name = "Boomslang-10 Sniper Rifle Crate"
desc = "Contains a military variant of the Boomslang Sniper rifle equipped with an 8x sniper scope, for licenesed buyers only. Chambered in the powerful 6.5x57mm CLIP."
cost = 4500
contains = list(/obj/item/storage/guncase/boomslangmilitary)
crate_name = "marksman rifle crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down Expand Up @@ -674,7 +674,7 @@
cost = 500
contains = list(/obj/item/attachment/energy_bayonet)
crate_name = "bayonet crate"
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough
faction_discount = 0
faction_locked = TRUE

Expand Down
22 changes: 11 additions & 11 deletions code/modules/cargo/packs/magazines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,73 +92,73 @@
desc = "Contains a .22lr magazine for the Himehabu pistol, containing ten rounds."
contains = list(/obj/item/ammo_box/magazine/m22lr_himehabu)
cost = 200
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/asp_mag
name = "Asp Magazine Crate"
desc = "Contains a 5.7x39mm magazine for the Asp pistol, containing 12 rounds."
contains = list(/obj/item/ammo_box/magazine/m57_39_asp)
cost = 400
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/m10mm_mag
name = "Ringneck Magazine Crate"
desc = "Contains a 10mm magazine for the Ringneck pistol, containing ten rounds."
contains = list(/obj/item/ammo_box/magazine/m10mm_ringneck)
cost = 500
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/m9mm_rattlesnake
name = "Rattlesnake Magazine Crate"
desc = "Contains a 9mm magazine for the Rattlesnake machine pistol, contains 18 rounds."
contains = list(/obj/item/ammo_box/magazine/m9mm_rattlesnake)
cost = 500
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/a357_mag
name = ".357 Speedloader Crate"
desc = "Contains a .357 speedloader for revolvers, containing seven rounds."
contains = list(/obj/item/ammo_box/a357)
cost = 750
faction_discount = 20
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/sidewinder_mag
name = "Sidewinder Magazine Crate"
desc = "Contains a 30 round magazine for the Sidewinder SMG."
contains = list(/obj/item/ammo_box/magazine/m57_39_sidewinder)
cost = 750
faction_discount = 20
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/c45_cobra_mag
name = "Cobra Magazine Crate"
desc = "Contains a .45 magazine for the Cobra-20, containing 24 rounds."
cost = 750
contains = list(/obj/item/ammo_box/magazine/m45_cobra)
faction_discount = 20
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/short_hydra_mag
name = "SBR-80 DMR Short Magazine Crate"
desc = "Contains a 5.56x42mm CLIP made specially for the SBR-80 Designated Marksman Rifle, containing 20 rounds."
contains = list(/obj/item/ammo_box/magazine/m556_42_hydra/small)
cost = 1000
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/hydra_mag
name = "SMR-80 Rifle Magazine Crate"
desc = "Contains a 5.56x42mm CLIP for the SMR-80 assault rifle, containing 30 rounds."
contains = list(/obj/item/ammo_box/magazine/m556_42_hydra)
cost = 1500
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/datum/supply_pack/magazine/boomslang_mag
name = "Boomslang-90 Magazine Crate"
desc = "Contains a 6.5 CLIP magazine for the Boomslang rifle platform, containing five rounds."
contains = list(/obj/item/ammo_box/magazine/boomslang/short)
cost = 1000
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough

/* CM Lancaster */

Expand Down Expand Up @@ -287,7 +287,7 @@
desc = "Contains an 8-round 12ga box magazine for the Bulldog weapons platform."
contains = list(/obj/item/ammo_box/magazine/m12g_bulldog)
cost = 1000
faction = /datum/faction/syndicate/scarborough_arms
faction = /datum/faction/syndicate/scarborough


/* energy weapons */
Expand Down
Loading

0 comments on commit fc9d499

Please sign in to comment.