diff --git a/_maps/RandomZLevels/blackmesa.dmm b/_maps/RandomZLevels/blackmesa.dmm index 6b38dda3e8f..8c2d300c788 100644 --- a/_maps/RandomZLevels/blackmesa.dmm +++ b/_maps/RandomZLevels/blackmesa.dmm @@ -3998,9 +3998,7 @@ /area/awaymission/black_mesa/security_outpost) "aYe" = ( /obj/structure/rack/gunrack, -/obj/item/gun/ballistic/revolver/mateba{ - fire_select_modes = list(1,2) - }, +/obj/item/gun/ballistic/revolver/mateba, /obj/effect/mapping_helpers/broken_floor, /turf/open/floor/plating, /area/awaymission/black_mesa/security_outpost) @@ -5153,7 +5151,6 @@ /obj/item/gun/ballistic/automatic/pistol/g17/mesa{ burst_size = 3; desc = "A weapon from bygone times, and this is the exact 21st century version. In fact, even more reliable, but it also can run full automatic fire mode. Chambered in 9mm."; - fire_select_modes = list(1,2,3); firing_burst = 1; name = "\improper Glock-18" }, diff --git a/code/__DEFINES/~skyrat_defines/gun.dm b/code/__DEFINES/~skyrat_defines/gun.dm index 6d2d4adcbaa..626b27a4522 100644 --- a/code/__DEFINES/~skyrat_defines/gun.dm +++ b/code/__DEFINES/~skyrat_defines/gun.dm @@ -1,7 +1,3 @@ -#define SELECT_SEMI_AUTOMATIC 1 -#define SELECT_BURST_SHOT 2 -#define SELECT_FULLY_AUTOMATIC 3 - // Bitflags for what company produces the gun #define COMPANY_CANTALAN (1<<0) #define COMPANY_ARMADYNE (1<<1) diff --git a/code/datums/components/fullauto.dm b/code/datums/components/fullauto.dm index 279a9e473cf..28009784233 100644 --- a/code/datums/components/fullauto.dm +++ b/code/datums/components/fullauto.dm @@ -1,4 +1,3 @@ -/* SKYRAT EDIT REMOVAL - MOVED TO MODULAR FULLAUTO.DM #define AUTOFIRE_MOUSEUP 0 #define AUTOFIRE_MOUSEDOWN 1 @@ -313,4 +312,3 @@ #undef AUTOFIRE_MOUSEUP #undef AUTOFIRE_MOUSEDOWN -*/ diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 5ffd0cb9562..b73ba371644 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -1,4 +1,3 @@ -/* SKYRAT EDIT REMOVAL - MOVED TO MODULAR GUN.DM #define DUALWIELD_PENALTY_EXTRA_MULTIPLIER 1.4 #define FIRING_PIN_REMOVAL_DELAY 50 @@ -75,6 +74,8 @@ pin = new pin(src) add_seclight_point() + give_gun_safeties() // SKYRAT EDIT ADDITION - GUN SAFETIES + give_manufacturer_examine() // SKYRAT EDIT ADDITON - MANUFACTURER EXAMINE /obj/item/gun/Destroy() if(isobj(pin)) //Can still be the initial path, then we skip @@ -577,4 +578,3 @@ #undef FIRING_PIN_REMOVAL_DELAY #undef DUALWIELD_PENALTY_EXTRA_MULTIPLIER -*/ diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm index d006e3e4138..1e3870b063e 100644 --- a/code/modules/projectiles/guns/ballistic/automatic.dm +++ b/code/modules/projectiles/guns/ballistic/automatic.dm @@ -1,4 +1,3 @@ -/* SKYRAT EDIT REMOVAL - MOVED TO MODULAR AUTOMATIC.DM /obj/item/gun/ballistic/automatic w_class = WEIGHT_CLASS_NORMAL can_suppress = TRUE @@ -398,4 +397,3 @@ actions_types = list() fire_sound = 'sound/weapons/laser.ogg' casing_ejector = FALSE -*/ diff --git a/code/modules/projectiles/guns/ballistic/launchers.dm b/code/modules/projectiles/guns/ballistic/launchers.dm index 7e58f2ddacd..36cefffc478 100644 --- a/code/modules/projectiles/guns/ballistic/launchers.dm +++ b/code/modules/projectiles/guns/ballistic/launchers.dm @@ -11,7 +11,6 @@ w_class = WEIGHT_CLASS_NORMAL pin = /obj/item/firing_pin/implant/pindicate bolt_type = BOLT_TYPE_NO_BOLT - has_gun_safety = FALSE //SKYRAT EDIT /obj/item/gun/ballistic/revolver/grenadelauncher/unrestricted pin = /obj/item/firing_pin @@ -40,7 +39,6 @@ mag_type = /obj/item/ammo_box/magazine/m75 burst_size = 1 fire_delay = 0 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) //SKYRAT EDIT CHANGE casing_ejector = FALSE /obj/item/gun/ballistic/rocketlauncher diff --git a/code/modules/projectiles/guns/ballistic/pistol.dm b/code/modules/projectiles/guns/ballistic/pistol.dm index 661ad6dad4c..fed8df4d2c7 100644 --- a/code/modules/projectiles/guns/ballistic/pistol.dm +++ b/code/modules/projectiles/guns/ballistic/pistol.dm @@ -8,7 +8,6 @@ can_suppress = TRUE burst_size = 1 fire_delay = 0 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) //SKYRAT EDIT CHANGE bolt_type = BOLT_TYPE_LOCKING fire_sound = 'sound/weapons/gun/pistol/shot.ogg' dry_fire_sound = 'sound/weapons/gun/pistol/dry_fire.ogg' diff --git a/code/modules/projectiles/guns/ballistic/shotgun.dm b/code/modules/projectiles/guns/ballistic/shotgun.dm index f6ba97d06ab..8728e924f81 100644 --- a/code/modules/projectiles/guns/ballistic/shotgun.dm +++ b/code/modules/projectiles/guns/ballistic/shotgun.dm @@ -142,7 +142,6 @@ fire_delay = 10 //Skyrat edit - Original: 0 pin = /obj/item/firing_pin/implant/pindicate fire_sound = 'sound/weapons/gun/shotgun/shot_alt.ogg' - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) //SKYRAT EDIT CHANGE mag_display = TRUE empty_indicator = TRUE empty_alarm = TRUE diff --git a/code/modules/projectiles/guns/energy/laser_gatling.dm b/code/modules/projectiles/guns/energy/laser_gatling.dm index 9a965f02692..f12a62d2c26 100644 --- a/code/modules/projectiles/guns/energy/laser_gatling.dm +++ b/code/modules/projectiles/guns/energy/laser_gatling.dm @@ -113,15 +113,13 @@ item_flags = NEEDS_PERMIT | SLOWS_WHILE_IN_HAND can_charge = FALSE var/obj/item/minigunpack/ammo_pack - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC)//SKYRAT EDIT ADDITION - /obj/item/gun/energy/minigun/Initialize(mapload) if(!istype(loc, /obj/item/minigunpack)) //We should spawn inside an ammo pack so let's use that one. return INITIALIZE_HINT_QDEL //No pack, no gun ammo_pack = loc AddElement(/datum/element/update_icon_blocker) - //AddComponent(/datum/component/automatic_fire, 0.2 SECONDS) SKYRAT EDIT REMOVAL + AddComponent(/datum/component/automatic_fire, 0.2 SECONDS) return ..() /obj/item/gun/energy/minigun/Destroy() diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 12212dd9b9b..630b02d40e9 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -381,7 +381,7 @@ /obj/item/gun/energy/tesla_cannon/Initialize(mapload) . = ..() - //AddComponent(/datum/component/automatic_fire, 0.1 SECONDS) SKYRAT EDIT REMOVAL + AddComponent(/datum/component/automatic_fire, 0.1 SECONDS) /obj/item/gun/energy/marksman_revolver name = "marksman revolver" diff --git a/code/modules/projectiles/guns/special/syringe_gun.dm b/code/modules/projectiles/guns/special/syringe_gun.dm index 1911d139f53..cf79da9dfca 100644 --- a/code/modules/projectiles/guns/special/syringe_gun.dm +++ b/code/modules/projectiles/guns/special/syringe_gun.dm @@ -194,7 +194,6 @@ pixel_x = 0 force = 4 trigger_guard = TRIGGER_GUARD_ALLOW_ALL - has_gun_safety = FALSE // SKYRAT EDIT /obj/item/gun/syringe/blowgun/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0) visible_message(span_danger("[user] starts aiming with a blowgun!")) diff --git a/code/modules/unit_tests/mecha_damage.dm b/code/modules/unit_tests/mecha_damage.dm index e3ca7566e90..55081e9365c 100644 --- a/code/modules/unit_tests/mecha_damage.dm +++ b/code/modules/unit_tests/mecha_damage.dm @@ -30,7 +30,7 @@ // Get a sample laser weapon. // The captain's laser gun here is chosen primarily because it deals more damage than normal lasers. var/obj/item/gun/energy/laser/dummy_laser = allocate(/obj/item/gun/energy/laser/captain) - dummy_laser.safety = FALSE // SKYRAT EDIT - Safeties on guns make them impossible to shoot :) + qdel(dummy_laser.GetComponent(/datum/component/gun_safety)) // SKYRAT EDIT - Safeties on guns make them impossible to shoot :) var/obj/item/ammo_casing/laser_ammo = dummy_laser.ammo_type[1] var/obj/projectile/beam/laser_fired = initial(laser_ammo.projectile_type) var/expected_laser_damage = round(dummy_laser.projectile_damage_multiplier * initial(laser_fired.damage) * (1 - expected_laser_armor / 100), DAMAGE_PRECISION) @@ -38,7 +38,7 @@ // Get a sample ballistic weapon. // The syndicate .357 here is chosen because it does a lot of damage. var/obj/item/gun/ballistic/dummy_gun = allocate(/obj/item/gun/ballistic/revolver) - dummy_gun.safety = FALSE // SKYRAT EDIT - Safeties on guns make them impossible to shoot :) + qdel(dummy_gun.GetComponent(/datum/component/gun_safety)) // SKYRAT EDIT - Safeties on guns make them impossible to shoot :) var/obj/item/ammo_casing/ballistic_ammo = dummy_gun.magazine.ammo_type var/obj/projectile/bullet_fired = initial(ballistic_ammo.projectile_type) var/expected_bullet_damage = round(dummy_gun.projectile_damage_multiplier * initial(bullet_fired.damage) * (1 - expected_bullet_armor / 100), DAMAGE_PRECISION) diff --git a/code/modules/unit_tests/projectiles.dm b/code/modules/unit_tests/projectiles.dm index e0c04f0ce9e..8f0872d0e89 100644 --- a/code/modules/unit_tests/projectiles.dm +++ b/code/modules/unit_tests/projectiles.dm @@ -18,8 +18,8 @@ gunner.put_in_hands(test_gun, forced=TRUE) //SKYRAT EDIT ADDITION BEGIN - if(test_gun.has_gun_safety) - test_gun.toggle_safety(gunner) + if(test_gun.GetComponent(/datum/component/gun_safety)) + qdel(test_gun.GetComponent(/datum/component/gun_safety)) loaded_bullet.wound_bonus = CANT_WOUND //Baseline wounding makes things weird //SKYRAT EDIT ADDITION END gunner.set_combat_mode(FALSE) // just to make sure we know we're not trying to pistol-whip them diff --git a/modular_skyrat/master_files/code/datums/components/fullauto.dm b/modular_skyrat/master_files/code/datums/components/fullauto.dm deleted file mode 100644 index 4ecd620fac4..00000000000 --- a/modular_skyrat/master_files/code/datums/components/fullauto.dm +++ /dev/null @@ -1,320 +0,0 @@ -#define AUTOFIRE_MOUSEUP 0 -#define AUTOFIRE_MOUSEDOWN 1 - -/datum/component/automatic_fire - var/client/clicker - var/mob/living/shooter - var/atom/target - var/turf/target_loc // For dealing with locking on targets due to BYOND engine limitations (the mouse input only happening when mouse moves). - var/autofire_stat = AUTOFIRE_STAT_IDLE - var/mouse_parameters - var/autofire_shot_delay = 0.3 SECONDS // Time between individual shots. - var/mouse_status = AUTOFIRE_MOUSEUP // This seems hacky but there can be two MouseDown() without a MouseUp() in between if the user holds click and uses alt+tab, printscreen or similar. - - ///windup autofire vars - ///Whether the delay between shots increases over time, simulating a spooling weapon - var/windup_autofire = FALSE - ///the reduction to shot delay for windup - var/current_windup_reduction = 0 - ///the percentage of autfire_shot_delay that is added to current_windup_reduction - var/windup_autofire_reduction_multiplier = 0.3 - ///How high of a reduction that current_windup_reduction can reach - var/windup_autofire_cap = 0.3 - ///How long it takes for weapons that have spooled-up to reset back to the original firing speed - var/windup_spindown = 3 SECONDS - ///Timer for tracking the spindown reset timings - var/timerid - COOLDOWN_DECLARE(next_shot_cd) - -/datum/component/automatic_fire/Initialize(autofire_shot_delay, windup_autofire, windup_autofire_reduction_multiplier, windup_autofire_cap, windup_spindown) - . = ..() - if(!isgun(parent)) - return COMPONENT_INCOMPATIBLE - var/obj/item/gun = parent - RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(wake_up)) - RegisterSignal(parent, COMSIG_GUN_AUTOFIRE_SELECTED, PROC_REF(wake_up)) - RegisterSignals(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_ITEM_DROPPED, COMSIG_GUN_AUTOFIRE_DESELECTED), PROC_REF(autofire_off)) - RegisterSignal(parent, COMSIG_GUN_JAMMED, PROC_REF(stop_autofiring)) - if(autofire_shot_delay) - src.autofire_shot_delay = autofire_shot_delay - if(windup_autofire) - src.windup_autofire = windup_autofire - src.windup_autofire_reduction_multiplier = windup_autofire_reduction_multiplier - src.windup_autofire_cap = windup_autofire_cap - src.windup_spindown = windup_spindown - if(ismob(gun.loc)) - var/mob/user = gun.loc - wake_up(src, user) - - -/datum/component/automatic_fire/Destroy() - UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_ITEM_DROPPED, COMSIG_GUN_AUTOFIRE_DESELECTED, COMSIG_GUN_JAMMED, \ - COMSIG_GUN_AUTOFIRE_SELECTED, COMSIG_ITEM_EQUIPPED)) - autofire_off() - return ..() - -/datum/component/automatic_fire/process(delta_time) - if(!(autofire_stat & AUTOFIRE_STAT_FIRING)) - STOP_PROCESSING(SSprojectiles, src) - return - - if(!COOLDOWN_FINISHED(src, next_shot_cd)) - return - - process_shot() - -/datum/component/automatic_fire/proc/wake_up(datum/source, mob/user, slot) - SIGNAL_HANDLER - if(autofire_stat & (AUTOFIRE_STAT_ALERT)) - return // We've updated the firemode. No need for more. - if(autofire_stat & AUTOFIRE_STAT_FIRING) - stop_autofiring() // Let's stop shooting to avoid issues. - return - - var/obj/item/gun/parent_gun = parent - - if(iscarbon(user)) - var/mob/living/carbon/shooter = user - if(shooter.is_holding(parent) && parent_gun.fire_select == SELECT_FULLY_AUTOMATIC) - autofire_on(shooter.client) - else - autofire_off() - -// There is a gun and there is a user wielding it. The component now waits for the mouse click. -/datum/component/automatic_fire/proc/autofire_on(client/usercli) - SIGNAL_HANDLER - if(autofire_stat & (AUTOFIRE_STAT_ALERT|AUTOFIRE_STAT_FIRING)) - return - autofire_stat = AUTOFIRE_STAT_ALERT - clicker = usercli - shooter = clicker.mob - RegisterSignal(clicker, COMSIG_CLIENT_MOUSEDOWN, PROC_REF(on_mouse_down)) - RegisterSignal(shooter, COMSIG_MOB_LOGOUT, PROC_REF(autofire_off)) - if(!QDELETED(shooter)) - UnregisterSignal(shooter, COMSIG_MOB_LOGIN) - parent.RegisterSignal(src, COMSIG_AUTOFIRE_ONMOUSEDOWN, TYPE_PROC_REF(/obj/item/gun, autofire_bypass_check)) - parent.RegisterSignal(parent, COMSIG_AUTOFIRE_SHOT, TYPE_PROC_REF(/obj/item/gun, do_autofire)) - - -/datum/component/automatic_fire/proc/autofire_off(datum/source) - SIGNAL_HANDLER - if(autofire_stat & (AUTOFIRE_STAT_IDLE)) - return - if(autofire_stat & AUTOFIRE_STAT_FIRING) - stop_autofiring() - - autofire_stat = AUTOFIRE_STAT_IDLE - - if(!QDELETED(clicker)) - UnregisterSignal(clicker, list(COMSIG_CLIENT_MOUSEDOWN, COMSIG_CLIENT_MOUSEUP, COMSIG_CLIENT_MOUSEDRAG)) - mouse_status = AUTOFIRE_MOUSEUP // In regards to the component there's no click anymore to care about. - clicker = null - RegisterSignal(shooter, COMSIG_MOB_LOGIN, PROC_REF(on_client_login)) - if(!QDELETED(shooter)) - UnregisterSignal(shooter, COMSIG_MOB_LOGOUT) - shooter = null - parent.UnregisterSignal(src, COMSIG_AUTOFIRE_ONMOUSEDOWN) - parent.UnregisterSignal(parent, COMSIG_AUTOFIRE_SHOT) - - -/datum/component/automatic_fire/proc/on_client_login(mob/source) - SIGNAL_HANDLER - if(!source.client) - return - if(source.is_holding(parent)) - autofire_on(source.client) - -/datum/component/automatic_fire/proc/on_mouse_down(client/source, atom/_target, turf/location, control, params) - SIGNAL_HANDLER - var/list/modifiers = params2list(params) // If they're shift+clicking, for example, let's not have them accidentally shoot. - - if(LAZYACCESS(modifiers, SHIFT_CLICK)) - return - if(LAZYACCESS(modifiers, CTRL_CLICK)) - return - if(LAZYACCESS(modifiers, MIDDLE_CLICK)) - return - if(LAZYACCESS(modifiers, RIGHT_CLICK)) - return - if(LAZYACCESS(modifiers, ALT_CLICK)) - return - if(source.mob.throw_mode) - return - if(!isturf(source.mob.loc)) // No firing inside lockers and stuff. - return - if(get_dist(source.mob, _target) < 2) // Adjacent clicking. - return - - if(isnull(location) || istype(_target, /atom/movable/screen)) // Clicking on a screen object. - if(_target.plane != CLICKCATCHER_PLANE) // The clickcatcher is a special case. We want the click to trigger then, under it. - return // If we click and drag on our worn backpack, for example, we want it to open instead. - _target = parse_caught_click_modifiers(modifiers, get_turf(source.eye), source) - params = list2params(modifiers) - if(!_target) - CRASH("Failed to get the turf under clickcatcher") - - if(SEND_SIGNAL(src, COMSIG_AUTOFIRE_ONMOUSEDOWN, source, _target, location, control, params) & COMPONENT_AUTOFIRE_ONMOUSEDOWN_BYPASS) - return - - source.click_intercept_time = world.time // From this point onwards Click() will no longer be triggered. - - if(autofire_stat & (AUTOFIRE_STAT_IDLE)) - CRASH("on_mouse_down() called with [autofire_stat] autofire_stat") - if(autofire_stat & AUTOFIRE_STAT_FIRING) - stop_autofiring() // This can happen if we click and hold and then alt+tab, printscreen or other such action. MouseUp won't be called then and it will keep autofiring. - - target = _target - target_loc = get_turf(target) - mouse_parameters = params - start_autofiring() - - -// Dakka-dakka -/datum/component/automatic_fire/proc/start_autofiring() - if(autofire_stat == AUTOFIRE_STAT_FIRING) - return // Already pew-pewing. - - autofire_stat = AUTOFIRE_STAT_FIRING - - clicker.mouse_override_icon = 'icons/effects/mouse_pointers/weapon_pointer.dmi' - clicker.mouse_pointer_icon = clicker.mouse_override_icon - - if(mouse_status == AUTOFIRE_MOUSEUP) // See mouse_status definition for the reason for this. - RegisterSignal(clicker, COMSIG_CLIENT_MOUSEUP, PROC_REF(on_mouse_up)) - mouse_status = AUTOFIRE_MOUSEDOWN - - RegisterSignal(shooter, COMSIG_MOB_SWAP_HANDS, PROC_REF(stop_autofiring)) - - if(isgun(parent)) - var/obj/item/gun/shoota = parent - if(!shoota.on_autofire_start(shooter)) // This is needed because the minigun has a do_after before firing and signals are async. - stop_autofiring() - return - if(autofire_stat != AUTOFIRE_STAT_FIRING) - return // Things may have changed while on_autofire_start() was being processed, due to do_after's sleep. - - if(!process_shot()) // First shot is processed instantly. - return // If it fails, such as when the gun is empty, then there's no need to schedule a second shot. - - START_PROCESSING(SSprojectiles, src) - RegisterSignal(clicker, COMSIG_CLIENT_MOUSEDRAG, PROC_REF(on_mouse_drag)) - - -/datum/component/automatic_fire/proc/on_mouse_up(datum/source, atom/object, turf/location, control, params) - SIGNAL_HANDLER - UnregisterSignal(clicker, COMSIG_CLIENT_MOUSEUP) - mouse_status = AUTOFIRE_MOUSEUP - if(autofire_stat == AUTOFIRE_STAT_FIRING) - stop_autofiring() - return COMPONENT_CLIENT_MOUSEUP_INTERCEPT - - -/datum/component/automatic_fire/proc/stop_autofiring(datum/source, atom/object, turf/location, control, params) - SIGNAL_HANDLER - switch(autofire_stat) - if(AUTOFIRE_STAT_IDLE, AUTOFIRE_STAT_ALERT) - return - STOP_PROCESSING(SSprojectiles, src) - autofire_stat = AUTOFIRE_STAT_ALERT - if(clicker) - clicker.mouse_override_icon = null - clicker.mouse_pointer_icon = clicker.mouse_override_icon - UnregisterSignal(clicker, COMSIG_CLIENT_MOUSEDRAG) - if(!QDELETED(shooter)) - UnregisterSignal(shooter, COMSIG_MOB_SWAP_HANDS) - target = null - target_loc = null - mouse_parameters = null - -/datum/component/automatic_fire/proc/on_mouse_drag(client/source, atom/src_object, atom/over_object, turf/src_location, turf/over_location, src_control, over_control, params) - SIGNAL_HANDLER - if(isnull(over_location)) // This happens when the mouse is over an inventory or screen object, or on entering deep darkness, for example. - var/list/modifiers = params2list(params) - var/new_target = parse_caught_click_modifiers(modifiers, get_turf(source.eye), source) - params = list2params(modifiers) - mouse_parameters = params - if(!new_target) - if(QDELETED(target)) // No new target acquired, and old one was deleted, get us out of here. - stop_autofiring() - CRASH("on_mouse_drag failed to get the turf under screen object [over_object.type]. Old target was incidentally QDELETED.") - target = get_turf(target) // If previous target wasn't a turf, let's turn it into one to avoid locking onto a potentially moving target. - target_loc = target - CRASH("on_mouse_drag failed to get the turf under screen object [over_object.type]") - target = new_target - target_loc = new_target - return - target = over_object - target_loc = get_turf(over_object) - mouse_parameters = params - - -/datum/component/automatic_fire/proc/process_shot() - if(autofire_stat != AUTOFIRE_STAT_FIRING) - return - if(QDELETED(target) || get_turf(target) != target_loc) // Target moved or got destroyed since we last aimed. - target = target_loc // So we keep firing on the emptied tile until we move our mouse and find a new target. - if(get_dist(shooter, target) <= 0) - target = get_step(shooter, shooter.dir) // Shoot in the direction faced if the mouse is on the same tile as we are. - target_loc = target - else if(!in_view_range(shooter, target)) - stop_autofiring() // Elvis has left the building. - return FALSE - shooter.face_atom(target) - var/next_delay = autofire_shot_delay - if(windup_autofire) - next_delay = clamp(next_delay - current_windup_reduction, round(autofire_shot_delay * windup_autofire_cap), autofire_shot_delay) - current_windup_reduction = (current_windup_reduction + round(autofire_shot_delay * windup_autofire_reduction_multiplier)) - timerid = addtimer(CALLBACK(src, PROC_REF(windup_reset), FALSE), windup_spindown, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE) - if(HAS_TRAIT(shooter, TRAIT_DOUBLE_TAP)) - next_delay = round(next_delay * 0.5) - COOLDOWN_START(src, next_shot_cd, next_delay) - if(SEND_SIGNAL(parent, COMSIG_AUTOFIRE_SHOT, target, shooter, mouse_parameters) & COMPONENT_AUTOFIRE_SHOT_SUCCESS) - return TRUE - stop_autofiring() - return FALSE - -/// Reset for our windup, resetting everything back to initial values after a variable set amount of time (determined by var/windup_spindown). -/datum/component/automatic_fire/proc/windup_reset(deltimer) - current_windup_reduction = initial(current_windup_reduction) - if(deltimer && timerid) - deltimer(timerid) - -// Gun procs. - -/obj/item/gun/proc/on_autofire_start(mob/living/shooter) - if(!can_shoot(shooter) || !can_trigger_gun(shooter) || shooter.incapacitated() || semicd) - return FALSE - var/obj/item/bodypart/other_hand = shooter.has_hand_for_held_index(shooter.get_inactive_hand_index()) - if(weapon_weight == WEAPON_HEAVY && (shooter.get_inactive_held_item() || !other_hand)) - balloon_alert(shooter, "need two hands!") - return FALSE - return TRUE - - -/obj/item/gun/proc/autofire_bypass_check(datum/source, client/clicker, atom/target, turf/location, control, params) - SIGNAL_HANDLER - if(clicker.mob.get_active_held_item() != src) - return COMPONENT_AUTOFIRE_ONMOUSEDOWN_BYPASS - -/obj/item/gun/proc/do_autofire(datum/source, atom/target, mob/living/shooter, params) - SIGNAL_HANDLER - if(shooter.incapacitated()) - return FALSE - if(!can_shoot()) - shoot_with_empty_chamber(shooter) - return FALSE - INVOKE_ASYNC(src, PROC_REF(do_autofire_shot), source, target, shooter, params) - return COMPONENT_AUTOFIRE_SHOT_SUCCESS - -/obj/item/gun/proc/do_autofire_shot(datum/source, atom/target, mob/living/shooter, params) - var/obj/item/gun/akimbo_gun = shooter.get_inactive_held_item() - var/bonus_spread = 0 - if(istype(akimbo_gun) && weapon_weight < WEAPON_MEDIUM) - if(akimbo_gun.weapon_weight < WEAPON_MEDIUM && akimbo_gun.can_trigger_gun(shooter)) - bonus_spread = dual_wield_spread - addtimer(CALLBACK(akimbo_gun, TYPE_PROC_REF(/obj/item/gun, process_fire), target, shooter, TRUE, params, null, bonus_spread), 1) - process_fire(target, shooter, TRUE, params, null, bonus_spread) - - -#undef AUTOFIRE_MOUSEUP -#undef AUTOFIRE_MOUSEDOWN diff --git a/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic.dm b/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic.dm deleted file mode 100644 index bc49ab26cf3..00000000000 --- a/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic.dm +++ /dev/null @@ -1,6 +0,0 @@ -// A file for overrides to ballistic weapons that don't have a special Skyrat icon. -/obj/item/gun/ballistic/rifle/lionhunter - icon = 'icons/obj/weapons/guns/ballistic.dmi' - -/obj/item/gun/ballistic/rifle/boltaction/brand_new/prime - icon = 'icons/obj/weapons/guns/ballistic.dmi' diff --git a/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic/automatic.dm b/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic/automatic.dm deleted file mode 100644 index 6864d0611b6..00000000000 --- a/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic/automatic.dm +++ /dev/null @@ -1,348 +0,0 @@ -/obj/item/gun/ballistic/automatic - w_class = WEIGHT_CLASS_NORMAL - can_suppress = TRUE - burst_size = 3 - fire_delay = 2 - semi_auto = TRUE - fire_sound = 'sound/weapons/gun/smg/shot.ogg' - fire_sound_volume = 90 - rack_sound = 'sound/weapons/gun/smg/smgrack.ogg' - suppressed_sound = 'sound/weapons/gun/smg/shot_suppressed.ogg' - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_BURST_SHOT, SELECT_FULLY_AUTOMATIC) - -/obj/item/gun/ballistic/automatic/proto - name = "\improper Nanotrasen Saber SMG" - desc = "A prototype three-round burst 9mm submachine gun, designated 'SABR'. Has a threaded barrel for suppressors." - icon_state = "saber" - selector_switch_icon = TRUE - mag_display = TRUE - empty_indicator = TRUE - mag_type = /obj/item/ammo_box/magazine/smgm9mm - pin = null - bolt_type = BOLT_TYPE_LOCKING - show_bolt_icon = FALSE - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/ballistic/automatic/proto/unrestricted - pin = /obj/item/firing_pin - -/obj/item/gun/ballistic/automatic/c20r - name = "\improper C-20r SMG" - desc = "A bullpup three-round burst .45 SMG, designated 'C-20r'." - icon_state = "c20r" - inhand_icon_state = "c20r" - selector_switch_icon = TRUE - mag_type = /obj/item/ammo_box/magazine/smgm45 - fire_delay = 2 - burst_size = 3 - pin = /obj/item/firing_pin/implant/pindicate - can_bayonet = TRUE - knife_x_offset = 26 - knife_y_offset = 12 - mag_display = TRUE - mag_display_ammo = TRUE - empty_indicator = TRUE - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/ballistic/automatic/c20r/update_overlays() - . = ..() - if(!chambered && empty_indicator) - . += "[icon_state]_empty" - -/obj/item/gun/ballistic/automatic/c20r/unrestricted - pin = /obj/item/firing_pin - -/obj/item/gun/ballistic/automatic/c20r/Initialize(mapload) - . = ..() - update_appearance() - -/obj/item/gun/ballistic/automatic/wt550 - name = "security auto rifle" - desc = "An outdated personal defence weapon. Uses 4.6x30mm rounds and is designated the WT-550 Automatic Rifle." - icon_state = "wt550" - w_class = WEIGHT_CLASS_BULKY - inhand_icon_state = "arg" - mag_type = /obj/item/ammo_box/magazine/wt550m9 - fire_delay = 2 - can_suppress = FALSE - burst_size = 1 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) - can_bayonet = TRUE - knife_x_offset = 25 - knife_y_offset = 12 - mag_display = TRUE - mag_display_ammo = TRUE - empty_indicator = TRUE - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/ballistic/automatic/plastikov - name = "\improper PP-95 SMG" - desc = "An ancient 9mm submachine gun pattern updated and simplified to lower costs, though perhaps simplified too much." - icon_state = "plastikov" - inhand_icon_state = "plastikov" - mag_type = /obj/item/ammo_box/magazine/plastikov9mm - burst_size = 5 - spread = 15 - can_suppress = FALSE - projectile_damage_multiplier = 0.35 // It's like 10.5 damage per bullet, it's close enough to 10 shots - mag_display = TRUE - empty_indicator = TRUE - fire_sound = 'sound/weapons/gun/smg/shot_alt.ogg' - company_flag = COMPANY_IZHEVSK - -/obj/item/gun/ballistic/automatic/mini_uzi - name = "\improper type U3 uzi" - desc = "A lightweight, burst-fire submachine gun, for when you really want someone dead. Uses 9mm rounds." - icon_state = "miniuzi" - mag_type = /obj/item/ammo_box/magazine/uzim9mm - burst_size = 2 - bolt_type = BOLT_TYPE_OPEN - show_bolt_icon = FALSE - mag_display = TRUE - rack_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' - company_flag = COMPANY_OLDARMS - -/obj/item/gun/ballistic/automatic/m90 - name = "\improper M-90gl carbine" - desc = "A three-round burst 5.56 toploading carbine, designated 'M-90gl'. Has an attached underbarrel grenade launcher which can be fired using right click." - icon_state = "m90" - w_class = WEIGHT_CLASS_BULKY - inhand_icon_state = "m90" - selector_switch_icon = TRUE - mag_type = /obj/item/ammo_box/magazine/m556 - can_suppress = FALSE - var/obj/item/gun/ballistic/revolver/grenadelauncher/underbarrel - burst_size = 3 - fire_delay = 2 - spread = 5 - pin = /obj/item/firing_pin/implant/pindicate - mag_display = TRUE - empty_indicator = TRUE - fire_sound = 'sound/weapons/gun/smg/shot_alt.ogg' - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/ballistic/automatic/m90/Initialize(mapload) - . = ..() - underbarrel = new /obj/item/gun/ballistic/revolver/grenadelauncher(src) - update_appearance() - -/obj/item/gun/ballistic/automatic/m90/Destroy() - QDEL_NULL(underbarrel) - return ..() - -/obj/item/gun/ballistic/automatic/m90/unrestricted - pin = /obj/item/firing_pin - -/obj/item/gun/ballistic/automatic/m90/unrestricted/Initialize(mapload) - . = ..() - underbarrel = new /obj/item/gun/ballistic/revolver/grenadelauncher/unrestricted(src) - update_appearance() - -/obj/item/gun/ballistic/automatic/m90/afterattack_secondary(atom/target, mob/living/user, flag, params) - underbarrel.afterattack(target, user, flag, params) - return SECONDARY_ATTACK_CONTINUE_CHAIN - -/obj/item/gun/ballistic/automatic/m90/attackby(obj/item/attacking_item, mob/user, params) - if(istype(attacking_item, /obj/item/ammo_casing)) - if(istype(attacking_item, underbarrel.magazine.ammo_type)) - underbarrel.attack_self(user) - underbarrel.attackby(attacking_item, user, params) - else - ..() - -/obj/item/gun/ballistic/automatic/tommygun - name = "\improper Thompson SMG" - desc = "Based on the classic 'Chicago Typewriter'." - icon_state = "tommygun" - inhand_icon_state = "shotgun" - selector_switch_icon = TRUE - w_class = WEIGHT_CLASS_BULKY - slot_flags = 0 - mag_type = /obj/item/ammo_box/magazine/tommygunm45 - can_suppress = FALSE - burst_size = 1 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) - fire_delay = 1 - bolt_type = BOLT_TYPE_OPEN - empty_indicator = TRUE - show_bolt_icon = FALSE - company_flag = COMPANY_OLDARMS - -/obj/item/gun/ballistic/automatic/tommygun/therealtommy - name = "Tommy gun" - desc = "The classic 'Chicago Typewriter'." - company_flag = null // This is the real deal, you hear? - -/obj/item/gun/ballistic/automatic/ar - name = "\improper NT-ARG 'Boarder'" - desc = "A robust assault rifle used by Nanotrasen fighting forces." - icon_state = "arg" - inhand_icon_state = "arg" - slot_flags = 0 - mag_type = /obj/item/ammo_box/magazine/m556 - can_suppress = FALSE - burst_size = 3 - fire_delay = 1 - company_flag = COMPANY_NANOTRASEN - - -// L6 SAW // - -/obj/item/gun/ballistic/automatic/l6_saw - name = "\improper L6 SAW" - desc = "A large light machine gun chambered for the 7.12x82mm cartridge." - icon_state = "l6" - inhand_icon_state = "l6closedmag" - base_icon_state = "l6" - w_class = WEIGHT_CLASS_HUGE - slot_flags = 0 - mag_type = /obj/item/ammo_box/magazine/mm712x82 - weapon_weight = WEAPON_HEAVY - burst_size = 1 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) - can_suppress = FALSE - spread = 7 - pin = /obj/item/firing_pin/implant/pindicate - bolt_type = BOLT_TYPE_OPEN - show_bolt_icon = FALSE - mag_display = TRUE - mag_display_ammo = TRUE - tac_reloads = FALSE - fire_sound = 'sound/weapons/gun/l6/shot.ogg' - rack_sound = 'sound/weapons/gun/l6/l6_rack.ogg' - suppressed_sound = 'sound/weapons/gun/general/heavy_shot_suppressed.ogg' - var/cover_open = FALSE - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/ballistic/automatic/l6_saw/unrestricted - pin = /obj/item/firing_pin - -/obj/item/gun/ballistic/automatic/l6_saw/Initialize(mapload) - . = ..() - AddElement(/datum/element/update_icon_updates_onmob) - -/obj/item/gun/ballistic/automatic/l6_saw/examine(mob/user) - . = ..() - . += "alt + click to [cover_open ? "close" : "open"] the dust cover." - if(cover_open && magazine) - . += span_notice("It seems like you could use an empty hand to remove the magazine.") - - -/obj/item/gun/ballistic/automatic/l6_saw/AltClick(mob/user) - if(!user.canUseTopic(src)) - return - cover_open = !cover_open - balloon_alert(user, "cover [cover_open ? "open" : "closed"]") - playsound(src, 'sound/weapons/gun/l6/l6_door.ogg', 60, TRUE) - update_appearance() - -/obj/item/gun/ballistic/automatic/l6_saw/update_icon_state() - . = ..() - inhand_icon_state = "[base_icon_state][cover_open ? "open" : "closed"][magazine ? "mag":"nomag"]" - -/obj/item/gun/ballistic/automatic/l6_saw/update_overlays() - . = ..() - . += "l6_door_[cover_open ? "open" : "closed"]" - - -/obj/item/gun/ballistic/automatic/l6_saw/afterattack(atom/target as mob|obj|turf, mob/living/user as mob|obj, flag, params) - if(cover_open) - balloon_alert(user, "cover open!") - return - else - . = ..() - update_appearance() - -// ATTACK HAND IGNORING PARENT RETURN VALUE -/obj/item/gun/ballistic/automatic/l6_saw/attack_hand(mob/user, list/modifiers) - if (loc != user) - ..() - return - if (!cover_open) - balloon_alert(user, "cover closed!") - return - ..() - -/obj/item/gun/ballistic/automatic/l6_saw/attackby(obj/item/attacking_item, mob/user, params) - if(!cover_open && istype(attacking_item, mag_type)) - balloon_alert(user, "dust closed!") - return - ..() - -// SNIPER // - -/obj/item/gun/ballistic/automatic/sniper_rifle - name = "sniper rifle" - desc = "A long ranged weapon that does significant damage. No, you can't quickscope." - icon_state = "sniper" - w_class = WEIGHT_CLASS_BULKY - inhand_icon_state = "sniper" - worn_icon_state = null - fire_sound = 'sound/weapons/gun/sniper/shot.ogg' - fire_sound_volume = 90 - vary_fire_sound = FALSE - load_sound = 'sound/weapons/gun/sniper/mag_insert.ogg' - rack_sound = 'sound/weapons/gun/sniper/rack.ogg' - suppressed_sound = 'sound/weapons/gun/general/heavy_shot_suppressed.ogg' - recoil = 2 - weapon_weight = WEAPON_HEAVY - mag_type = /obj/item/ammo_box/magazine/sniper_rounds - fire_delay = 40 - burst_size = 1 - w_class = WEIGHT_CLASS_NORMAL - slot_flags = ITEM_SLOT_BACK - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) - mag_display = TRUE - suppressor_x_offset = 3 - suppressor_y_offset = 3 - -/obj/item/gun/ballistic/automatic/sniper_rifle/Initialize(mapload) - . = ..() - AddComponent(/datum/component/scope, range_modifier = 2) - -/obj/item/gun/ballistic/automatic/sniper_rifle/syndicate - name = "syndicate sniper rifle" - desc = "An illegally modified .50 cal sniper rifle with suppression compatibility. Quickscoping still doesn't work." - can_suppress = TRUE - can_unsuppress = TRUE - pin = /obj/item/firing_pin/implant/pindicate - company_flag = COMPANY_SCARBOROUGH - -// Old Semi-Auto Rifle // - -/obj/item/gun/ballistic/automatic/surplus - name = "surplus rifle" - desc = "One of countless obsolete ballistic rifles that still sees use as a cheap deterrent. Uses 10mm ammo and its bulky frame prevents one-hand firing." - icon_state = "surplus" - inhand_icon_state = "moistnugget" - worn_icon_state = null - weapon_weight = WEAPON_HEAVY - mag_type = /obj/item/ammo_box/magazine/m10mm/rifle - fire_delay = 30 - burst_size = 1 - can_unsuppress = TRUE - can_suppress = TRUE - w_class = WEIGHT_CLASS_HUGE - slot_flags = ITEM_SLOT_BACK - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) - mag_display = TRUE - company_flag = COMPANY_IZHEVSK - -// Laser rifle (rechargeable magazine) // - -/obj/item/gun/ballistic/automatic/laser - name = "laser rifle" - desc = "Though sometimes mocked for the relatively weak firepower of their energy weapons, the logistic miracle of rechargeable ammunition has given Nanotrasen a decisive edge over many a foe." - icon_state = "oldrifle" - w_class = WEIGHT_CLASS_BULKY - inhand_icon_state = "arg" - mag_type = /obj/item/ammo_box/magazine/recharge - empty_indicator = TRUE - fire_delay = 2 - can_suppress = FALSE - burst_size = 0 - // actions_types = list() SKYRAT EDIT REMOVAL - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) - fire_sound = 'sound/weapons/laser.ogg' - casing_ejector = FALSE - company_flag = COMPANY_NANOTRASEN diff --git a/modular_skyrat/master_files/code/modules/projectiles/guns/gun.dm b/modular_skyrat/master_files/code/modules/projectiles/guns/gun.dm deleted file mode 100644 index c7787f8c33f..00000000000 --- a/modular_skyrat/master_files/code/modules/projectiles/guns/gun.dm +++ /dev/null @@ -1,738 +0,0 @@ - -#define DUALWIELD_PENALTY_EXTRA_MULTIPLIER 1.4 -#define FIRING_PIN_REMOVAL_DELAY 50 - -/obj/item/gun - name = "gun" - desc = "It's a gun. It's pretty terrible, though." - icon = 'icons/obj/weapons/guns/ballistic.dmi' - icon_state = "revolver" - inhand_icon_state = "gun" - worn_icon_state = "gun" - flags_1 = CONDUCT_1 - slot_flags = ITEM_SLOT_BELT - custom_materials = list(/datum/material/iron = 2000) - w_class = WEIGHT_CLASS_NORMAL - throwforce = 5 - throw_speed = 3 - throw_range = 5 - force = 5 - item_flags = NEEDS_PERMIT - attack_verb_continuous = list("strikes", "hits", "bashes") - attack_verb_simple = list("strike", "hit", "bash") - - var/gun_flags = NONE - var/fire_sound = 'sound/weapons/gun/pistol/shot.ogg' - var/vary_fire_sound = TRUE - var/fire_sound_volume = 50 - var/dry_fire_sound = 'sound/weapons/gun/general/dry_fire.ogg' - var/suppressed = null // whether or not a message is displayed when fired - var/can_suppress = FALSE - var/suppressed_sound = 'sound/weapons/gun/general/heavy_shot_suppressed.ogg' - var/suppressed_volume = 60 - var/can_unsuppress = TRUE - var/recoil = 0 // boom boom shake the room - var/clumsy_check = TRUE - var/obj/item/ammo_casing/chambered = null - trigger_guard = TRIGGER_GUARD_NORMAL // trigger guard on the weapon, hulks can't fire them with their big meaty fingers - var/sawn_desc = null // description change if weapon is sawn-off - var/sawn_off = FALSE - var/burst_size = 1 // how large a burst is - var/fire_delay = 0 // rate of fire for burst firing and semi auto - var/firing_burst = 0 // Prevent the weapon from firing again while already firing - var/semicd = 0 // cooldown handler - var/weapon_weight = WEAPON_LIGHT - var/dual_wield_spread = 24 // additional spread when dual wielding - ///Can we hold up our target with this? Default to yes - var/can_hold_up = TRUE - - /// Just 'slightly' snowflakey way to modify projectile damage for projectiles fired from this gun. - var/projectile_damage_multiplier = 1 - - var/spread = 0 // Spread induced by the gun itself. - var/randomspread = 1 // Set to 0 for shotguns. This is used for weapons that don't fire all their bullets at once. - - lefthand_file = 'icons/mob/inhands/weapons/guns_lefthand.dmi' - righthand_file = 'icons/mob/inhands/weapons/guns_righthand.dmi' - - var/obj/item/firing_pin/pin = /obj/item/firing_pin // standard firing pin for most guns - - var/pinless = FALSE - - var/can_bayonet = FALSE // if a bayonet can be added or removed if it already has one. - var/bayonet_state = "bayonet" - var/bayonet_icon = 'icons/obj/weapons/guns/bayonets.dmi' - var/obj/item/knife/bayonet - var/knife_x_offset = 0 - var/knife_y_offset = 0 - - var/ammo_x_offset = 0 // used for positioning ammo count overlay on sprite - var/ammo_y_offset = 0 - - // Zooming - var/pb_knockback = 0 - - var/safety = FALSE /// Internal variable for keeping track whether the safety is on or off - var/has_gun_safety = FALSE /// Whether the gun actually has a gun safety - var/datum/action/item_action/toggle_safety/toggle_safety_action - - var/datum/action/item_action/toggle_firemode/firemode_action - /// Current fire selection, can choose between burst, single, and full auto. - var/fire_select = SELECT_SEMI_AUTOMATIC - var/fire_select_index = 1 - /// What modes does this weapon have? Put SELECT_FULLY_AUTOMATIC in here to enable fully automatic behaviours. - var/list/fire_select_modes = list(SELECT_SEMI_AUTOMATIC) - /// if i`1t has an icon for a selector switch indicating current firemode. - var/selector_switch_icon = FALSE - /// Bitflags for the company that produces the gun, do not give more than one company. - var/company_flag - -/datum/action/item_action/toggle_safety - name = "Toggle Safety" - button_icon = 'modular_skyrat/modules/gunsafety/icons/actions.dmi' - button_icon_state = "safety_on" - -/obj/item/gun/ui_action_click(mob/user, actiontype) - if(istype(actiontype, /datum/action/item_action/toggle_firemode)) - fire_select() - else if(istype(actiontype, toggle_safety_action)) - toggle_safety(user) - else - ..() - -/obj/item/gun/Initialize(mapload) - . = ..() - if(pin && !pinless) - pin = new pin(src) - - add_seclight_point() - - if(has_gun_safety) - safety = TRUE - toggle_safety_action = new(src) - add_item_action(toggle_safety_action) - - if(burst_size > 1 && !(SELECT_BURST_SHOT in fire_select_modes)) - fire_select_modes.Add(SELECT_BURST_SHOT) - else if(burst_size <= 1 && (SELECT_BURST_SHOT in fire_select_modes)) - fire_select_modes.Remove(SELECT_BURST_SHOT) - - burst_size = 1 - - sort_list(fire_select_modes, GLOBAL_PROC_REF(cmp_numeric_asc)) - - if(fire_select_modes.len > 1) - firemode_action = new(src) - firemode_action.button_icon_state = "fireselect_[fire_select]" - firemode_action.build_all_button_icons() - add_item_action(firemode_action) - - if(SELECT_FULLY_AUTOMATIC in fire_select_modes) - AddComponent(/datum/component/automatic_fire, fire_delay) - -/obj/item/gun/Destroy() - if(isobj(pin)) // Can still be the initial path, then we skip - QDEL_NULL(pin) - if(bayonet) - QDEL_NULL(bayonet) - if(chambered) // Not all guns are chambered (EMP'ed energy guns etc) - QDEL_NULL(chambered) - if(isatom(suppressed)) - QDEL_NULL(suppressed) - if(toggle_safety_action) - QDEL_NULL(toggle_safety_action) - if(firemode_action) - QDEL_NULL(firemode_action) - . = ..() - -/// Handles adding [the seclite mount component][/datum/component/seclite_attachable] to the gun. -/// If the gun shouldn't have a seclight mount, override this with a return. -/// Or, if a child of a gun with a seclite mount has slightly different behavior or icons, extend this. -/obj/item/gun/proc/add_seclight_point() - return - -/obj/item/gun/handle_atom_del(atom/gun_atom) - if(gun_atom == pin) - pin = null - if(gun_atom == chambered) - chambered = null - update_appearance() - if(gun_atom == bayonet) - clear_bayonet() - if(gun_atom == suppressed) - clear_suppressor() - . = ..() - -/// Clears var and updates icon. In the case of ballistic weapons, also updates the gun's weight. -/obj/item/gun/proc/clear_suppressor() - if(!can_unsuppress) - return - suppressed = null - update_appearance() - -/obj/item/gun/examine(mob/user) - . = ..() - if(!pinless) - if(pin) - . += "It has \a [pin] installed." - . += span_info("[pin] looks like it could be removed with some tools.") - else - . += "It doesn't have a firing pin installed, and won't fire." - - if(bayonet) - . += "It has \a [bayonet] [can_bayonet ? "" : "permanently "]affixed to it." - if(can_bayonet) // if it has a bayonet and this is false, the bayonet is permanent. - . += span_info("[bayonet] looks like it can be unscrewed from [src].") - if(can_bayonet) - . += "It has a bayonet lug on it." - if(has_gun_safety) - . += "The safety is [safety ? "ON" : "OFF"]." - - switch(company_flag) - if(COMPANY_CANTALAN) - . += "
It has [span_purple("Cantalan Federal Arms")] etched into the grip." - if(COMPANY_ARMADYNE) - . += "
It has [span_red("Armadyne Corporation")] etched into the barrel." - if(COMPANY_SCARBOROUGH) - . += "
It has [span_orange("Scarborough Arms")] stamped onto the grip." - if(COMPANY_DONK) - . += "
It has a [span_green("Donk Corporation")] label visible in the plastic." - if(COMPANY_BOLT) - . += "
It has [span_yellow("Bolt Fabrications")] stamped onto the reciever." - if(COMPANY_OLDARMS) - . += "
It has [span_red("Armadyne Oldarms")] etched into the barrel." - if(COMPANY_IZHEVSK) - . += "
It has [span_brown("Izhevsk Coalition")] cut in above the magwell." - if(COMPANY_NANOTRASEN) - . += "
It has [span_blue("Nanotrasen Armories")] etched into the reciever." - if(COMPANY_ALLSTAR) - . += "
It has [span_red("Allstar Lasers Inc.")] stamped on the front grip." - if(COMPANY_MICRON) - . += "
It has [span_cyan("Micron Control Sys.")] cut in above the cell slot." - if(COMPANY_INTERDYNE) - . += "
It has [span_cyan("Interdyne Pharmaceuticals")] stamped onto the barrel." - if(COMPANY_ABDUCTOR) - . += "
It has [span_abductor("✌︎︎♌︎︎♎︎︎◆︎︎♍︎︎⧫︎︎❄︎♏︎♍︎♒︎")] engraved into the photon accelerator." - if(COMPANY_REMOVED) - . += "
It has had [span_grey("all identifying marks scrubbed off")]." - -/obj/item/gun/proc/fire_select() - var/mob/living/carbon/human/user = usr - - var/max_mode = fire_select_modes.len - - if(max_mode <= 1) - balloon_alert(user, "only one firemode!") - return - - fire_select_index = 1 + fire_select_index % max_mode // Magic math to cycle through this shit! - - fire_select = fire_select_modes[fire_select_index] - - switch(fire_select) - if(SELECT_SEMI_AUTOMATIC) - burst_size = 1 - fire_delay = 0 - SEND_SIGNAL(src, COMSIG_GUN_AUTOFIRE_DESELECTED, user) - balloon_alert(user, "semi-automatic") - if(SELECT_BURST_SHOT) - burst_size = initial(burst_size) - fire_delay = initial(fire_delay) - SEND_SIGNAL(src, COMSIG_GUN_AUTOFIRE_DESELECTED, user) - balloon_alert(user, "[burst_size]-round burst") - if(SELECT_FULLY_AUTOMATIC) - burst_size = 1 - SEND_SIGNAL(src, COMSIG_GUN_AUTOFIRE_SELECTED, user) - balloon_alert(user, "automatic") - - playsound(user, 'sound/weapons/empty.ogg', 100, TRUE) - update_appearance() - firemode_action.button_icon_state = "fireselect_[fire_select]" - firemode_action.build_all_button_icons() - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) - return TRUE - -// called after the gun has successfully fired its chambered ammo. -/obj/item/gun/proc/process_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE) - handle_chamber(empty_chamber, from_firing, chamber_next_round) - SEND_SIGNAL(src, COMSIG_GUN_CHAMBER_PROCESSED) - -/obj/item/gun/proc/handle_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE) - return - - -// check if there's enough ammo/energy/whatever to shoot one time -// i.e if clicking would make it shoot -/obj/item/gun/proc/can_shoot() - return TRUE - -/obj/item/gun/proc/tk_firing(mob/living/user) - return !user.contains(src) - -/obj/item/gun/proc/shoot_with_empty_chamber(mob/living/user as mob|obj) - balloon_alert_to_viewers("*click*") - playsound(src, dry_fire_sound, 30, TRUE) - -/obj/item/gun/proc/fire_sounds() - if(suppressed) - playsound(src, suppressed_sound, suppressed_volume, vary_fire_sound, ignore_walls = FALSE, extrarange = SILENCED_SOUND_EXTRARANGE, falloff_distance = 0) - else - playsound(src, fire_sound, fire_sound_volume, vary_fire_sound) - -/obj/item/gun/proc/shoot_live_shot(mob/living/user, pointblank = 0, atom/pbtarget = null, message = 1) - if(recoil && !tk_firing(user)) - shake_camera(user, recoil + 1, recoil) - fire_sounds() - if(!suppressed) - if(message) - if(tk_firing(user)) - visible_message( - span_danger("[src] fires itself[pointblank ? " point blank at [pbtarget]!" : "!"]"), - blind_message = span_hear("You hear a gunshot!"), - vision_distance = COMBAT_MESSAGE_RANGE - ) - else if(pointblank) - user.visible_message( - span_danger("[user] fires [src] point blank at [pbtarget]!"), - span_danger("You fire [src] point blank at [pbtarget]!"), - span_hear("You hear a gunshot!"), COMBAT_MESSAGE_RANGE, pbtarget - ) - to_chat(pbtarget, span_userdanger("[user] fires [src] point blank at you!")) - if(pb_knockback > 0 && ismob(pbtarget)) - var/mob/PBT = pbtarget - var/atom/throw_target = get_edge_target_turf(PBT, user.dir) - PBT.throw_at(throw_target, pb_knockback, 2) - else if(!tk_firing(user)) - user.visible_message( - span_danger("[user] fires [src]!"), - blind_message = span_hear("You hear a gunshot!"), - vision_distance = COMBAT_MESSAGE_RANGE, - ignored_mobs = user - ) - if(user.resting) // SKYRAT EDIT ADD - no crawlshooting - user.Immobilize(20, TRUE) // SKYRAT EDIT END - -/obj/item/gun/emp_act(severity) - . = ..() - if(!(. & EMP_PROTECT_CONTENTS)) - for(var/obj/iterated_object in contents) - iterated_object.emp_act(severity) - -/obj/item/gun/afterattack_secondary(mob/living/victim, mob/living/user, params) - if(!isliving(victim) || !IN_GIVEN_RANGE(user, victim, GUNPOINT_SHOOTER_STRAY_RANGE)) - return ..() //if they're out of range, just shootem. - if(!can_hold_up) - return ..() - var/datum/component/gunpoint/gunpoint_component = user.GetComponent(/datum/component/gunpoint) - if (gunpoint_component) - if(gunpoint_component.target == victim) - return ..() //we're already holding them up, shoot that mans instead of complaining - balloon_alert(user, "already holding someone up!") - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - if(user == victim) - balloon_alert(user, "can't hold yourself up!") - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - - user.AddComponent(/datum/component/gunpoint, victim, src) - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - -/obj/item/gun/afterattack(atom/target, mob/living/user, flag, params) - . = ..() - return fire_gun(target, user, flag, params) - -/obj/item/gun/proc/fire_gun(atom/target, mob/living/user, flag, params) - if(QDELETED(target)) - return - if(firing_burst) - return - if(SEND_SIGNAL(src, COMSIG_GUN_TRY_FIRE, user, target, flag, params) & COMPONENT_CANCEL_GUN_FIRE) - return - if(flag) // It's adjacent, is the user, or is on the user's person - if(target in user.contents) // can't shoot stuff inside us. - return - if(!ismob(target) || user.combat_mode) // melee attack - return - if(target == user && user.zone_selected != BODY_ZONE_PRECISE_MOUTH) // so we can't shoot ourselves (unless mouth selected) - return - if(iscarbon(target)) - var/mob/living/carbon/carbon_target = target - for(var/i in carbon_target.all_wounds) - var/datum/wound/target_wound = i - if(target_wound.try_treating(src, user)) - return // another coward cured! - - if(istype(user))// Check if the user can use the gun, if the user isn't alive(turrets) assume it can. - var/mob/living/living_user = user - if(!can_trigger_gun(living_user)) - return - if(flag) - if(user.zone_selected == BODY_ZONE_PRECISE_MOUTH) - handle_suicide(user, target, params) - return - - if(!can_shoot()) // Just because you can pull the trigger doesn't mean it can shoot. - shoot_with_empty_chamber(user) - return - - if(check_botched(user)) - return - - var/obj/item/bodypart/other_hand = user.has_hand_for_held_index(user.get_inactive_hand_index()) // returns non-disabled inactive hands - if(weapon_weight == WEAPON_HEAVY && (user.get_inactive_held_item() || !other_hand)) - balloon_alert(user, "need two hands!") - return - // DUAL (or more!) WIELDING - var/bonus_spread = 0 - var/loop_counter = 0 - if(ishuman(user) && user.combat_mode) - var/mob/living/carbon/human/human_user = user - for(var/obj/item/gun/held_gun in human_user.held_items) - if(held_gun == src || held_gun.weapon_weight >= WEAPON_MEDIUM) - continue - else if(held_gun.can_trigger_gun(user)) - bonus_spread += dual_wield_spread - loop_counter++ - addtimer(CALLBACK(held_gun, TYPE_PROC_REF(/obj/item/gun, process_fire), target, user, TRUE, params, null, bonus_spread), loop_counter) - - return process_fire(target, user, TRUE, params, null, bonus_spread) - -/obj/item/gun/proc/check_botched(mob/living/user, params) - if(clumsy_check) - if(istype(user)) - if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(40)) - to_chat(user, span_userdanger("You shoot yourself in the foot with [src]!")) - var/shot_leg = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) - process_fire(user, user, FALSE, params, shot_leg) - SEND_SIGNAL(user, COMSIG_MOB_CLUMSY_SHOOT_FOOT) - if(!tk_firing(user) && !HAS_TRAIT(src, TRAIT_NODROP)) - user.dropItemToGround(src, TRUE) - return TRUE - -/obj/item/gun/can_trigger_gun(mob/living/user) - . = ..() - if(!handle_pins(user)) - return FALSE - if(has_gun_safety && safety) - balloon_alert(user, "safety on!") - return FALSE - -/obj/item/gun/proc/toggle_safety(mob/user, override) - if(!has_gun_safety) - return - if(override) - if(override == "off") - safety = FALSE - else - safety = TRUE - else - safety = !safety - toggle_safety_action.button_icon_state = "safety_[safety ? "on" : "off"]" - toggle_safety_action.build_all_button_icons() - playsound(src, 'sound/weapons/empty.ogg', 100, TRUE) - user.visible_message( - span_notice("[user] toggles [src]'s safety [safety ? "ON" : "OFF"]."), - span_notice("You toggle [src]'s safety [safety ? "ON" : "OFF"].") - ) - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) - -/obj/item/gun/proc/handle_pins(mob/living/user) - if(pinless) - return TRUE - if(pin) - if(pin.pin_auth(user) || (pin.obj_flags & EMAGGED)) - return TRUE - else - pin.auth_fail(user) - return FALSE - else - balloon_alert(user, "no firing pin!") - return FALSE - -/obj/item/gun/proc/recharge_newshot() - return - -/obj/item/gun/proc/process_burst(mob/living/user, atom/target, message = TRUE, params = null, zone_override = "", sprd = 0, randomized_gun_spread = 0, randomized_bonus_spread = 0, rand_spr = 0, iteration = 0) - if(!user || !firing_burst) - firing_burst = FALSE - return FALSE - if(!issilicon(user)) - if(iteration > 1 && !(user.is_holding(src))) // for burst firing - firing_burst = FALSE - return FALSE - if(chambered?.loaded_projectile) - if(HAS_TRAIT(user, TRAIT_PACIFISM)) // If the user has the pacifist trait, then they won't be able to fire [src] if the round chambered inside of [src] is lethal. - if(chambered.harmful) // Is the bullet chambered harmful? - balloon_alert(user, "lethally chambered!") - return - if(randomspread) - sprd = round((rand(0, 1) - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread)) - else // Smart spread - sprd = round((((rand_spr/burst_size) * iteration) - (0.5 + (rand_spr * 0.25))) * (randomized_gun_spread + randomized_bonus_spread)) - before_firing(target, user) - if(!chambered.fire_casing(target, user, params, , suppressed, zone_override, sprd, src)) - shoot_with_empty_chamber(user) - firing_burst = FALSE - return FALSE - else - if(get_dist(user, target) <= 1) // Making sure whether the target is in vicinity for the pointblank shot - shoot_live_shot(user, 1, target, message) - else - shoot_live_shot(user, 0, target, message) - if (iteration >= burst_size) - firing_burst = FALSE - else - shoot_with_empty_chamber(user) - firing_burst = FALSE - return FALSE - process_chamber() - update_appearance() - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) - return TRUE - -/obj/item/gun/proc/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0) - if(user) - SEND_SIGNAL(user, COMSIG_MOB_FIRED_GUN, user, target, params, zone_override) - - SEND_SIGNAL(src, COMSIG_GUN_FIRED, user, target, params, zone_override) - - add_fingerprint(user) - - if(semicd) - return - - // Vary by at least this much - var/base_bonus_spread = 0 - var/sprd = 0 - var/randomized_gun_spread = 0 - var/rand_spr = rand() - if(user && HAS_TRAIT(user, TRAIT_POOR_AIM)) // Nice job hotshot - bonus_spread += 35 - base_bonus_spread += 10 - - if(spread) - randomized_gun_spread = rand(0, spread) - var/randomized_bonus_spread = rand(base_bonus_spread, bonus_spread) - - if(burst_size > 1) - firing_burst = TRUE - for(var/i = 1 to burst_size) - addtimer(CALLBACK(src, PROC_REF(process_burst), user, target, message, params, zone_override, sprd, randomized_gun_spread, randomized_bonus_spread, rand_spr, i), fire_delay * (i - 1)) - else - if(chambered) - if(HAS_TRAIT(user, TRAIT_PACIFISM)) // If the user has the pacifist trait, then they won't be able to fire [src] if the round chambered inside of [src] is lethal. - if(chambered.harmful) // Is the bullet chambered harmful? - balloon_alert(user, "lethally chambered!") - return - sprd = round((rand(0, 1) - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread)) - before_firing(target, user) - if(!chambered.fire_casing(target, user, params, , suppressed, zone_override, sprd, src)) - shoot_with_empty_chamber(user) - return - else - if(get_dist(user, target) <= 1) // Making sure whether the target is in vicinity for the pointblank shot - shoot_live_shot(user, 1, target, message) - else - shoot_live_shot(user, 0, target, message) - else - shoot_with_empty_chamber(user) - return - process_chamber() - update_appearance() - semicd = TRUE - addtimer(CALLBACK(src, PROC_REF(reset_semicd)), fire_delay) - - if(user) - user.update_held_items() - SSblackbox.record_feedback("tally", "gun_fired", 1, type) - - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) - - return TRUE - -/obj/item/gun/proc/reset_semicd() - semicd = FALSE - -/obj/item/gun/attack(mob/target, mob/living/user) - if(user.combat_mode) // Flogging - if(bayonet) - target.attackby(bayonet, user) - return - else - return ..() - return - -/obj/item/gun/attack_atom(obj/target, mob/living/user, params) - if(user.combat_mode) - if(bayonet) - target.attackby(bayonet, user) - return - return ..() - -/obj/item/gun/attackby(obj/item/attacking_item, mob/living/user, params) - if(user.combat_mode) - return ..() - else if(istype(attacking_item, /obj/item/knife)) - var/obj/item/knife/attaching_knife = attacking_item - if(!can_bayonet || !attaching_knife.bayonet || bayonet) // ensure the gun has an attachment point available, and that the knife is compatible with it. - return ..() - if(!user.transferItemToLoc(attacking_item, src)) - return - balloon_alert(user, "[attaching_knife] attached") - bayonet = attaching_knife - update_appearance() - - else - return ..() - -/obj/item/gun/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() - if(.) - return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) - return - if(bayonet && can_bayonet) //if it has a bayonet, and the bayonet can be removed - return remove_bayonet(user, tool) - - else if(pin && user.is_holding(src)) - if(!pin.can_remove) - balloon_alert(user, "pin can't be removed!") - return - user.visible_message(span_warning("[user] attempts to remove [pin] from [src] with [tool]."), - span_notice("You attempt to remove [pin] from [src]. (It will take [DisplayTimeText(FIRING_PIN_REMOVAL_DELAY)].)"), null, 3) - if(tool.use_tool(src, user, FIRING_PIN_REMOVAL_DELAY, volume = 50)) - if(!pin) // check to see if the pin is still there, or we can spam messages by clicking multiple times during the tool delay - return - user.visible_message(span_notice("[pin] is pried out of [src] by [user], destroying the pin in the process."), - span_warning("You pry [pin] out with [tool], destroying the pin in the process."), null, 3) - QDEL_NULL(pin) - return TRUE - -/obj/item/gun/welder_act(mob/living/user, obj/item/tool) - . = ..() - if(.) - return - if(!pin.can_remove) - balloon_alert(user, "pin can't be removed!") - return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) - return - if(pin && user.is_holding(src)) - user.visible_message(span_warning("[user] attempts to remove [pin] from [src] with [tool]."), - span_notice("You attempt to remove [pin] from [src]. (It will take [DisplayTimeText(FIRING_PIN_REMOVAL_DELAY)].)"), null, 3) - if(tool.use_tool(src, user, FIRING_PIN_REMOVAL_DELAY, 5, volume = 50)) - if(!pin) // check to see if the pin is still there, or we can spam messages by clicking multiple times during the tool delay - return - user.visible_message(span_notice("[pin] is spliced out of [src] by [user], melting part of the pin in the process."), - span_warning("You splice [pin] out of [src] with [tool], melting part of the pin in the process."), null, 3) - QDEL_NULL(pin) - return TRUE - -/obj/item/gun/wirecutter_act(mob/living/user, obj/item/tool) - . = ..() - if(.) - return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) - return - if(!pin.can_remove) - balloon_alert(user, "pin can't be removed!") - return - if(pin && user.is_holding(src)) - user.visible_message(span_warning("[user] attempts to remove [pin] from [src] with [tool]."), - span_notice("You attempt to remove [pin] from [src]. (It will take [DisplayTimeText(FIRING_PIN_REMOVAL_DELAY)].)"), null, 3) - if(tool.use_tool(src, user, FIRING_PIN_REMOVAL_DELAY, volume = 50)) - if(!pin) // check to see if the pin is still there, or we can spam messages by clicking multiple times during the tool delay - return - user.visible_message(span_notice("[pin] is ripped out of [src] by [user], mangling the pin in the process."), - span_warning("You rip [pin] out of [src] with [tool], mangling the pin in the process."), null, 3) - QDEL_NULL(pin) - return TRUE - -/obj/item/gun/proc/remove_bayonet(mob/living/user, obj/item/tool_item) - tool_item?.play_tool_sound(src) - balloon_alert(user, "[bayonet] removed") - bayonet.forceMove(drop_location()) - - if(Adjacent(user) && !issilicon(user)) - user.put_in_hands(bayonet) - - return clear_bayonet() - -/obj/item/gun/proc/clear_bayonet() - if(!bayonet) - return - bayonet = null - update_appearance() - return TRUE - -/obj/item/gun/update_overlays() - . = ..() - - if(bayonet) - var/mutable_appearance/knife_overlay - var/state = bayonet_state - if(bayonet.icon_state in icon_states(bayonet_icon)) // Snowflake state? - state = bayonet.icon_state - knife_overlay = mutable_appearance(bayonet_icon, state) - knife_overlay.pixel_x = knife_x_offset - knife_overlay.pixel_y = knife_y_offset - . += knife_overlay - -/obj/item/gun/proc/handle_suicide(mob/living/carbon/human/user, mob/living/carbon/human/target, params, bypass_timer) - if(!ishuman(user) || !ishuman(target)) - return - - if(semicd) - return - - if(user == target) - target.visible_message(span_warning("[user] sticks [src] in [user.p_their()] mouth, ready to pull the trigger..."), \ - span_userdanger("You stick [src] in your mouth, ready to pull the trigger...")) - else - target.visible_message(span_warning("[user] points [src] at [target]'s head, ready to pull the trigger..."), \ - span_userdanger("[user] points [src] at your head, ready to pull the trigger...")) - - semicd = TRUE - - if(!bypass_timer && (!do_after(user, 12 SECONDS, target) || user.zone_selected != BODY_ZONE_PRECISE_MOUTH)) - if(user) - if(user == target) - user.visible_message(span_notice("[user] decided not to shoot.")) - else if(target?.Adjacent(user)) - target.visible_message(span_notice("[user] has decided to spare [target]"), span_notice("[user] has decided to spare your life!")) - semicd = FALSE - return - - semicd = FALSE - - target.visible_message(span_warning("[user] pulls the trigger!"), span_userdanger("[(user == target) ? "You pull" : "[user] pulls"] the trigger!")) - - if(chambered?.loaded_projectile) - chambered.loaded_projectile.damage *= 5 - if(chambered.loaded_projectile.wound_bonus != CANT_WOUND) - chambered.loaded_projectile.wound_bonus += 5 // much more dramatic on multiple pellet'd projectiles really - - var/fired = process_fire(target, user, TRUE, params, BODY_ZONE_HEAD) - if(!fired && chambered?.loaded_projectile) - chambered.loaded_projectile.damage /= 5 - if(chambered.loaded_projectile.wound_bonus != CANT_WOUND) - chambered.loaded_projectile.wound_bonus -= 5 - -/obj/item/gun/proc/unlock() // used in summon guns and as a convience for admins - if(pin) - qdel(pin) - pin = new /obj/item/firing_pin - -// Happens before the actual projectile creation -/obj/item/gun/proc/before_firing(atom/target, mob/user) - return - -/obj/item/gun/emag_act(mob/user, obj/item/card/emag/emag_card) - . = ..() - if(!pin.can_remove) - balloon_alert(user, "firing pin shorted!") - pin.can_remove = TRUE - if(!(pin.obj_flags & EMAGGED)) - pin.obj_flags |= EMAGGED - -#undef FIRING_PIN_REMOVAL_DELAY -#undef DUALWIELD_PENALTY_EXTRA_MULTIPLIER diff --git a/modular_skyrat/modules/aesthetics/guns/code/guns.dm b/modular_skyrat/modules/aesthetics/guns/code/guns.dm index 63e651ed1ff..60e2bf23903 100644 --- a/modular_skyrat/modules/aesthetics/guns/code/guns.dm +++ b/modular_skyrat/modules/aesthetics/guns/code/guns.dm @@ -71,7 +71,9 @@ inhand_icon_state = "riot_shotgun_syndie" can_be_sawn_off = FALSE can_suppress = FALSE - company_flag = COMPANY_SCARBOROUGH + +/obj/item/gun/ballistic/shotgun/riot/syndicate/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) /obj/item/gun/ballistic/shotgun/automatic/combat name = "\improper Peacekeeper combat shotgun" @@ -227,7 +229,9 @@ can_suppress = TRUE can_unsuppress = TRUE weapon_weight = WEAPON_LIGHT - company_flag = COMPANY_SCARBOROUGH + +/obj/item/gun/ballistic/automatic/sniper_rifle/modular/syndicate/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) /obj/item/gun/ballistic/automatic/sniper_rifle/modular/blackmarket //Normal sniper but epic name = "SA-107 anti-materiel rifle" @@ -248,7 +252,6 @@ fire_delay = 55 //Slightly smaller than standard sniper burst_size = 1 slot_flags = ITEM_SLOT_BACK - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) //SKYRAT EDIT CHANGE mag_display = TRUE /obj/item/gun/ballistic/automatic/ar/modular @@ -276,7 +279,9 @@

