diff --git a/code/__DEFINES/autowiki.dm b/code/__DEFINES/autowiki.dm new file mode 100644 index 000000000000..a6a745ca7910 --- /dev/null +++ b/code/__DEFINES/autowiki.dm @@ -0,0 +1,7 @@ +#ifdef AUTOWIKI + #define AUTOWIKI_SKIP(skip) autowiki_skip = skip + #define IS_AUTOWIKI_SKIP(datum) datum.autowiki_skip +#else + #define AUTOWIKI_SKIP(skip) + #define IS_AUTOWIKI_SKIP(datum) FALSE +#endif diff --git a/code/datums/agents/tools/decoy.dm b/code/datums/agents/tools/decoy.dm index 57c8e5130fee..57eef25a446d 100644 --- a/code/datums/agents/tools/decoy.dm +++ b/code/datums/agents/tools/decoy.dm @@ -1,4 +1,6 @@ /obj/item/explosive/grenade/decoy + AUTOWIKI_SKIP(TRUE) + name = "decoy grenade" desc = "A grenade typically used to distract the enemy. Emits a loud bang. Detonates in 5 seconds. Has 3 uses" diff --git a/code/datums/datum.dm b/code/datums/datum.dm index e926dfd022ca..2370987b4cfc 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -70,6 +70,10 @@ var/list/cached_vars #endif +#ifdef AUTOWIKI + var/autowiki_skip = FALSE +#endif + /** * Default implementation of clean-up code. * diff --git a/code/game/objects/items/explosives/grenades/marines.dm b/code/game/objects/items/explosives/grenades/marines.dm index 09c0197cda7f..fef62ab6a835 100644 --- a/code/game/objects/items/explosives/grenades/marines.dm +++ b/code/game/objects/items/explosives/grenades/marines.dm @@ -97,6 +97,8 @@ falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR /obj/item/explosive/grenade/high_explosive/frag/toy + AUTOWIKI_SKIP(TRUE) + name = "toy HEFA grenade" desc = "High-Explosive Fragmenting-Antipersonnel. A small, but deceptively strong fragmentation grenade that has been phasing out the M15 fragmentation grenades alongside the M40 HEDP. Capable of being loaded in the M92 Launcher, or thrown by hand. Wait, the labeling on the side indicates this is a toy, what the hell?" explosion_power = 0 @@ -865,6 +867,8 @@ return /obj/item/explosive/grenade/high_explosive/holy_hand_grenade + AUTOWIKI_SKIP(TRUE) + name = "\improper Holy Hand Grenade of Antioch" desc = "And Saint Attila raised the hand grenade up on high, saying, \"O LORD, bless this Thy hand grenade that with it Thou mayest blow Thine enemies to tiny bits, in Thy mercy.\" And the LORD did grin and the people did feast upon the lambs and sloths and carp and anchovies... And the LORD spake, saying, \"First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in My sight, shall snuff it.\"" icon_state = "grenade_antioch" diff --git a/code/game/world.dm b/code/game/world.dm index bf9534e5f926..515fabc5f705 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -114,7 +114,7 @@ GLOBAL_LIST_INIT(reboot_sfx, file2list("config/reboot_sfx.txt")) GLOB.log_directory += "[replacetext(time_stamp(), ":", ".")]" runtime_logging_ready = TRUE // Setting up logging now, so disabling early logging - #ifndef UNIT_TESTS + #if defined(UNIT_TESTS) || defined(AUTOWIKI) world.log = file("[GLOB.log_directory]/dd.log") #endif backfill_runtime_log() diff --git a/code/modules/autowiki/pages/_page.dm b/code/modules/autowiki/pages/_page.dm index 0e4091d0ccc5..7bd7b6dcf42c 100644 --- a/code/modules/autowiki/pages/_page.dm +++ b/code/modules/autowiki/pages/_page.dm @@ -27,6 +27,7 @@ /// something that looks like `{{ Autowiki_Circuit|name=Combiner|description=This combines }}` /// Lists, which must be array-like (no keys), will be turned into a flat list with their key and a number, /// such that list("food" = list("fruit", "candy")) -> food1=fruit|food2=candy +/// Your page should respect AUTOWIKI_SKIP, and check for this using IS_AUTOWIKI_SKIP /datum/autowiki/proc/include_template(name, parameters) var/template_text = "{{[name]" diff --git a/code/modules/autowiki/pages/guns.dm b/code/modules/autowiki/pages/guns.dm index 017c2535a5e1..4c276fb91b53 100644 --- a/code/modules/autowiki/pages/guns.dm +++ b/code/modules/autowiki/pages/guns.dm @@ -42,6 +42,9 @@ for(var/ammo_typepath in valid_mag_types) var/obj/item/ammo_magazine/generating_mag = new ammo_typepath() + if(IS_AUTOWIKI_SKIP(generating_mag)) + continue + var/ammo_filename = SANITIZE_FILENAME(escape_value(format_text(generating_mag.name))) if(!fexists("data/autowiki_files/[ammo_filename].png")) @@ -61,6 +64,8 @@ )) generating_gun.current_mag = generating_mag + generating_gun.ammo = current_ammo + generating_gun.in_chamber = null var/list/gun_ammo_data = generating_gun.ui_data() var/list/armor_data = list() @@ -68,18 +73,63 @@ var/iterator = 1 for(var/header in gun_ammo_data["damage_armor_profile_headers"]) var/damage = gun_ammo_data["damage_armor_profile_marine"][iterator] + if(!damage) + break armor_data["armor-[header]"] = damage iterator++ var/list/damage = list("ammo_name" = escape_value(generating_mag.name)) - damage += armor_data + if(length(armor_data)) + damage += armor_data damage_table += include_template("Autowiki/DamageVersusArmorRow", damage) qdel(generating_mag) + var/grenades = "" + if(istype(generating_gun, /obj/item/weapon/gun/launcher/grenade)) + var/obj/item/weapon/gun/launcher/grenade/generating_launcher = generating_gun + + var/list/permitted_grenades = list() + for(var/obj/item/explosive/grenade/type as anything in generating_launcher.valid_munitions) + permitted_grenades |= subtypesof(type) + + var/list/unique_grenades = list() + var/list/unique_grenade_names = list() + for(var/obj/item/explosive/grenade/grenade_type as anything in permitted_grenades) + if(initial(grenade_type.name) in unique_grenade_names) + continue + unique_grenade_names += initial(grenade_type.name) + unique_grenades += grenade_type + + var/list/denied_grenades = list() + for(var/type in generating_launcher.disallowed_grenade_types) + denied_grenades |= typesof(type) + + var/valid_grenades = unique_grenades.Copy() - denied_grenades.Copy() + + for(var/grenade_path in valid_grenades) + var/obj/item/explosive/grenade/generating_grenade = new grenade_path() + + if(IS_AUTOWIKI_SKIP(generating_grenade)) + continue + + var/grenade_filename = SANITIZE_FILENAME(escape_value(format_text(generating_grenade.name))) + + if(!fexists("data/autowiki_files/[grenade_filename].png")) + upload_icon(getFlatIcon(generating_grenade, no_anim = TRUE), grenade_filename) + + grenades += include_template("Autowiki/Grenade", list( + "icon" = escape_value(grenade_filename), + "name" = escape_value(generating_grenade.name), + "description" = escape_value(generating_grenade.desc) + )) + + qdel(generating_grenade) + gun_data["ammo_types"] = ammo gun_data["damage_table"] = damage_table + gun_data["grenades"] = grenades var/list/attachments_by_slot = list() for(var/obj/item/attachable/attachment_typepath as anything in generating_gun.attachable_allowed) diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index 5db904869973..e032d3ebbe55 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -233,6 +233,8 @@ bullets/shells. ~N */ /obj/item/ammo_magazine/handful + AUTOWIKI_SKIP(TRUE) + name = "generic handful" desc = "A handful of rounds to reload on the go." icon = 'icons/obj/items/weapons/guns/handful.dmi' diff --git a/code/modules/projectiles/guns/specialist/launcher/grenade_launcher.dm b/code/modules/projectiles/guns/specialist/launcher/grenade_launcher.dm index 06ac5428bfc6..40a145e1f77c 100644 --- a/code/modules/projectiles/guns/specialist/launcher/grenade_launcher.dm +++ b/code/modules/projectiles/guns/specialist/launcher/grenade_launcher.dm @@ -25,7 +25,13 @@ ///Does it launch its grenades in a low arc or a high? Do they strike people in their path, or fly beyond? var/is_lobbing = FALSE ///Verboten munitions. This is a blacklist. Anything in this list isn't loadable. - var/disallowed_grenade_types = list(/obj/item/explosive/grenade/spawnergrenade, /obj/item/explosive/grenade/alien, /obj/item/explosive/grenade/incendiary/molotov, /obj/item/explosive/grenade/flashbang) + var/disallowed_grenade_types = list(/obj/item/explosive/grenade/spawnergrenade, + /obj/item/explosive/grenade/alien, + /obj/item/explosive/grenade/nerve_gas, + /obj/item/explosive/grenade/incendiary/bursting_pipe, + /obj/item/explosive/grenade/xeno_acid_grenade, + /obj/item/explosive/grenade/incendiary/molotov, + /obj/item/explosive/grenade/flashbang) ///What is this weapon permitted to fire? This is a whitelist. Anything in this list can be fired. Anything. var/valid_munitions = list(/obj/item/explosive/grenade) diff --git a/code/modules/projectiles/magazines/misc.dm b/code/modules/projectiles/magazines/misc.dm index 87568c953211..251b863535e7 100644 --- a/code/modules/projectiles/magazines/misc.dm +++ b/code/modules/projectiles/magazines/misc.dm @@ -47,12 +47,16 @@ //rocket launchers /obj/item/ammo_magazine/rifle/grenadespawner + AUTOWIKI_SKIP(TRUE) + name = "\improper GRENADE SPAWNER AMMO" desc = "OH GOD OH FUCK" default_ammo = /datum/ammo/grenade_container/rifle ammo_band_color = AMMO_BAND_COLOR_LIGHT_EXPLOSIVE /obj/item/ammo_magazine/rifle/huggerspawner + AUTOWIKI_SKIP(TRUE) + name = "\improper HUGGER SPAWNER AMMO" desc = "OH GOD OH FUCK" default_ammo = /datum/ammo/hugger_container diff --git a/colonialmarines.dme b/colonialmarines.dme index d4c8bf6ce6e3..86ec739fa71f 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -37,6 +37,7 @@ #include "code\__DEFINES\atmospherics.dm" #include "code\__DEFINES\autofire.dm" #include "code\__DEFINES\autolathe.dm" +#include "code\__DEFINES\autowiki.dm" #include "code\__DEFINES\blood.dm" #include "code\__DEFINES\bsql.config.dm" #include "code\__DEFINES\bullet_traits.dm"