diff --git a/code/modules/codex/entries/guns_codex.dm b/code/modules/codex/entries/guns_codex.dm index 3af34845eca..ab4c6a29f78 100644 --- a/code/modules/codex/entries/guns_codex.dm +++ b/code/modules/codex/entries/guns_codex.dm @@ -13,87 +13,145 @@ /obj/item/weapon/gun/get_mechanics_info() . = ..() var/list/traits = list() + traits += "----------------------------------------------------------" + traits += "Caliber: [caliber]" if(flags_gun_features & GUN_WIELDED_FIRING_ONLY) - traits += "This can only be fired with a two-handed grip." - else - traits += "It's best fired with a two-handed grip." - - - if(HAS_TRAIT(src, TRAIT_GUN_SAFETY)) - traits += "It has a safety switch. Alt-Click it to toggle safety." - - if(scope_zoom) //flawed, unless you check the codex for the first time when the scope is attached, this won't show. works for sniper rifles though. - traits += "It has a magnifying optical scope. It can be toggled with Use Scope verb." - - if(burst_amount > 2) - traits += "It has multiple firemodes. Click the Toggle Burst Fire button to change it." - - - traits += "
Caliber: [caliber]" - + traits += "Can only be fired with a two-handed grip." + if(burst_amount > 1) + traits += "Can fire in short bursts." if(max_shells) - traits += "It can normally hold [max_shells] rounds." - + traits += "Normally holds [max_shells] rounds." if(max_shots) traits += "Its maximum capacity is normally [max_shots] shots worth of power." var/list/loading_ways = list() if(load_method & SINGLE_CASING) - loading_ways += "loose [caliber] rounds." + loading_ways += "loose [caliber] rounds" if(load_method & SPEEDLOADER) - loading_ways += "speedloaders." + loading_ways += "speedloaders" if(load_method & MAGAZINE) - loading_ways += "magazines." + loading_ways += "magazines" if(load_method & CELL) - loading_ways += "cells." + loading_ways += "cells" if(load_method & POWERPACK) - loading_ways += "it's powerpack." - traits += "Can be loaded using [english_list(loading_ways)]" + loading_ways += "it's powerpack" + traits += "Can be loaded using: [english_list(loading_ways)]:" + + if(allowed_ammo_types) + for(var/i in allowed_ammo_types) + var/obj/item/ammo_magazine/mag = i + if(!mag.default_ammo) //no ammo in mag - just print the name, otherwise add stats + traits += mag.name + continue + + var/datum/ammo/bullet/def_ammo = mag.default_ammo + if(!mag.default_ammo.damage) + continue + var/damage_text = "DMG:[def_ammo.damage]" + if(def_ammo.bonus_projectiles_amount > 0) + damage_text += "x[def_ammo.bonus_projectiles_amount]" + var/ap_text = "AP:[def_ammo.penetration+def_ammo.additional_xeno_penetration]" + var/falloff_text = "FLF:-[def_ammo.damage_falloff]/tile" + var/size_text = "AMMO: [mag.max_rounds]" + traits += mag.name + traits += "-> [damage_text], [ap_text], [falloff_text], [size_text]" - if(attachable_allowed) - traits += "
You can attach:" - for(var/X in attachable_allowed) - var/obj/item/attachable/A = X - traits += "[initial(A.name)]" - - traits += "
Basic Statistics for this weapon are as follows:" + if(load_method & SINGLE_CASING) + //check is done based on caliber only + for (var/i in typesof(/obj/item/ammo_magazine/handful)) + var/obj/item/ammo_magazine/handful/mag = i + if(mag.caliber != caliber) + continue + if(!mag.default_ammo) //no ammo in mag - just print the name, otherwise add stats + traits += mag.name + continue + + var/datum/ammo/bullet/def_ammo = mag.default_ammo + if(!mag.default_ammo.damage) + continue + var/damage_text = "DMG:[def_ammo.damage]" + if(def_ammo.bonus_projectiles_amount > 0) + damage_text += "x[def_ammo.bonus_projectiles_amount]" + var/ap_text = "AP:[def_ammo.penetration+def_ammo.additional_xeno_penetration]" + var/falloff_text = "FLF:-[def_ammo.damage_falloff]/tile" + traits += def_ammo.name + traits += "-> [damage_text], [ap_text], [falloff_text]" + + traits += "Examine the ammo holders or ammunition for more info." + + traits += "----------------------------------------------------------" if(w_class) traits += "Size: [w_class]" - if(force) - traits += "Base melee damage: [force]" - if(accuracy_mult) - traits += "Accuracy: [((accuracy_mult - 1) * 100) > 0 ? "+[(accuracy_mult - 1) * 100]" : "[(accuracy_mult - 1) * 100]"]%" - if(damage_mult) - traits += "Damage modifier: [((damage_mult - 1) * 100) > 0 ? "+[(damage_mult - 1) * 100]" : "[(damage_mult - 1) * 100]"]%" - if(damage_falloff_mult) - traits += "Damage falloff: -[damage_falloff_mult] per tile travelled." - if(recoil) - traits += "Recoil: [recoil]" - if(scatter) - traits += "Scatter angle: [scatter]" - if(burst_scatter_mult) - traits += "Burst scatter angle multiplier: x[burst_scatter_mult]" - if(accuracy_mult_unwielded) - traits += "Accuracy unwielded modifier: [((accuracy_mult_unwielded - 1) * 100) > 0 ? "+[(accuracy_mult_unwielded - 1) * 100]" : "[(accuracy_mult_unwielded - 1) * 100]"]%" - if(recoil_unwielded) - traits += "Recoil Unwielded: [recoil_unwielded]" - if(scatter_unwielded) - traits += "Unwielded Scatter angle: [scatter_unwielded > 0 ? "+[scatter_unwielded]" : "[scatter_unwielded]"]" - if(movement_acc_penalty_mult) - traits += "Movement unwielded penalty modifier: -[(movement_acc_penalty_mult * 0.15) * 100]%" if(fire_delay) traits += "Time between single-fire: [fire_delay * 0.1] seconds" - if(wield_delay) - traits += "Wield delay: [wield_delay * 0.1] seconds" if(burst_amount > 1) traits += "Shots fired on burst mode: [burst_amount]" - traits += "Time between burst-fire: [(min((burst_delay * 2), (fire_delay * 3))) * 0.1] seconds" + traits += "Time between bursts: [((burst_amount-1)*burst_delay + fire_delay + extra_delay) * 0.1] seconds" if(/datum/action/item_action/aim_mode in actions_types) traits += "Can be aimed with to shoot past allies." traits += "Time between aimed shots: [(fire_delay + aim_fire_delay) * 0.1] seconds" + if(wield_delay) + traits += "Wield delay: [wield_delay * 0.1] seconds" + if(force) + traits += "Melee damage: [force]" + if(damage_mult <> 1) + traits += "Damage multiplier: x[damage_mult]" + if(damage_falloff_mult <> 1) + traits += "Damage falloff multiplier: x[damage_falloff_mult]" + if(accuracy_mult <> 1) + traits += "Accuracy multiplier: x[accuracy_mult]" + if(accuracy_mult_unwielded) + traits += "Accuracy unwielded multiplier: x[accuracy_mult_unwielded]" + if(movement_acc_penalty_mult) + traits += "Moving accuracy (flat malus): -[(movement_acc_penalty_mult * 3)]%" + if(recoil) + traits += "Recoil: [recoil]" + if(recoil_unwielded) + traits += "Recoil unwielded: [recoil_unwielded]" + if(scatter) + traits += "Scatter angle: [scatter]" + if(scatter_unwielded) + traits += "Unwielded scatter angle: [scatter_unwielded]" + if(burst_scatter_mult <> 1) + traits += "Burst scatter angle multiplier: x[burst_scatter_mult]" - traits += "
" + traits += "----------------------------------------------------------" + if(attachable_allowed) + var/list/attachments_header_text = list( + ATTACHMENT_SLOT_RAIL = "Rail attachments:", + ATTACHMENT_SLOT_UNDER = "Handguard attachments:", + ATTACHMENT_SLOT_MUZZLE = "Muzzle attachments:", + ATTACHMENT_SLOT_STOCK = "Stock attachments:", + ATTACHMENT_BARREL_MOD = "Barrel attachments:", + "other" = "Other attachments:" + ) + var/list/attachments_text = list( + ATTACHMENT_SLOT_RAIL = list(), + ATTACHMENT_SLOT_UNDER = list(), + ATTACHMENT_SLOT_MUZZLE = list(), + ATTACHMENT_SLOT_STOCK = list(), + ATTACHMENT_BARREL_MOD = list(), + "other" = list() + ) + + for(var/att in attachable_allowed) + var/obj/item/attachable/A = att + if(A.slot in attachments_text) + attachments_text[A.slot] += A.name + else + attachments_text["other"] += A.name + for(var/i in attachments_text) + var/list/attach_list_of_type = attachments_text[i] + if(length(attach_list_of_type) <= 0) + continue + + traits += attachments_header_text[i] + attachments_text[i] = sortList(attachments_text[i]) + traits += attachments_text[i] + + traits += "----------------------------------------------------------" + traits += "How to use:
" var/list/entries = SScodex.retrieve_entries_for_string(general_codex_key) var/datum/codex_entry/general_entry = LAZYACCESS(entries, 1) if(general_entry?.mechanics_text)