\ BRAND NEW: Cannot be sawn off." icon = 'modular_skyrat/modules/aesthetics/guns/icons/guns.dmi' - company_flag = COMPANY_NANOTRASEN + +/obj/item/gun/ballistic/rifle/boltaction/brand_new/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) /obj/item/gun/ballistic/rifle/boltaction/brand_new/quartermaster name = "\improper FTU 'Archangel' precision rifle" @@ -289,7 +294,9 @@ worn_icon_state = "bubba" mag_type = /obj/item/ammo_box/magazine/internal/boltaction/bubba can_be_sawn_off = FALSE - company_flag = null //Cargonia's own + +/obj/item/gun/ballistic/rifle/boltaction/brand_new/quartermaster/give_manufacturer_examine() + return /obj/item/ammo_box/magazine/internal/boltaction/bubba name = "sportiv extended internal magazine" @@ -313,7 +320,9 @@ fire_delay = 5 fire_sound_volume = 90 mag_type = /obj/item/ammo_box/magazine/multi_sprite/ostwind/arg75 - company_flag = COMPANY_NANOTRASEN + +/obj/item/gun/ballistic/automatic/ar/modular/model75/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) /obj/item/ammo_box/magazine/multi_sprite/ostwind/arg75 name = "\improper ARG-75 magazine" diff --git a/modular_skyrat/modules/aesthetics/guns/icons/guns.dmi b/modular_skyrat/modules/aesthetics/guns/icons/guns.dmi index 013281c9e26..5accb648846 100644 Binary files a/modular_skyrat/modules/aesthetics/guns/icons/guns.dmi and b/modular_skyrat/modules/aesthetics/guns/icons/guns.dmi differ diff --git a/modular_skyrat/modules/assault_operatives/code/equipment_items/guns.dm b/modular_skyrat/modules/assault_operatives/code/equipment_items/guns.dm index 3cb5d2f8e90..1bda73090df 100644 --- a/modular_skyrat/modules/assault_operatives/code/equipment_items/guns.dm +++ b/modular_skyrat/modules/assault_operatives/code/equipment_items/guns.dm @@ -3,11 +3,15 @@ /obj/item/gun/ballistic/automatic/pistol/clandestine/assault_ops name = "\improper IGE-040 pistol" desc = "A pistol chambered in 10mm magnum and painted in an ominous matte black. Strangely, the gun also seems to lack any form of manufacturer markings." - company_flag = COMPANY_REMOVED + +/obj/item/gun/ballistic/automatic/pistol/clandestine/assault_ops/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_REMOVED) /obj/item/gun/energy/e_gun/advtaser/assault_ops w_class = WEIGHT_CLASS_NORMAL - company_flag = COMPANY_REMOVED + +/obj/item/gun/energy/e_gun/advtaser/assault_ops/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_REMOVED) // Rifle @@ -33,17 +37,18 @@ can_suppress = TRUE suppressor_x_offset = 4 suppressed_sound = 'sound/weapons/gun/general/heavy_shot_suppressed.ogg' - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_BURST_SHOT) burst_size = 2 fire_delay = 3 pin = /obj/item/firing_pin/implant/pindicate - company_flag = COMPANY_REMOVED /obj/item/gun/ballistic/automatic/assault_ops_rifle/Initialize(mapload) . = ..() AddComponent(/datum/component/scope, range_modifier = 1.5) +/obj/item/gun/ballistic/automatic/assault_ops_rifle/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_REMOVED) + /obj/item/ammo_box/magazine/multi_sprite/assault_ops_rifle name = "\improper IGE-110 magazine" desc = "A twenty round magazine built for 5.6x40mm, intended for use in the IGE-110 rifle." @@ -85,12 +90,18 @@ mag_type = /obj/item/ammo_box/magazine/multi_sprite/assault_ops_smg fire_sound = 'modular_skyrat/modules/sec_haul/sound/smg_fire.ogg' can_suppress = TRUE - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) burst_size = 1 fire_delay = 0.8 projectile_damage_multiplier = 0.6 pin = /obj/item/firing_pin/implant/pindicate - company_flag = COMPANY_REMOVED + +/obj/item/gun/ballistic/automatic/assault_ops_smg/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/assault_ops_smg/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_REMOVED) /obj/item/ammo_box/magazine/multi_sprite/assault_ops_smg name = "\improper IGE-260 magazine" @@ -135,11 +146,12 @@ can_suppress = TRUE suppressor_x_offset = 4 suppressed_sound = 'sound/weapons/gun/general/heavy_shot_suppressed.ogg' - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) burst_size = 1 fire_delay = 1.5 pin = /obj/item/firing_pin/implant/pindicate - company_flag = COMPANY_REMOVED + +/obj/item/gun/ballistic/automatic/assault_ops_shotgun/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_REMOVED) /obj/item/ammo_box/magazine/multi_sprite/assault_ops_shotgun name = "\improper IGE-340 magazine" @@ -203,13 +215,15 @@ can_be_sawn_off = FALSE can_jam = FALSE pin = /obj/item/firing_pin/implant/pindicate - company_flag = COMPANY_REMOVED /obj/item/gun/ballistic/rifle/boltaction/assault_ops_sniper/Initialize(mapload) . = ..() AddComponent(/datum/component/scope, range_modifier = 2.5) +/obj/item/gun/ballistic/rifle/boltaction/assault_ops_sniper/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_REMOVED) + /obj/item/ammo_box/magazine/multi_sprite/assault_ops_sniper name = "\improper IGE-410 magazine" desc = "A five round magazine built for .416 Stabilis, intended for use in the IGE-410 sniper." diff --git a/modular_skyrat/modules/black_mesa/code/guns.dm b/modular_skyrat/modules/black_mesa/code/guns.dm index d4ee8099139..331d7a69539 100644 --- a/modular_skyrat/modules/black_mesa/code/guns.dm +++ b/modular_skyrat/modules/black_mesa/code/guns.dm @@ -42,11 +42,9 @@ righthand_file ='modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_righthand.dmi' icon_state = "mp5" inhand_icon_state = "mp5" - selector_switch_icon = TRUE mag_type = /obj/item/ammo_box/magazine/mp5 bolt_type = BOLT_TYPE_LOCKING can_suppress = TRUE - burst_size = 3 fire_delay = 1.25 spread = 2.5 mag_display = TRUE @@ -65,6 +63,11 @@ w_class = WEIGHT_CLASS_NORMAL projectile_damage_multiplier = 0.7 +/obj/item/gun/ballistic/automatic/mp5/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + /obj/item/ammo_box/magazine/mp5 name = "MP5 magazine (10mm Auto)" desc = "Magazines taking 10mm ammunition; it fits in the MP5." diff --git a/modular_skyrat/modules/black_mesa/code/m16_variations.dm b/modular_skyrat/modules/black_mesa/code/m16_variations.dm index e7c0ed91cbd..c6880490811 100644 --- a/modular_skyrat/modules/black_mesa/code/m16_variations.dm +++ b/modular_skyrat/modules/black_mesa/code/m16_variations.dm @@ -21,8 +21,11 @@ load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/sfrifle_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/sfrifle_magout.ogg' alt_icons = TRUE - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) +/obj/item/gun/ballistic/automatic/m16/oldarms/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) /obj/item/ammo_box/magazine/m16/vintage/oldarms name = "old-fashioned mk-11.4 rifle magazine" diff --git a/modular_skyrat/modules/blueshield/code/blueshield.dm b/modular_skyrat/modules/blueshield/code/blueshield.dm index 89af99f28a0..c6174928395 100644 --- a/modular_skyrat/modules/blueshield/code/blueshield.dm +++ b/modular_skyrat/modules/blueshield/code/blueshield.dm @@ -106,4 +106,6 @@ icon_state = "hellfirepdw" worn_icon_state = "hellfirepdw" ammo_type = list(/obj/item/ammo_casing/energy/laser/hellfire/bs) - company_flag = COMPANY_ALLSTAR + +/obj/item/gun/energy/laser/hellgun/blueshield/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ALLSTAR) diff --git a/modular_skyrat/modules/cellguns/code/cellguns.dm b/modular_skyrat/modules/cellguns/code/cellguns.dm index cc3a9425832..eaeaee29cc2 100644 --- a/modular_skyrat/modules/cellguns/code/cellguns.dm +++ b/modular_skyrat/modules/cellguns/code/cellguns.dm @@ -10,7 +10,9 @@ var/list/installedcells = list() automatic_charge_overlays = FALSE //This is needed because Cell based guns use their own custom overlay system. - has_gun_safety = TRUE + +/obj/item/gun/energy/cell_loaded/give_gun_safeties() + return /obj/item/gun/energy/cell_loaded/examine(mob/user) . = ..() diff --git a/modular_skyrat/modules/company_imports/code/datums/cargo_pack.dm b/modular_skyrat/modules/company_imports/code/datums/cargo_pack.dm index 63e860a2ab4..040eaa2c4df 100644 --- a/modular_skyrat/modules/company_imports/code/datums/cargo_pack.dm +++ b/modular_skyrat/modules/company_imports/code/datums/cargo_pack.dm @@ -10,7 +10,8 @@ return var/obj/structure/container = . for(var/obj/item/gun/gun_actually in container.contents) - if(gun_actually.company_flag & COMPANY_SCARBOROUGH) //illegal company doesn't care about pins + var/datum/component/manufacturer_examine/gun_company_examine_component = gun_actually.GetComponent(/datum/component/manufacturer_examine) + if((gun_company_examine_component) && (gun_company_examine_component.company_flag & COMPANY_SCARBOROUGH)) continue QDEL_NULL(gun_actually.pin) var/obj/item/firing_pin/permit_pin/new_pin = new(gun_actually) diff --git a/modular_skyrat/modules/company_imports/code/gun_companies.dm b/modular_skyrat/modules/company_imports/code/gun_companies.dm deleted file mode 100644 index db459f69641..00000000000 --- a/modular_skyrat/modules/company_imports/code/gun_companies.dm +++ /dev/null @@ -1,132 +0,0 @@ -/obj/item/gun/ballistic/automatic/pistol/m1911 - company_flag = COMPANY_BOLT - -/obj/item/gun/ballistic/automatic/pistol/aps - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/ballistic/revolver - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/ballistic/revolver/nagant - company_flag = COMPANY_OLDARMS - -/obj/item/gun/ballistic/rifle/boltaction - company_flag = COMPANY_IZHEVSK - -/obj/item/gun/ballistic/shotgun/riot - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/ballistic/shotgun/bulldog - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/energy/e_gun - company_flag = COMPANY_ALLSTAR - -/obj/item/gun/energy/laser - company_flag = COMPANY_ALLSTAR - -/obj/item/gun/energy/pulse - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/ballistic/shotgun/automatic/combat - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/syringe - company_flag = COMPANY_INTERDYNE - -/obj/item/gun/ballistic/automatic/pistol - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/ballistic/revolver/c38/detective - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/ballistic/shotgun/doublebarrel - company_flag = COMPANY_IZHEVSK - -/obj/item/gun/ballistic/shotgun/automatic/dual_tube - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/ballistic/rifle/boltaction/brand_new - company_flag = COMPANY_IZHEVSK - -/obj/item/gun/ballistic/shotgun/toy - company_flag = COMPANY_DONK - -/obj/item/gun/ballistic/rifle/boltaction/brand_new/prime - company_flag = null - -/obj/item/gun/ballistic/rifle/boltaction/pipegun - company_flag = null - -/obj/item/gun/ballistic/automatic/c20r/toy - company_flag = COMPANY_DONK - -/obj/item/gun/ballistic/automatic/pistol/clandestine - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/ballistic/automatic/pistol/pdh/pulse - company_flag = null - -/obj/item/gun/ballistic/automatic/l6_saw/toy - company_flag = COMPANY_DONK - -/obj/item/gun/ballistic/automatic/cmg - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/ballistic/revolver/mateba - company_flag = null - -/obj/item/gun/ballistic/revolver/russian - company_flag = null - -/obj/item/gun/energy/laser/redtag - company_flag = null - -/obj/item/gun/energy/laser/bluetag - company_flag = null - -/obj/item/gun/energy/laser/instakill - company_flag = null - -/obj/item/gun/energy/laser/chameleon - company_flag = null - -/obj/item/gun/energy/laser/captain - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/energy/laser/retro - company_flag = COMPANY_REMOVED - -/obj/item/gun/energy/laser/retro/old - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/energy/e_gun/old - company_flag = COMPANY_NANOTRASEN - -/obj/item/gun/energy/e_gun/advtaser/cyborg - company_flag = null - -/obj/item/gun/energy/recharge/ebow - company_flag = COMPANY_SCARBOROUGH - -/obj/item/gun/energy/lasercannon - company_flag = COMPANY_ALLSTAR - -/obj/item/gun/energy/ionrifle - company_flag = COMPANY_ALLSTAR - -/obj/item/gun/energy/temperature - company_flag = COMPANY_ALLSTAR - -/obj/item/gun/syringe/blowgun - company_flag = null - -/obj/item/gun/syringe/syndicate/prototype - company_flag = null - -/obj/item/gun/energy/shrink_ray - company_flag = COMPANY_ABDUCTOR - -/obj/item/gun/energy/alien - company_flag = COMPANY_ABDUCTOR - diff --git a/modular_skyrat/modules/company_imports/code/objects/nri_surplus/ak25.dm b/modular_skyrat/modules/company_imports/code/objects/nri_surplus/ak25.dm index 66b6611b8fd..a5b6193de1e 100644 --- a/modular_skyrat/modules/company_imports/code/objects/nri_surplus/ak25.dm +++ b/modular_skyrat/modules/company_imports/code/objects/nri_surplus/ak25.dm @@ -21,10 +21,12 @@ load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_magout.ogg' alt_icons = TRUE - company_flag = COMPANY_IZHEVSK spread = 29 recoil = 0.1 +/obj/item/gun/ballistic/automatic/ak25/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) + /obj/item/ammo_box/magazine/ak25 name = "\improper AK-25 magazine" desc = "A banana-shaped double-stack magazine able to hold 30 rounds of 7.32x29mm ammunition." diff --git a/modular_skyrat/modules/gun_safety/code/safety_additions.dm b/modular_skyrat/modules/gun_safety/code/safety_additions.dm new file mode 100644 index 00000000000..013fc022ec2 --- /dev/null +++ b/modular_skyrat/modules/gun_safety/code/safety_additions.dm @@ -0,0 +1,48 @@ +/// Proc that is overridden in /gun/ballistic and /gun/energy to attach the gun safety component to a gun +/obj/item/gun/proc/give_gun_safeties() + return + +// Ballistic Weapons + +/obj/item/gun/ballistic/give_gun_safeties() + AddComponent(/datum/component/gun_safety) + +/obj/item/gun/ballistic/bow/give_gun_safeties() + return + +/obj/item/gun/ballistic/rifle/enchanted/give_gun_safeties() + return + +/obj/item/gun/ballistic/automatic/laser/ctf/give_gun_safeties() + return + +/obj/item/gun/ballistic/shotgun/ctf/give_gun_safeties() + return + +/obj/item/gun/ballistic/automatic/laser/ctf/marksman/give_gun_safeties() + return + +/obj/item/gun/ballistic/automatic/pistol/deagle/ctf/give_gun_safeties() + return + +/obj/item/gun/ballistic/automatic/pistol/g17/mesa/give_gun_safeties() + return + +/obj/item/gun/ballistic/revolver/grenadelauncher/give_gun_safeties() + return + +// Energy Weapons + +/obj/item/gun/energy/give_gun_safeties() + AddComponent(/datum/component/gun_safety) + +/obj/item/gun/energy/plasmacutter/give_gun_safeties() + return + +/obj/item/gun/energy/kinetic_accelerator/give_gun_safeties() + return + +// Syringe Guns + +/obj/item/gun/syringe/blowgun/give_gun_safeties() + return diff --git a/modular_skyrat/modules/gun_safety/code/safety_component.dm b/modular_skyrat/modules/gun_safety/code/safety_component.dm new file mode 100644 index 00000000000..3338b5347ae --- /dev/null +++ b/modular_skyrat/modules/gun_safety/code/safety_component.dm @@ -0,0 +1,86 @@ +/// Component that will prevent a gun from firing if the safety is turned on +/datum/component/gun_safety + /// Is the safety actually on? + var/safety_currently_on = TRUE + /// Holder for the toggle safety action + var/datum/action/item_action/gun_safety_toggle/toggle_safety_action + +/datum/component/gun_safety/Initialize(safety_currently_on = TRUE) + . = ..() + + // Obviously gun safety should only apply to guns + if(!isgun(parent)) + return COMPONENT_INCOMPATIBLE + + src.safety_currently_on = safety_currently_on + + var/obj/item/item_parent = parent + toggle_safety_action = item_parent.add_item_action(/datum/action/item_action/gun_safety_toggle) + + update_action_button_state() + +/datum/component/gun_safety/Destroy() + if(toggle_safety_action) + QDEL_NULL(toggle_safety_action) + return ..() + +/datum/component/gun_safety/RegisterWithParent() + RegisterSignal(parent, COMSIG_GUN_TRY_FIRE, PROC_REF(check_if_we_can_actually_shooty)) + RegisterSignal(parent, COMSIG_ITEM_UI_ACTION_CLICK, PROC_REF(we_may_be_toggling_safeties)) + RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine)) + +/datum/component/gun_safety/UnregisterFromParent() + UnregisterSignal(parent, list( + COMSIG_GUN_TRY_FIRE, + COMSIG_ITEM_UI_ACTION_CLICK, + COMSIG_PARENT_EXAMINE, + )) + +/// Checks if the safety is currently on, if it is then stops the gun from firing +/datum/component/gun_safety/proc/check_if_we_can_actually_shooty(obj/item/gun/source, mob/living/user, atom/target, flag, params) + SIGNAL_HANDLER + + if(safety_currently_on) + user.balloon_alert(user, "safety on!") + return COMPONENT_CANCEL_GUN_FIRE + +/// Calls toggle_safeties if the action type for doing so is used +/datum/component/gun_safety/proc/we_may_be_toggling_safeties(source, user, datum/actiontype) + SIGNAL_HANDLER + + if(istype(actiontype, toggle_safety_action)) + toggle_safeties(user) + + return COMPONENT_ACTION_HANDLED + +/// Toggles the safeties on or off +/datum/component/gun_safety/proc/toggle_safeties(mob/user) + safety_currently_on = !safety_currently_on + + update_action_button_state() + + playsound(parent, 'sound/weapons/empty.ogg', 100, TRUE) + user.visible_message( + span_notice("[user] toggles [parent]'s safety [safety_currently_on ? "ON" : "OFF"]."), + span_notice("You toggle [parent]'s safety [safety_currently_on ? "ON" : "OFF"].") + ) + +/// Adds the gun safety's current status to the gun's examine +/datum/component/gun_safety/proc/on_examine(obj/item/source, mob/examiner, list/examine_list) + SIGNAL_HANDLER + + examine_list += "The safety is [safety_currently_on ? "ON" : "OFF"]." + +/// Small proc to update the actio button's icon, just so I can not have to copypaste the same thing several times. +/datum/component/gun_safety/proc/update_action_button_state() + if(!toggle_safety_action) + return + + toggle_safety_action.button_icon_state = "safety_[safety_currently_on ? "on" : "off"]" + toggle_safety_action.build_all_button_icons() + +// The actual action, used by the component +/datum/action/item_action/gun_safety_toggle + name = "Toggle Gun Safety" + button_icon = 'modular_skyrat/modules/gun_safety/icons/actions.dmi' + button_icon_state = "safety_on" diff --git a/modular_skyrat/modules/gunsafety/icons/actions.dmi b/modular_skyrat/modules/gun_safety/icons/actions.dmi similarity index 100% rename from modular_skyrat/modules/gunsafety/icons/actions.dmi rename to modular_skyrat/modules/gun_safety/icons/actions.dmi diff --git a/modular_skyrat/modules/gunsafety/readme.md b/modular_skyrat/modules/gun_safety/readme.md similarity index 87% rename from modular_skyrat/modules/gunsafety/readme.md rename to modular_skyrat/modules/gun_safety/readme.md index d929b682bac..dc0634151ea 100644 --- a/modular_skyrat/modules/gunsafety/readme.md +++ b/modular_skyrat/modules/gun_safety/readme.md @@ -24,3 +24,4 @@ Adds a huge QOL feature, GUN SAFTIES. ### Credits: Gandalf2k15 - OG code +Paxilmaniac - Turned it into a component diff --git a/modular_skyrat/modules/gunhud/code/gun_hud_component.dm b/modular_skyrat/modules/gunhud/code/gun_hud_component.dm index dda48fe37a1..f32981b01e4 100644 --- a/modular_skyrat/modules/gunhud/code/gun_hud_component.dm +++ b/modular_skyrat/modules/gunhud/code/gun_hud_component.dm @@ -62,17 +62,6 @@ var/oth_t var/oth_h - switch(pew.fire_select) - if(SELECT_SEMI_AUTOMATIC) - indicator = "semi" - if(SELECT_BURST_SHOT) - indicator = "burst" - if(SELECT_FULLY_AUTOMATIC) - indicator = "auto" - - if(pew.safety) - indicator = "safe" - switch(length(rounds)) if(1) oth_o = "o[rounds[1]]" diff --git a/modular_skyrat/modules/gunsafety/code/gun_safety.dm b/modular_skyrat/modules/gunsafety/code/gun_safety.dm deleted file mode 100644 index d4012fc32b7..00000000000 --- a/modular_skyrat/modules/gunsafety/code/gun_safety.dm +++ /dev/null @@ -1,32 +0,0 @@ -/obj/item/gun/ballistic - has_gun_safety = TRUE - -/obj/item/gun/ballistic/bow - has_gun_safety = FALSE - -/obj/item/gun/energy - has_gun_safety = TRUE - -/obj/item/gun/energy/plasmacutter - has_gun_safety = FALSE - -/obj/item/gun/energy/kinetic_accelerator - has_gun_safety = FALSE - -/obj/item/gun/ballistic/rifle/enchanted - has_gun_safety = FALSE - -/obj/item/gun/ballistic/automatic/laser/ctf - has_gun_safety = FALSE - -/obj/item/gun/ballistic/shotgun/ctf - has_gun_safety = FALSE - -/obj/item/gun/ballistic/automatic/laser/ctf/marksman - has_gun_safety = FALSE - -/obj/item/gun/ballistic/automatic/pistol/deagle/ctf - has_gun_safety = FALSE - -/obj/item/gun/ballistic/automatic/pistol/g17/mesa - has_gun_safety = FALSE diff --git a/modular_skyrat/modules/gunsgalore/code/guns/akm.dm b/modular_skyrat/modules/gunsgalore/code/guns/akm.dm index d0d111a9eb1..3c73de359d7 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/akm.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/akm.dm @@ -21,7 +21,14 @@ load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_magout.ogg' alt_icons = TRUE - company_flag = COMPANY_IZHEVSK + +/obj/item/gun/ballistic/automatic/akm/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/akm/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) /obj/item/ammo_box/magazine/akm name = "\improper Krinkov magazine" @@ -88,7 +95,6 @@ desc = "A timeless human design of a carbine chambered in the NRI's 5.6mm ammo. The internal modifications made to the firearm in order to accommodate for non-military use made it incompatible with conventional munitions and gave it the inability to fire fully automatic. It's purpose-built to fire low-grade civilian ammo, anything stronger would obliterate the rifling and render the firearm useless." icon_state = "akm_civ" inhand_icon_state = "akm_civ" - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) mag_type = /obj/item/ammo_box/magazine/akm/civvie burst_size = 1 fire_delay = 5 diff --git a/modular_skyrat/modules/gunsgalore/code/guns/fg42.dm b/modular_skyrat/modules/gunsgalore/code/guns/fg42.dm index 67e9566fc04..c5066404f96 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/fg42.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/fg42.dm @@ -23,12 +23,17 @@ load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/batrifle_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/batrifle_magout.ogg' eject_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/batrifle_magout.ogg' - company_flag = COMPANY_OLDARMS /obj/item/gun/ballistic/automatic/fg42/Initialize(mapload) . = ..() + AddComponent(/datum/component/scope, range_modifier = 1) + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/fg42/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) + /obj/item/ammo_box/magazine/fg42 name = "fg42 magazine (7.92x57mm)" icon = 'modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_items.dmi' diff --git a/modular_skyrat/modules/gunsgalore/code/guns/luger.dm b/modular_skyrat/modules/gunsgalore/code/guns/luger.dm index 8f50e0191cd..cb0deda1c27 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/luger.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/luger.dm @@ -14,4 +14,6 @@ rack_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/fire/luger_rack.ogg' fire_sound_volume = 100 suppressor_x_offset = 14 - company_flag = COMPANY_OLDARMS + +/obj/item/gun/ballistic/automatic/pistol/luger/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) diff --git a/modular_skyrat/modules/gunsgalore/code/guns/m16.dm b/modular_skyrat/modules/gunsgalore/code/guns/m16.dm index 431056f1916..75e4a5fa144 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/m16.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/m16.dm @@ -53,6 +53,11 @@ burst_size = 3 fire_delay = 1.90 +/obj/item/gun/ballistic/automatic/m16/modern/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + /obj/item/gun/ballistic/automatic/m16/modern/v2 name = "\improper XM-2537 'Amans Patriae' rifle" desc = "An expertly modified, super-compact XM-2537 rifle designed for operating in tight corridors and fields full of Bethlehem flowers. You're a soldier, finish your mission!" diff --git a/modular_skyrat/modules/gunsgalore/code/guns/mg34.dm b/modular_skyrat/modules/gunsgalore/code/guns/mg34.dm index 02641b6fae0..152c98d1933 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/mg34.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/mg34.dm @@ -13,7 +13,6 @@ rack_sound = 'sound/weapons/gun/l6/l6_rack.ogg' suppressed_sound = 'sound/weapons/gun/general/heavy_shot_suppressed.ogg' fire_sound_volume = 70 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) weapon_weight = WEAPON_HEAVY slot_flags = ITEM_SLOT_BACK w_class = WEIGHT_CLASS_HUGE @@ -24,13 +23,18 @@ bolt_type = BOLT_TYPE_OPEN show_bolt_icon = FALSE tac_reloads = FALSE - company_flag = COMPANY_OLDARMS var/cover_open = FALSE /obj/item/gun/ballistic/automatic/mg34/Initialize(mapload) . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + AddElement(/datum/element/update_icon_updates_onmob) +/obj/item/gun/ballistic/automatic/mg34/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) + /obj/item/gun/ballistic/automatic/mg34/examine(mob/user) . = ..() . += "RMB with an empty hand to [cover_open ? "close" : "open"] the dust cover." diff --git a/modular_skyrat/modules/gunsgalore/code/guns/mp40.dm b/modular_skyrat/modules/gunsgalore/code/guns/mp40.dm index 21904008a9f..46ab724c3b8 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/mp40.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/mp40.dm @@ -20,8 +20,14 @@ load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magout.ogg' alt_icons = TRUE - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) - company_flag = COMPANY_OLDARMS + +/obj/item/gun/ballistic/automatic/mp40/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/mp40/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) /obj/item/ammo_box/magazine/mp40 name = "mp40 magazine (9mmx19)" diff --git a/modular_skyrat/modules/gunsgalore/code/guns/p90.dm b/modular_skyrat/modules/gunsgalore/code/guns/p90.dm index 405aacc8cbc..5d8b81ae2dd 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/p90.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/p90.dm @@ -11,7 +11,6 @@ slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_BACK mag_type = /obj/item/ammo_box/magazine/p90 can_suppress = FALSE - burst_size = 5 fire_delay = 1 fire_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/fire/p90_fire.ogg' fire_sound_volume = 100 @@ -21,6 +20,11 @@ eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/p90_magout.ogg' alt_icons = TRUE +/obj/item/gun/ballistic/automatic/p90/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + /obj/item/ammo_box/magazine/p90 name = "\improper P90-02 magazine" icon = 'modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_items.dmi' diff --git a/modular_skyrat/modules/gunsgalore/code/guns/pps.dm b/modular_skyrat/modules/gunsgalore/code/guns/pps.dm index d3d383a34c5..6e2646ebaa2 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/pps.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/pps.dm @@ -9,7 +9,6 @@ slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_BACK mag_type = /obj/item/ammo_box/magazine/pps can_suppress = FALSE - burst_size = 3 fire_delay = 3 worn_icon = 'modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_back.dmi' worn_icon_state = "pps" @@ -20,7 +19,14 @@ load_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magin.ogg' load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magout.ogg' - company_flag = COMPANY_OLDARMS + +/obj/item/gun/ballistic/automatic/pps/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/pps/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) /obj/item/ammo_box/magazine/pps name = "pps magazine (7.62x25mm)" diff --git a/modular_skyrat/modules/gunsgalore/code/guns/ppsh.dm b/modular_skyrat/modules/gunsgalore/code/guns/ppsh.dm index 6cf7b6eb9bf..227e3784642 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/ppsh.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/ppsh.dm @@ -13,7 +13,6 @@ mag_type = /obj/item/ammo_box/magazine/ppsh can_suppress = FALSE spread = 20 - burst_size = 6 fire_delay = 0.5 fire_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/fire/ppsh_fire.ogg' fire_sound_volume = 80 @@ -22,7 +21,14 @@ load_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magin.ogg' load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/smg_magout.ogg' - company_flag = COMPANY_OLDARMS + +/obj/item/gun/ballistic/automatic/ppsh/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/ppsh/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) /obj/item/ammo_box/magazine/ppsh name = "Asha 76 magazine (7.62x25mm)" diff --git a/modular_skyrat/modules/gunsgalore/code/guns/scar.dm b/modular_skyrat/modules/gunsgalore/code/guns/scar.dm index 17d268ac995..62f6bbf6888 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/scar.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/scar.dm @@ -13,7 +13,6 @@ weapon_weight = WEAPON_HEAVY mag_type = /obj/item/ammo_box/magazine/m16 can_suppress = FALSE - burst_size = 3 fire_delay = 1.90 fire_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/fire/scar_fire.ogg' fire_sound_volume = 50 @@ -22,3 +21,8 @@ load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/scar_mag_in.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/scar_mag_out.ogg' alt_icons = TRUE + +/obj/item/gun/ballistic/automatic/scar/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) diff --git a/modular_skyrat/modules/gunsgalore/code/guns/stg.dm b/modular_skyrat/modules/gunsgalore/code/guns/stg.dm index db857c4e116..95a7c6f913c 100644 --- a/modular_skyrat/modules/gunsgalore/code/guns/stg.dm +++ b/modular_skyrat/modules/gunsgalore/code/guns/stg.dm @@ -18,12 +18,18 @@ fire_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/fire/stg_fire.ogg' fire_sound_volume = 70 alt_icons = TRUE - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) rack_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_cock.ogg' load_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_magin.ogg' load_empty_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_magin.ogg' eject_sound = 'modular_skyrat/modules/gunsgalore/sound/guns/interact/ltrifle_magout.ogg' - company_flag = COMPANY_OLDARMS + +/obj/item/gun/ballistic/automatic/stg/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/stg/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) /obj/item/ammo_box/magazine/stg name = "stg magazine (7.92x33mm)" diff --git a/modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_guns40x32.dmi b/modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_guns40x32.dmi index 4e9e6d62d62..2a9b53ba7f9 100644 Binary files a/modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_guns40x32.dmi and b/modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_guns40x32.dmi differ diff --git a/modular_skyrat/modules/manufacturer_examine/code/gun_company_additions.dm b/modular_skyrat/modules/manufacturer_examine/code/gun_company_additions.dm new file mode 100644 index 00000000000..7989c4185fc --- /dev/null +++ b/modular_skyrat/modules/manufacturer_examine/code/gun_company_additions.dm @@ -0,0 +1,141 @@ +/// Adds the gun manufacturer examine component to the gun on subtypes, does nothing by default +/obj/item/gun/proc/give_manufacturer_examine() + return + +// Ballistics + +/obj/item/gun/ballistic/automatic/pistol/m1911/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) + +/obj/item/gun/ballistic/automatic/pistol/aps/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) + +/obj/item/gun/ballistic/revolver/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) + +/obj/item/gun/ballistic/revolver/nagant/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) + +/obj/item/gun/ballistic/rifle/boltaction/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) + +/obj/item/gun/ballistic/shotgun/riot/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/ballistic/shotgun/bulldog/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) + +/obj/item/gun/ballistic/shotgun/automatic/combat/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/ballistic/automatic/pistol/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) + +/obj/item/gun/ballistic/revolver/c38/detective/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/ballistic/shotgun/doublebarrel/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) + +/obj/item/gun/ballistic/shotgun/automatic/dual_tube/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/ballistic/rifle/boltaction/brand_new/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) + +/obj/item/gun/ballistic/shotgun/toy/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_DONK) + +/obj/item/gun/ballistic/rifle/boltaction/brand_new/prime/give_manufacturer_examine() + return + +/obj/item/gun/ballistic/rifle/boltaction/pipegun/give_manufacturer_examine() + return + +/obj/item/gun/ballistic/automatic/c20r/toy/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_DONK) + +/obj/item/gun/ballistic/automatic/pistol/clandestine/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) + +/obj/item/gun/ballistic/automatic/pistol/pdh/pulse/give_manufacturer_examine() + return + +/obj/item/gun/ballistic/automatic/l6_saw/toy/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_DONK) + +/obj/item/gun/ballistic/automatic/cmg/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/ballistic/revolver/mateba/give_manufacturer_examine() + return + +/obj/item/gun/ballistic/revolver/russian/give_manufacturer_examine() + return + +// Energy + +/obj/item/gun/energy/e_gun/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ALLSTAR) + +/obj/item/gun/energy/laser/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ALLSTAR) + +/obj/item/gun/energy/pulse/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/energy/laser/redtag/give_manufacturer_examine() + return + +/obj/item/gun/energy/laser/bluetag/give_manufacturer_examine() + return + +/obj/item/gun/energy/laser/instakill/give_manufacturer_examine() + return + +/obj/item/gun/energy/laser/chameleon/give_manufacturer_examine() + return + +/obj/item/gun/energy/laser/captain/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/energy/laser/retro/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_REMOVED) + +/obj/item/gun/energy/laser/retro/old/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/energy/e_gun/old/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + +/obj/item/gun/energy/e_gun/advtaser/cyborg/give_manufacturer_examine() + return + +/obj/item/gun/energy/recharge/ebow/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_SCARBOROUGH) + +/obj/item/gun/energy/lasercannon/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ALLSTAR) + +/obj/item/gun/energy/ionrifle/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ALLSTAR) + +/obj/item/gun/energy/temperature/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ALLSTAR) + +/obj/item/gun/energy/shrink_ray/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ABDUCTOR) + +/obj/item/gun/energy/alien/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ABDUCTOR) + +// Syringe + +/obj/item/gun/syringe/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_INTERDYNE) + +/obj/item/gun/syringe/blowgun/give_manufacturer_examine() + return + +/obj/item/gun/syringe/syndicate/prototype/give_manufacturer_examine() + return diff --git a/modular_skyrat/modules/manufacturer_examine/code/manufacturer_component.dm b/modular_skyrat/modules/manufacturer_examine/code/manufacturer_component.dm new file mode 100644 index 00000000000..2423ae9c807 --- /dev/null +++ b/modular_skyrat/modules/manufacturer_examine/code/manufacturer_component.dm @@ -0,0 +1,53 @@ +/// Component that will tell anyone who examines the parent what company made it +/datum/component/manufacturer_examine + /// Bitflag for what company produces this, do not give it more than one + var/company_flag + +/datum/component/manufacturer_examine/Initialize(given_company_flag) + . = ..() + + // Obviously gun safety should only apply to guns + if(!given_company_flag) + return COMPONENT_INCOMPATIBLE + + src.company_flag = given_company_flag + +/datum/component/manufacturer_examine/RegisterWithParent() + RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine)) + +/datum/component/manufacturer_examine/UnregisterFromParent() + UnregisterSignal(parent, list( + COMSIG_PARENT_EXAMINE, + )) + +/// Reads the company flag and sticks a message in the examine list appropriate to the given flag. TODO EVENTUALLY: MAKE THIS NOT A HUGE SWITCH CASE +/datum/component/manufacturer_examine/proc/on_examine(obj/item/source, mob/examiner, list/examine_list) + SIGNAL_HANDLER + + switch(company_flag) + if(COMPANY_CANTALAN) + examine_list += "
It has [span_purple("Cantalan Federal Arms")] etched into the grip." + if(COMPANY_ARMADYNE) + examine_list += "
It has [span_red("Armadyne Corporation")] etched into the barrel." + if(COMPANY_SCARBOROUGH) + examine_list += "
It has [span_orange("Scarborough Arms")] stamped onto the grip." + if(COMPANY_DONK) + examine_list += "
It has a [span_green("Donk Corporation")] label visible in the plastic." + if(COMPANY_BOLT) + examine_list += "
It has [span_yellow("Bolt Fabrications")] stamped onto the reciever." + if(COMPANY_OLDARMS) + examine_list += "
It has [span_red("Armadyne Oldarms")] etched into the barrel." + if(COMPANY_IZHEVSK) + examine_list += "
It has [span_brown("Izhevsk Coalition")] cut in above the magwell." + if(COMPANY_NANOTRASEN) + examine_list += "
It has [span_blue("Nanotrasen Armories")] etched into the reciever." + if(COMPANY_ALLSTAR) + examine_list += "
It has [span_red("Allstar Lasers Inc.")] stamped on the front grip." + if(COMPANY_MICRON) + examine_list += "
It has [span_cyan("Micron Control Sys.")] cut in above the cell slot." + if(COMPANY_INTERDYNE) + examine_list += "
It has [span_cyan("Interdyne Pharmaceuticals")] stamped onto the barrel." + if(COMPANY_ABDUCTOR) + examine_list += "
It has [span_abductor("✌︎︎♌︎︎♎︎︎◆︎︎♍︎︎⧫︎︎❄︎♏︎♍︎♒︎")] engraved into the photon accelerator." + if(COMPANY_REMOVED) + examine_list += "
It has had [span_grey("all identifying marks scrubbed off")]." diff --git a/modular_skyrat/modules/manufacturer_examine/readme.md b/modular_skyrat/modules/manufacturer_examine/readme.md new file mode 100644 index 00000000000..4e27e204550 --- /dev/null +++ b/modular_skyrat/modules/manufacturer_examine/readme.md @@ -0,0 +1,25 @@ +## Title: Manufacturer Examine + +### Description: + +Tells you what company made what item this component is attached to, originally for guns + +### TG Proc Changes: + +- N/A + +### Defines: + +- N/A + +### Master file additions + +- N/A + +### Included files that are not contained in this module: + +- N/A + +### Credits: +Zonespace - Did the whole manufacturer thing originally I think +Paxilmaniac - Turned it into a component diff --git a/modular_skyrat/modules/marines/code/gear.dm b/modular_skyrat/modules/marines/code/gear.dm index 4dd460c6b4e..2b1cad54540 100644 --- a/modular_skyrat/modules/marines/code/gear.dm +++ b/modular_skyrat/modules/marines/code/gear.dm @@ -18,7 +18,14 @@ mag_type = /obj/item/ammo_box/magazine/m44a w_class = WEIGHT_CLASS_BULKY slot_flags = ITEM_SLOT_BELT - company_flag = COMPANY_NANOTRASEN + +/obj/item/gun/ballistic/automatic/ar/modular/m44a/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/ar/modular/m44a/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) /obj/item/ammo_box/magazine/m44a name = "m44a magazine (.300 compressed)" @@ -57,9 +64,11 @@ name = "\improper M2 auto-shotgun underbarrel" desc = "This shouldn't be heeere!" can_suppress = FALSE - has_gun_safety = FALSE mag_type = /obj/item/ammo_box/magazine/internal/shot/as2/ubsg +/obj/item/gun/ballistic/shotgun/automatic/as2/ubsg/give_gun_safeties() + return + /obj/item/ammo_box/magazine/internal/shot/as2/ubsg max_ammo = 3 ammo_type = /obj/item/ammo_casing/shotgun/buckshot diff --git a/modular_skyrat/modules/marines/code/smartgun.dm b/modular_skyrat/modules/marines/code/smartgun.dm index 269e7c39a65..592750d6b95 100644 --- a/modular_skyrat/modules/marines/code/smartgun.dm +++ b/modular_skyrat/modules/marines/code/smartgun.dm @@ -13,7 +13,6 @@ rack_sound = 'sound/weapons/gun/l6/l6_rack.ogg' suppressed_sound = 'sound/weapons/gun/general/heavy_shot_suppressed.ogg' fire_sound_volume = 70 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_FULLY_AUTOMATIC) weapon_weight = WEAPON_HEAVY slot_flags = ITEM_SLOT_BACK w_class = WEIGHT_CLASS_HUGE @@ -28,7 +27,6 @@ pin = /obj/item/firing_pin/implant/mindshield mag_display_ammo = FALSE mag_display = FALSE - company_flag = COMPANY_NANOTRASEN fire_sound_volume = 30 /// If the gun's dustcover is open or not var/cover_open = FALSE @@ -37,8 +35,14 @@ /obj/item/gun/ballistic/automatic/smart_machine_gun/Initialize(mapload) . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + AddElement(/datum/element/update_icon_updates_onmob) +/obj/item/gun/ballistic/automatic/smart_machine_gun/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_NANOTRASEN) + /obj/item/gun/ballistic/automatic/smart_machine_gun/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0) . = ..() if(chambered) diff --git a/modular_skyrat/modules/medical/code/smartdarts.dm b/modular_skyrat/modules/medical/code/smartdarts.dm index 558d9a84f2d..c36caa3f1eb 100644 --- a/modular_skyrat/modules/medical/code/smartdarts.dm +++ b/modular_skyrat/modules/medical/code/smartdarts.dm @@ -47,13 +47,15 @@ icon = 'modular_skyrat/modules/medical/icons/obj/dartguns.dmi' icon_state = "smartdartgun" worn_icon_state = "medicalsyringegun" - has_gun_safety = TRUE item_flags = null /obj/item/gun/syringe/smartdart/Initialize(mapload) . = ..() chambered = new /obj/item/ammo_casing/syringegun/dart(src) +/obj/item/gun/syringe/smartdart/give_gun_safeties() + return + /obj/item/gun/syringe/smartdart/attackby(obj/item/container, mob/user, params, show_msg = TRUE) if(istype(container, /obj/item/reagent_containers/syringe/smartdart)) ..() diff --git a/modular_skyrat/modules/microfusion/code/gun_types.dm b/modular_skyrat/modules/microfusion/code/gun_types.dm index c62d6338099..788ec1fb62b 100644 --- a/modular_skyrat/modules/microfusion/code/gun_types.dm +++ b/modular_skyrat/modules/microfusion/code/gun_types.dm @@ -4,7 +4,9 @@ icon_state = "mcr01" inhand_icon_state = "mcr01" shaded_charge = TRUE - company_flag = COMPANY_MICRON + +/obj/item/gun/microfusion/mcr01/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_MICRON) /// Gun for cargo crates. /obj/item/gun/microfusion/mcr01/advanced diff --git a/modular_skyrat/modules/microfusion/code/microfusion_energy_master.dm b/modular_skyrat/modules/microfusion/code/microfusion_energy_master.dm index 0a01217264e..d87390d8a4c 100644 --- a/modular_skyrat/modules/microfusion/code/microfusion_energy_master.dm +++ b/modular_skyrat/modules/microfusion/code/microfusion_energy_master.dm @@ -9,10 +9,8 @@ icon = 'modular_skyrat/modules/microfusion/icons/microfusion_gun40x32.dmi' icon_state = "mcr01" inhand_icon_state = "mcr01" - bayonet_icon = 'modular_skyrat/modules/microfusion/icons/microfusion_gun40x32.dmi' lefthand_file = 'modular_skyrat/modules/microfusion/icons/guns_lefthand.dmi' righthand_file = 'modular_skyrat/modules/microfusion/icons/guns_righthand.dmi' - has_gun_safety = TRUE can_bayonet = FALSE weapon_weight = WEAPON_HEAVY w_class = WEIGHT_CLASS_BULKY @@ -113,6 +111,9 @@ RegisterSignal(src, COMSIG_ITEM_RECHARGED, PROC_REF(instant_recharge)) base_fire_delay = fire_delay +/obj/item/gun/microfusion/give_gun_safeties() + AddComponent(/datum/component/gun_safety) + /obj/item/gun/microfusion/add_weapon_description() AddElement(/datum/element/weapon_description, attached_proc = PROC_REF(add_notes_energy)) diff --git a/modular_skyrat/modules/modular_weapons/code/automatic.dm b/modular_skyrat/modules/modular_weapons/code/automatic.dm index 7025c25fffe..1ee0c4c2874 100644 --- a/modular_skyrat/modules/modular_weapons/code/automatic.dm +++ b/modular_skyrat/modules/modular_weapons/code/automatic.dm @@ -43,7 +43,6 @@ selector_switch_icon = TRUE mag_type = /obj/item/ammo_box/magazine/multi_sprite/cfa_wildcat can_suppress = FALSE - burst_size = 3 fire_delay = 1.25 spread = 5 mag_display = TRUE @@ -51,7 +50,14 @@ fire_sound = 'sound/weapons/gun/smg/shot_alt.ogg' weapon_weight = WEAPON_MEDIUM w_class = WEIGHT_CLASS_BULKY - company_flag = COMPANY_CANTALAN + +/obj/item/gun/ballistic/automatic/cfa_wildcat/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/cfa_wildcat/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) /obj/item/gun/ballistic/automatic/cfa_wildcat/no_mag spawnwithmagazine = FALSE @@ -69,7 +75,6 @@ selector_switch_icon = FALSE mag_type = /obj/item/ammo_box/magazine/multi_sprite/cfa_lynx can_suppress = FALSE - burst_size = 3 fire_delay = 1.90 //Previously 0.5. Changed due to it being the Blueshield's default firearm. spread = 2 mag_display = TRUE @@ -77,7 +82,14 @@ fire_sound = 'sound/weapons/gun/smg/shot_alt.ogg' weapon_weight = WEAPON_MEDIUM w_class = WEIGHT_CLASS_BULKY - company_flag = COMPANY_CANTALAN + +/obj/item/gun/ballistic/automatic/cfa_lynx/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/cfa_lynx/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) /obj/item/gun/ballistic/automatic/cfa_lynx/no_mag spawnwithmagazine = FALSE diff --git a/modular_skyrat/modules/modular_weapons/code/energy.dm b/modular_skyrat/modules/modular_weapons/code/energy.dm index 1d6264e95db..ed6abe76ba0 100644 --- a/modular_skyrat/modules/modular_weapons/code/energy.dm +++ b/modular_skyrat/modules/modular_weapons/code/energy.dm @@ -17,8 +17,12 @@ cell_type = /obj/item/stock_parts/cell/mini_egun ammo_x_offset = 2 charge_sections = 3 - has_gun_safety = FALSE - company_flag = COMPANY_BOLT + +/obj/item/gun/energy/disabler/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) + +/obj/item/gun/energy/disabler/bolt_disabler/give_gun_safeties() + return /obj/item/gun/energy/disabler/bolt_disabler/add_seclight_point() return @@ -39,9 +43,13 @@ ammo_type = list(/obj/item/ammo_casing/energy/disabler/bounce, /obj/item/ammo_casing/energy/laser/bounce, /obj/item/ammo_casing/energy/electrode/knockdown) ammo_x_offset = 1 charge_sections = 5 - has_gun_safety = FALSE cell_type = /obj/item/stock_parts/cell/hos_gun - company_flag = COMPANY_CANTALAN + +/obj/item/gun/energy/e_gun/cfa_phalanx/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) + +/obj/item/gun/energy/e_gun/cfa_phalanx/give_gun_safeties() + return /* * CFA PALADIN @@ -57,8 +65,12 @@ force = 10 ammo_type = list(/obj/item/ammo_casing/energy/laser/double) charge_sections = 5 - has_gun_safety = FALSE - company_flag = COMPANY_CANTALAN + +/obj/item/gun/energy/laser/cfa_paladin/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) + +/obj/item/gun/energy/laser/cfa_paladin/give_gun_safeties() + return /* * BOUNCE DISABLER diff --git a/modular_skyrat/modules/modular_weapons/code/pistol.dm b/modular_skyrat/modules/modular_weapons/code/pistol.dm index c496114c037..668233fa327 100644 --- a/modular_skyrat/modules/modular_weapons/code/pistol.dm +++ b/modular_skyrat/modules/modular_weapons/code/pistol.dm @@ -11,8 +11,12 @@ can_suppress = TRUE fire_sound_volume = 30 w_class = WEIGHT_CLASS_SMALL - has_gun_safety = FALSE - company_flag = COMPANY_CANTALAN + +/obj/item/gun/ballistic/automatic/pistol/cfa_snub/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) + +/obj/item/gun/ballistic/automatic/pistol/cfa_snub/give_gun_safeties() + return /obj/item/gun/ballistic/automatic/pistol/cfa_snub/empty spawnwithmagazine = FALSE @@ -26,8 +30,12 @@ can_suppress = FALSE fire_sound_volume = 120 w_class = WEIGHT_CLASS_NORMAL - has_gun_safety = FALSE - company_flag = COMPANY_CANTALAN + +/obj/item/gun/ballistic/automatic/pistol/cfa_ruby/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) + +/obj/item/gun/ballistic/automatic/pistol/cfa_ruby/give_gun_safeties() + return /obj/item/gun/ballistic/automatic/pistol/cfa_ruby/empty spawnwithmagazine = FALSE diff --git a/modular_skyrat/modules/modular_weapons/code/revolver.dm b/modular_skyrat/modules/modular_weapons/code/revolver.dm index ff800272a37..132bfed2da0 100644 --- a/modular_skyrat/modules/modular_weapons/code/revolver.dm +++ b/modular_skyrat/modules/modular_weapons/code/revolver.dm @@ -20,8 +20,9 @@ lefthand_file = 'modular_skyrat/modules/modular_weapons/icons/mob/inhands/weapons/64x_guns_left.dmi' righthand_file = 'modular_skyrat/modules/modular_weapons/icons/mob/inhands/weapons/64x_guns_right.dmi' inhand_icon_state = "revolving" - company_flag = COMPANY_IZHEVSK +/obj/item/gun/ballistic/revolver/rifle/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) /obj/item/gun/ballistic/revolver/rifle/gold name = "\improper .45 revolving rifle" desc = "A gold trimmed revolving rifle! It fires .45 bullets." diff --git a/modular_skyrat/modules/modular_weapons/code/rifle.dm b/modular_skyrat/modules/modular_weapons/code/rifle.dm index 9eca675ce73..6f26f8bab0b 100644 --- a/modular_skyrat/modules/modular_weapons/code/rifle.dm +++ b/modular_skyrat/modules/modular_weapons/code/rifle.dm @@ -16,22 +16,25 @@ mag_type = /obj/item/ammo_box/magazine/cm68 fire_delay = 5 can_suppress = FALSE - burst_size = 0 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) + burst_size = 1 mag_display = FALSE mag_display_ammo = FALSE empty_indicator = FALSE recoil = 1 weapon_weight = WEAPON_HEAVY pixel_x = -8 - has_gun_safety = FALSE w_class = WEIGHT_CLASS_BULKY - company_flag = COMPANY_CANTALAN /obj/item/gun/ballistic/automatic/cfa_rifle/Initialize(mapload) . = ..() AddComponent(/datum/component/scope, range_modifier = 1.5) +/obj/item/gun/ballistic/automatic/cfa_rifle/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) + +/obj/item/gun/ballistic/automatic/cfa_rifle/give_gun_safeties() + return + /obj/item/gun/ballistic/automatic/cfa_rifle/empty spawnwithmagazine = FALSE diff --git a/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic/revolver.dm b/modular_skyrat/modules/moretraitoritems/code/ocelot_revolver.dm similarity index 100% rename from modular_skyrat/master_files/code/modules/projectiles/guns/ballistic/revolver.dm rename to modular_skyrat/modules/moretraitoritems/code/ocelot_revolver.dm diff --git a/modular_skyrat/modules/moretraitoritems/code/syndicate_loadout.dm b/modular_skyrat/modules/moretraitoritems/code/syndicate_loadout.dm index 5070736c2ad..d756ff42810 100644 --- a/modular_skyrat/modules/moretraitoritems/code/syndicate_loadout.dm +++ b/modular_skyrat/modules/moretraitoritems/code/syndicate_loadout.dm @@ -185,7 +185,7 @@ new /obj/item/storage/box/donkpockets(src) /obj/item/storage/backpack/duffelbag/syndie/loadout/downtownspecial/PopulateContents() - new /obj/item/gun/ballistic/automatic/tommygun/therealtommy(src) + new /obj/item/gun/ballistic/automatic/tommygun(src) new /obj/item/ammo_box/magazine/tommygunm45(src) new /obj/item/clothing/suit/jacket/det_suit/noir/mafioso(src) new /obj/item/clothing/under/suit/blacktwopiece/armoured(src) diff --git a/modular_skyrat/modules/novaya_ert/code/automatic.dm b/modular_skyrat/modules/novaya_ert/code/automatic.dm index 200b68710dd..ea7eb69b19f 100644 --- a/modular_skyrat/modules/novaya_ert/code/automatic.dm +++ b/modular_skyrat/modules/novaya_ert/code/automatic.dm @@ -16,7 +16,9 @@ mag_display = TRUE empty_indicator = TRUE fire_sound = 'sound/weapons/gun/smg/shot_alt.ogg' - company_flag = COMPANY_IZHEVSK + +/obj/item/gun/ballistic/automatic/plastikov/nri/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) /obj/item/gun/ballistic/automatic/plastikov/nri_pirate name = "\improper PP-105 SMG" @@ -43,4 +45,6 @@ mag_type = /obj/item/ammo_box/magazine/m9mm_aps burst_size = 3 fire_delay = 3 - company_flag = COMPANY_IZHEVSK + +/obj/item/gun/ballistic/automatic/pistol/ladon/nri/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) diff --git a/modular_skyrat/modules/sec_haul/code/guns/guns.dm b/modular_skyrat/modules/sec_haul/code/guns/guns.dm index 95ac8ae711a..bf1f6abf203 100644 --- a/modular_skyrat/modules/sec_haul/code/guns/guns.dm +++ b/modular_skyrat/modules/sec_haul/code/guns/guns.dm @@ -15,9 +15,11 @@ lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' fire_delay = 1.90 - company_flag = COMPANY_CANTALAN projectile_damage_multiplier = 0.5 +/obj/item/gun/ballistic/automatic/pistol/g17/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) + /obj/item/gun/ballistic/automatic/pistol/g17/add_seclight_point() return @@ -60,9 +62,11 @@ spread = 8 mag_display = FALSE mag_display_ammo = FALSE - company_flag = COMPANY_CANTALAN projectile_damage_multiplier = 0.5 +/obj/item/gun/ballistic/automatic/pistol/g18/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_CANTALAN) + /obj/item/gun/ballistic/automatic/pistol/g18/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -100,7 +104,9 @@ lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' fire_delay = 0.9 - company_flag = null + +/obj/item/gun/ballistic/automatic/pistol/g17/mesa/give_manufacturer_examine() + return /obj/item/gun/ballistic/automatic/pistol/g17/mesa/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -124,7 +130,9 @@ rack_sound = 'sound/weapons/gun/pistol/rack.ogg' lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' - company_flag = COMPANY_ARMADYNE + +/obj/item/gun/ballistic/automatic/pistol/pdh/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) /obj/item/gun/ballistic/automatic/pistol/pdh/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -175,7 +183,6 @@ burst_size = 3 fire_delay = 2 spread = 5 - company_flag = COMPANY_ARMADYNE /obj/item/ammo_box/magazine/multi_sprite/pdh_corpo name = "\improper PDH-6M magazine" @@ -206,7 +213,6 @@ burst_size = 3 fire_delay = 2 spread = 9 - company_flag = COMPANY_ARMADYNE /obj/item/ammo_box/magazine/multi_sprite/pdh_striker name = "\improper PDH-6M magazine" @@ -232,7 +238,6 @@ icon_state = "pdh_peacekeeper" mag_type = /obj/item/ammo_box/magazine/multi_sprite/pdh_peacekeeper fire_sound = 'modular_skyrat/modules/sec_haul/sound/pistol_fire.ogg' - company_flag = COMPANY_ARMADYNE projectile_damage_multiplier = 0.5 /obj/item/ammo_box/magazine/multi_sprite/pdh_peacekeeper @@ -277,9 +282,11 @@ lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' fire_delay = 4.20 - company_flag = COMPANY_ARMADYNE projectile_damage_multiplier = 0.7 +/obj/item/gun/ballistic/automatic/pistol/ladon/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) + /obj/item/gun/ballistic/automatic/pistol/ladon/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -320,9 +327,11 @@ rack_sound = 'sound/weapons/gun/pistol/rack.ogg' lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' - company_flag = COMPANY_IZHEVSK projectile_damage_multiplier = 0.6 +/obj/item/gun/ballistic/automatic/pistol/makarov/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) + /obj/item/ammo_box/magazine/multi_sprite/makarov name = "\improper R-C Makarov magazine" desc = "A tiny magazine for the R-C Makarov pocket pistol, chambered in 10mm Auto." @@ -361,9 +370,11 @@ rack_sound = 'sound/weapons/gun/pistol/rack.ogg' lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' - company_flag = COMPANY_ARMADYNE projectile_damage_multiplier = 0.5 +/obj/item/gun/ballistic/automatic/pistol/mk58/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) + /obj/item/ammo_box/magazine/multi_sprite/mk58 name = "\improper MK-58 magazine" desc = "A flimsy double-stack polymer magazine for the MK-58 handgun, chambered for 9x25mm." @@ -402,9 +413,11 @@ w_class = WEIGHT_CLASS_NORMAL mag_type = /obj/item/ammo_box/magazine/multi_sprite/firefly can_suppress = FALSE - company_flag = COMPANY_ARMADYNE projectile_damage_multiplier = 0.5 +/obj/item/gun/ballistic/automatic/pistol/firefly/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) + /obj/item/gun/ballistic/automatic/pistol/firefly/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -454,8 +467,9 @@ spread = 25 mag_display = FALSE mag_display_ammo = FALSE - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_BURST_SHOT) - company_flag = COMPANY_IZHEVSK + +/obj/item/gun/ballistic/automatic/croon/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_IZHEVSK) /obj/item/ammo_box/magazine/multi_sprite/croon name = "\improper Croon magazine" @@ -495,12 +509,13 @@ mag_display_ammo = FALSE burst_size = 2 fire_delay = 1.90 - fire_select_modes = list(SELECT_SEMI_AUTOMATIC, SELECT_BURST_SHOT) fire_sound = 'sound/weapons/gun/rifle/shot.ogg' rack_sound = 'sound/weapons/gun/smg/smgrack.ogg' lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' - company_flag = COMPANY_ARMADYNE + +/obj/item/gun/ballistic/automatic/dozer/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) /obj/item/ammo_box/magazine/multi_sprite/dozer name = "\improper Dozer magazine" @@ -544,12 +559,18 @@ mag_type = /obj/item/ammo_box/magazine/dmr fire_delay = 1.7 can_suppress = FALSE - burst_size = 3 can_bayonet = FALSE mag_display = TRUE fire_sound_volume = 60 fire_sound = 'modular_skyrat/modules/sec_haul/sound/sniper_fire.ogg' - company_flag = COMPANY_ARMADYNE + +/obj/item/gun/ballistic/automatic/dmr/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/dmr/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) /obj/item/ammo_box/magazine/dmr name = "\improper Gen-2 Ripper magazine" @@ -576,7 +597,9 @@ mag_type = /obj/item/ammo_box/magazine/internal/cylinder/zeta fire_sound = 'modular_skyrat/modules/sec_haul/sound/revolver_fire.ogg' fire_delay = 3 - company_flag = COMPANY_BOLT + +/obj/item/gun/ballistic/revolver/zeta/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) /obj/item/ammo_box/magazine/internal/cylinder/zeta name = "\improper Zeta-6 cylinder" @@ -613,9 +636,11 @@ mag_type = /obj/item/ammo_box/magazine/internal/cylinder/revolution fire_sound = 'modular_skyrat/modules/sec_haul/sound/revolver_fire.ogg' fire_delay = 1.90 - company_flag = COMPANY_BOLT projectile_damage_multiplier = 0.5 +/obj/item/gun/ballistic/revolver/revolution/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) + /obj/item/ammo_box/magazine/internal/cylinder/revolution name = "\improper Revolution-8 cylinder" desc = "If you see this, you should call a Bluespace Technician. Unless you're that Bluespace Technician." @@ -673,7 +698,9 @@ load_empty_sound = 'modular_skyrat/modules/sec_haul/sound/chaingun_magout.ogg' var/recharge_time = 5 SECONDS var/recharging = FALSE - company_flag = COMPANY_ARMADYNE + +/obj/item/gun/ballistic/automatic/smartgun/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) /obj/item/gun/ballistic/automatic/smartgun/process_chamber() . = ..() @@ -750,14 +777,20 @@ slot_flags = ITEM_SLOT_BACK | ITEM_SLOT_BELT | ITEM_SLOT_OCLOTHING mag_type = /obj/item/ammo_box/magazine/multi_sprite/g11 can_suppress = FALSE - burst_size = 3 fire_delay = 0.5 spread = 10 mag_display = TRUE mag_display_ammo = TRUE fire_sound = 'modular_skyrat/modules/sec_haul/sound/ltrifle_fire.ogg' can_bayonet = TRUE - company_flag = COMPANY_OLDARMS + +/obj/item/gun/ballistic/auotmatic/g11/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/g11/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) /obj/item/ammo_box/magazine/multi_sprite/g11 name = "\improper G-11 magazine" @@ -790,7 +823,9 @@ mag_type = /obj/item/ammo_box/magazine/internal/shot/m23 w_class = WEIGHT_CLASS_BULKY slot_flags = ITEM_SLOT_BACK | ITEM_SLOT_BELT | ITEM_SLOT_OCLOTHING - company_flag = COMPANY_BOLT + +/obj/item/gun/ballistic/shotgun/m23/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) /obj/item/ammo_box/magazine/internal/shot/m23 name = "m23 shotgun internal magazine" @@ -819,7 +854,9 @@ mag_type = /obj/item/ammo_box/magazine/internal/shot/as2 w_class = WEIGHT_CLASS_BULKY slot_flags = ITEM_SLOT_BACK | ITEM_SLOT_BELT | ITEM_SLOT_OCLOTHING - company_flag = COMPANY_ARMADYNE + +/obj/item/gun/ballistic/shotgun/automatic/as2/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) /obj/item/ammo_box/magazine/internal/shot/as2 name = "shotgun internal magazine" @@ -853,15 +890,16 @@ mag_display_ammo = TRUE actions_types = null fire_sound = 'modular_skyrat/modules/sec_haul/sound/ltrifle_fire.ogg' - fire_select_modes = list(SELECT_SEMI_AUTOMATIC) burst_size = 1 fire_delay = 10 - company_flag = COMPANY_ARMADYNE /obj/item/gun/ballistic/automatic/norwind/Initialize(mapload) . = ..() AddComponent(/datum/component/scope, range_modifier = 1.75) +/obj/item/gun/ballistic/automatic/norwind/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) + /obj/item/gun/ballistic/automatic/norwind/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -908,17 +946,21 @@ can_bayonet = FALSE mag_display = FALSE mag_display_ammo = FALSE - burst_size = 2 fire_delay = 4 spread = 10 fire_sound = 'sound/weapons/gun/smg/shot_suppressed.ogg' - company_flag = COMPANY_OLDARMS projectile_damage_multiplier = 0.5 /obj/item/gun/ballistic/automatic/vintorez/Initialize(mapload) . = ..() + AddComponent(/datum/component/scope, range_modifier = 1.5) + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/vintorez/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_OLDARMS) + /obj/item/ammo_box/magazine/multi_sprite/vintorez name = "\improper VKC magazine" desc = "A twenty-round magazine for the VKC marksman rifle, chambered in 9x25mm." @@ -960,15 +1002,21 @@ mag_type = /obj/item/ammo_box/magazine/multi_sprite/pcr fire_delay = 1.80 can_suppress = FALSE - burst_size = 5 spread = 10 can_bayonet = FALSE mag_display = TRUE mag_display_ammo = TRUE fire_sound = 'modular_skyrat/modules/sec_haul/sound/smg_fire.ogg' - company_flag = COMPANY_BOLT projectile_damage_multiplier = 0.5 +/obj/item/gun/ballistic/automatic/pcr/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/pcr/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) + /obj/item/gun/ballistic/automatic/pcr/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -1015,9 +1063,16 @@ mag_display_ammo = TRUE fire_sound = 'modular_skyrat/modules/sec_haul/sound/sfrifle_fire.ogg' can_bayonet = TRUE - company_flag = COMPANY_BOLT projectile_damage_multiplier = 0.7 +/obj/item/gun/ballistic/automatic/pitbull/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/pitbull/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) + /obj/item/gun/ballistic/automatic/pitbull/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") @@ -1070,7 +1125,14 @@ mag_display_ammo = TRUE fire_sound = 'sound/weapons/gun/smg/shot.ogg' can_bayonet = TRUE - company_flag = COMPANY_ARMADYNE + +/obj/item/gun/ballistic/automatic/ostwind/Initialize(mapload) + . = ..() + + AddComponent(/datum/component/automatic_fire, fire_delay) + +/obj/item/gun/ballistic/automatic/ostwind/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_ARMADYNE) /obj/item/ammo_box/magazine/multi_sprite/ostwind name = "\improper DTR-6 magazine" diff --git a/modular_skyrat/modules/sec_haul/code/guns/pepperball_gun.dm b/modular_skyrat/modules/sec_haul/code/guns/pepperball_gun.dm index e76a3a83919..63854a4893f 100644 --- a/modular_skyrat/modules/sec_haul/code/guns/pepperball_gun.dm +++ b/modular_skyrat/modules/sec_haul/code/guns/pepperball_gun.dm @@ -11,7 +11,9 @@ lock_back_sound = 'sound/weapons/gun/pistol/slide_lock.ogg' bolt_drop_sound = 'sound/weapons/gun/pistol/slide_drop.ogg' fire_sound_volume = 50 - company_flag = COMPANY_BOLT + +/obj/item/gun/ballistic/automatic/pistol/pepperball/give_manufacturer_examine() + AddComponent(/datum/component/manufacturer_examine, COMPANY_BOLT) /obj/item/gun/ballistic/automatic/pistol/pepperball/add_seclight_point() AddComponent(/datum/component/seclite_attachable, light_overlay_icon = 'icons/obj/weapons/guns/flashlights.dmi', light_overlay = "flight") diff --git a/modular_skyrat/modules/tribal_extended/code/weapons/bow.dm b/modular_skyrat/modules/tribal_extended/code/weapons/bow.dm index 8bfac93c25f..665e7d27044 100644 --- a/modular_skyrat/modules/tribal_extended/code/weapons/bow.dm +++ b/modular_skyrat/modules/tribal_extended/code/weapons/bow.dm @@ -19,7 +19,9 @@ casing_ejector = FALSE internal_magazine = TRUE trigger_guard = TRIGGER_GUARD_ALLOW_ALL //so ashwalkers can use it - has_gun_safety = FALSE + +/obj/item/gun/ballistic/tribalbow/give_gun_safeties() + return /obj/item/gun/ballistic/tribalbow/shoot_with_empty_chamber() return diff --git a/tgstation.dme b/tgstation.dme index 024422e83b6..c7d84007b5e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -5164,7 +5164,6 @@ #include "modular_skyrat\master_files\code\datums\ert.dm" #include "modular_skyrat\master_files\code\datums\outfits.dm" #include "modular_skyrat\master_files\code\datums\components\crafting.dm" -#include "modular_skyrat\master_files\code\datums\components\fullauto.dm" #include "modular_skyrat\master_files\code\datums\components\shielded_suit.dm" #include "modular_skyrat\master_files\code\datums\components\tippable.dm" #include "modular_skyrat\master_files\code\datums\id_trim\jobs.dm" @@ -5336,10 +5335,6 @@ #include "modular_skyrat\master_files\code\modules\power\singularity\containment_field.dm" #include "modular_skyrat\master_files\code\modules\projectiles\boxes_magazines\external\shotgun.dm" #include "modular_skyrat\master_files\code\modules\projectiles\boxes_magazines\external\smg.dm" -#include "modular_skyrat\master_files\code\modules\projectiles\guns\ballistic.dm" -#include "modular_skyrat\master_files\code\modules\projectiles\guns\gun.dm" -#include "modular_skyrat\master_files\code\modules\projectiles\guns\ballistic\automatic.dm" -#include "modular_skyrat\master_files\code\modules\projectiles\guns\ballistic\revolver.dm" #include "modular_skyrat\master_files\code\modules\reagents\bottle.dm" #include "modular_skyrat\master_files\code\modules\reagents\reagent_containers.dm" #include "modular_skyrat\master_files\code\modules\reagents\chemistry\colors.dm" @@ -5637,7 +5632,6 @@ #include "modular_skyrat\modules\company_imports\code\armament_component.dm" #include "modular_skyrat\modules\company_imports\code\company_datums.dm" #include "modular_skyrat\modules\company_imports\code\company_subsystem.dm" -#include "modular_skyrat\modules\company_imports\code\gun_companies.dm" #include "modular_skyrat\modules\company_imports\code\armament_datums\bolt_nanotrasen_firearms.dm" #include "modular_skyrat\modules\company_imports\code\armament_datums\deforest_medical.dm" #include "modular_skyrat\modules\company_imports\code\armament_datums\jarnsmiour.dm" @@ -5974,12 +5968,13 @@ #include "modular_skyrat\modules\goofsec\code\hud.dm" #include "modular_skyrat\modules\goofsec\code\sec_clothing_overrides.dm" #include "modular_skyrat\modules\goofsec\code\sol_fed.dm" +#include "modular_skyrat\modules\gun_safety\code\safety_additions.dm" +#include "modular_skyrat\modules\gun_safety\code\safety_component.dm" #include "modular_skyrat\modules\gunhud\code\gun_hud.dm" #include "modular_skyrat\modules\gunhud\code\gun_hud_component.dm" #include "modular_skyrat\modules\gunpoint\code\gunpoint.dm" #include "modular_skyrat\modules\gunpoint\code\gunpoint_datum.dm" #include "modular_skyrat\modules\gunpoint\code\gunpoint_radial.dm" -#include "modular_skyrat\modules\gunsafety\code\gun_safety.dm" #include "modular_skyrat\modules\gunsgalore\code\projectile.dm" #include "modular_skyrat\modules\gunsgalore\code\ammo\ammo.dm" #include "modular_skyrat\modules\gunsgalore\code\guns\akm.dm" @@ -6087,6 +6082,8 @@ #include "modular_skyrat\modules\lorecaster\code\archive_viewer.dm" #include "modular_skyrat\modules\lorecaster\code\config.dm" #include "modular_skyrat\modules\lorecaster\code\subsystem.dm" +#include "modular_skyrat\modules\manufacturer_examine\code\gun_company_additions.dm" +#include "modular_skyrat\modules\manufacturer_examine\code\manufacturer_component.dm" #include "modular_skyrat\modules\mapping\code\airless.dm" #include "modular_skyrat\modules\mapping\code\color.dm" #include "modular_skyrat\modules\mapping\code\doors.dm" @@ -6383,6 +6380,7 @@ #include "modular_skyrat\modules\moretraitoritems\code\glue.dm" #include "modular_skyrat\modules\moretraitoritems\code\headset.dm" #include "modular_skyrat\modules\moretraitoritems\code\mafioso.dm" +#include "modular_skyrat\modules\moretraitoritems\code\ocelot_revolver.dm" #include "modular_skyrat\modules\moretraitoritems\code\smuggling_gear.dm" #include "modular_skyrat\modules\moretraitoritems\code\spawnergrenade.dm" #include "modular_skyrat\modules\moretraitoritems\code\syndicate_loadout.dm"