Tweak railguns, add flechette pistol

This commit is contained in:
Aronai Sieyes
2020-05-28 16:49:14 -04:00
parent 767ab7bca2
commit 24b0e3f3c4
8 changed files with 141 additions and 44 deletions

View File

@@ -2,7 +2,7 @@
name = "flechette magazine" name = "flechette magazine"
desc = "A magazine containing steel flechettes." desc = "A magazine containing steel flechettes."
icon = 'icons/obj/ammo.dmi' icon = 'icons/obj/ammo.dmi'
icon_state = "5.56" icon_state = "caseless-mag"
w_class = ITEMSIZE_SMALL w_class = ITEMSIZE_SMALL
matter = list(DEFAULT_WALL_MATERIAL = 1800) matter = list(DEFAULT_WALL_MATERIAL = 1800)
origin_tech = list(TECH_COMBAT = 1) origin_tech = list(TECH_COMBAT = 1)
@@ -11,4 +11,9 @@
/obj/item/weapon/magnetic_ammo/examine(mob/user) /obj/item/weapon/magnetic_ammo/examine(mob/user)
. = ..() . = ..()
. += "There [(remaining == 1)? "is" : "are"] [remaining] flechette\s left!" . += "There [(remaining == 1)? "is" : "are"] [remaining] flechette\s left!"
/obj/item/weapon/magnetic_ammo/pistol
name = "flechette magazine (small)"
desc = "A magazine containing smaller steel flechettes, intended for a pistol."
icon_state = "caseless-mag-short"

View File

@@ -1,3 +1,10 @@
#define ICON_CELL 1
#define ICON_CAP 2
#define ICON_BAD 4
#define ICON_CHARGE 8
#define ICON_READY 16
#define ICON_LOADED 32
/obj/item/weapon/gun/magnetic /obj/item/weapon/gun/magnetic
name = "improvised coilgun" name = "improvised coilgun"
desc = "A coilgun hastily thrown together out of a basic frame and advanced power storage components. Is it safe for it to be duct-taped together like that?" desc = "A coilgun hastily thrown together out of a basic frame and advanced power storage components. Is it safe for it to be duct-taped together like that?"
@@ -9,8 +16,8 @@
w_class = ITEMSIZE_LARGE w_class = ITEMSIZE_LARGE
var/obj/item/weapon/cell/cell // Currently installed powercell. var/obj/item/weapon/cell/cell // Currently installed powercell.
var/obj/item/weapon/stock_parts/capacitor/capacitor // Installed capacitor. Higher rating == faster charge between shots. var/obj/item/weapon/stock_parts/capacitor/capacitor // Installed capacitor. Higher rating == faster charge between shots. Set to a path to spawn with one of that type.
var/obj/item/weapon/stock_parts/manipulator/manipulator // Installed manipulator. Mostly for Phoron Bore, higher rating == less mats consumed upon firing var/obj/item/weapon/stock_parts/manipulator/manipulator // Installed manipulator. Mostly for Phoron Bore, higher rating == less mats consumed upon firing. Set to a path to spawn with one of that type.
var/removable_components = TRUE // Whether or not the gun can be dismantled. var/removable_components = TRUE // Whether or not the gun can be dismantled.
var/gun_unreliable = 15 // Percentage chance of detonating in your hands. var/gun_unreliable = 15 // Percentage chance of detonating in your hands.
@@ -21,18 +28,34 @@
var/power_cost = 950 // Cost per fire, should consume almost an entire basic cell. var/power_cost = 950 // Cost per fire, should consume almost an entire basic cell.
var/power_per_tick // Capacitor charge per process(). Updated based on capacitor rating. var/power_per_tick // Capacitor charge per process(). Updated based on capacitor rating.
/obj/item/weapon/gun/magnetic/New() var/state = 0
/obj/item/weapon/gun/magnetic/Initialize()
. = ..()
// So you can have some spawn with components
if(ispath(cell))
cell = new cell(src)
if(ispath(capacitor))
capacitor = new capacitor(src)
capacitor.charge = capacitor.max_charge
if(ispath(manipulator))
manipulator = new manipulator(src)
if(ispath(loaded))
loaded = new loaded(src)
START_PROCESSING(SSobj, src) START_PROCESSING(SSobj, src)
if(capacitor) if(capacitor)
power_per_tick = (power_cost*0.15) * capacitor.rating power_per_tick = (power_cost*0.15) * capacitor.rating
update_icon() update_icon()
. = ..()
/obj/item/weapon/gun/magnetic/Destroy() /obj/item/weapon/gun/magnetic/Destroy()
STOP_PROCESSING(SSobj, src) STOP_PROCESSING(SSobj, src)
QDEL_NULL(cell) QDEL_NULL(cell)
QDEL_NULL(loaded) QDEL_NULL(loaded)
QDEL_NULL(capacitor) QDEL_NULL(capacitor)
QDEL_NULL(manipulator)
. = ..() . = ..()
/obj/item/weapon/gun/magnetic/get_cell() /obj/item/weapon/gun/magnetic/get_cell()
@@ -45,25 +68,56 @@
capacitor.charge(power_per_tick) capacitor.charge(power_per_tick)
else else
capacitor.use(capacitor.charge * 0.05) capacitor.use(capacitor.charge * 0.05)
update_icon()
update_state() // May update icon, only if things changed.
/obj/item/weapon/gun/magnetic/update_icon() /obj/item/weapon/gun/magnetic/proc/update_state()
var/list/overlays_to_add = list() var/newstate = 0
// Parts or lack thereof
if(removable_components) if(removable_components)
if(cell) if(cell)
overlays_to_add += image(icon, "[icon_state]_cell") newstate |= ICON_CELL
if(capacitor) if(capacitor)
overlays_to_add += image(icon, "[icon_state]_capacitor") newstate |= ICON_CAP
// Functional state
if(!cell || !capacitor) if(!cell || !capacitor)
overlays_to_add += image(icon, "[icon_state]_red") newstate |= ICON_BAD
else if(capacitor.charge < power_cost) else if(capacitor.charge < power_cost)
overlays_to_add += image(icon, "[icon_state]_amber") newstate |= ICON_CHARGE
else else
overlays_to_add += image(icon, "[icon_state]_green") newstate |= ICON_READY
// Ammo indicator
if(loaded) if(loaded)
overlays_to_add += image(icon, "[icon_state]_loaded") newstate |= ICON_LOADED
// Only update if the state has changed
var/needs_update = FALSE
if(state != newstate)
needs_update = TRUE
state = newstate
if(needs_update)
update_icon()
/obj/item/weapon/gun/magnetic/update_icon()
cut_overlays()
if(state & ICON_CELL)
add_overlay("[icon_state]_cell")
if(state & ICON_CAP)
add_overlay("[icon_state]_capacitor")
if(state & ICON_BAD)
add_overlay("[icon_state]_red")
if(state & ICON_CHARGE)
add_overlay("[icon_state]_amber")
if(state & ICON_READY)
add_overlay("[icon_state]_green")
if(state & ICON_LOADED)
add_overlay("[icon_state]_loaded")
overlays = overlays_to_add
..() ..()
/obj/item/weapon/gun/magnetic/proc/show_ammo() /obj/item/weapon/gun/magnetic/proc/show_ammo()
@@ -83,10 +137,10 @@
if(capacitor) if(capacitor)
. += "<span class='notice'>The installed [capacitor.name] has a charge level of [round((capacitor.charge/capacitor.max_charge)*100)]%.</span>" . += "<span class='notice'>The installed [capacitor.name] has a charge level of [round((capacitor.charge/capacitor.max_charge)*100)]%.</span>"
if(!cell || !capacitor) if(state & ICON_BAD)
. += "<span class='notice'>The capacitor charge indicator is blinking <font color ='[COLOR_RED]'>red</font>. Maybe you should check the cell or capacitor.</span>" . += "<span class='notice'>The capacitor charge indicator is blinking <font color ='[COLOR_RED]'>red</font>. Maybe you should check the cell or capacitor.</span>"
else else
if(capacitor.charge < power_cost) if(state & ICON_CHARGE)
. += "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_ORANGE]'>amber</font>.</span>" . += "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_ORANGE]'>amber</font>.</span>"
else else
. += "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_GREEN]'>green</font>.</span>" . += "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_GREEN]'>green</font>.</span>"
@@ -260,3 +314,10 @@
cell = new /obj/item/weapon/cell/high cell = new /obj/item/weapon/cell/high
capacitor = new /obj/item/weapon/stock_parts/capacitor capacitor = new /obj/item/weapon/stock_parts/capacitor
. = ..() . = ..()
#undef ICON_CELL
#undef ICON_CAP
#undef ICON_BAD
#undef ICON_CHARGE
#undef ICON_READY
#undef ICON_LOADED

View File

@@ -3,32 +3,25 @@
desc = "The Mars Military Industries MI-76 Thunderclap. A man-portable mass driver for squad support anti-armour and destruction of fortifications and emplacements." desc = "The Mars Military Industries MI-76 Thunderclap. A man-portable mass driver for squad support anti-armour and destruction of fortifications and emplacements."
gun_unreliable = 0 gun_unreliable = 0
icon_state = "railgun" icon_state = "railgun"
removable_components = FALSE
load_type = /obj/item/weapon/rcd_ammo
origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 4, TECH_MAGNET = 4) origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 4, TECH_MAGNET = 4)
projectile_type = /obj/item/projectile/bullet/magnetic/slug
power_cost = 300 power_cost = 300
w_class = ITEMSIZE_HUGE w_class = ITEMSIZE_HUGE
slot_flags = SLOT_BELT slot_flags = SLOT_BELT
loaded = /obj/item/weapon/rcd_ammo/large
slowdown = 1 // Slowdown equals slowdown_worn, until we decide to import the system to differentiate between held and worn items slowdown = 1 // Slowdown equals slowdown_worn, until we decide to import the system to differentiate between held and worn items
fire_delay = 1 fire_delay = 1
var/initial_cell_type = /obj/item/weapon/cell/hyper load_type = /obj/item/weapon/rcd_ammo
var/initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor/adv projectile_type = /obj/item/projectile/bullet/magnetic/slug
cell = /obj/item/weapon/cell/hyper
capacitor = /obj/item/weapon/stock_parts/capacitor/adv
loaded = /obj/item/weapon/rcd_ammo/large
removable_components = FALSE
var/slowdown_held = 2 var/slowdown_held = 2
var/slowdown_worn = 1 var/slowdown_worn = 1
var/empty_sound = 'sound/machines/twobeep.ogg' var/empty_sound = 'sound/machines/twobeep.ogg'
/obj/item/weapon/gun/magnetic/railgun/New()
capacitor = new initial_capacitor_type(src)
capacitor.charge = capacitor.max_charge
cell = new initial_cell_type(src)
if (ispath(loaded))
loaded = new loaded
. = ..()
// Not going to check type repeatedly, if you code or varedit // Not going to check type repeatedly, if you code or varedit
// load_type and get runtime errors, don't come crying to me. // load_type and get runtime errors, don't come crying to me.
/obj/item/weapon/gun/magnetic/railgun/show_ammo() /obj/item/weapon/gun/magnetic/railgun/show_ammo()
@@ -52,15 +45,16 @@
loaded.forceMove(get_turf(src)) loaded.forceMove(get_turf(src))
loaded = null loaded = null
visible_message("<span class='warning'>\The [src] beeps and ejects its empty cartridge.</span>","<span class='warning'>There's a beeping sound!</span>") visible_message("<span class='warning'>\The [src] beeps and ejects its empty cartridge.</span>","<span class='warning'>There's a beeping sound!</span>")
playsound(get_turf(src), empty_sound, 40, 1) playsound(src, empty_sound, 40, 1)
update_state()
/obj/item/weapon/gun/magnetic/railgun/automatic // Adminspawn only, this shit is absurd. /obj/item/weapon/gun/magnetic/railgun/automatic // Adminspawn only, this shit is absurd.
name = "\improper RHR accelerator" name = "\improper RHR accelerator"
desc = "The Mars Military Industries MI-227 Meteor. Originally a vehicle-mounted turret weapon for heavy anti-vehicular and anti-structural fire, the fact that it was made man-portable is mindboggling in itself." desc = "The Mars Military Industries MI-227 Meteor. Originally a vehicle-mounted turret weapon for heavy anti-vehicular and anti-structural fire, the fact that it was made man-portable is mindboggling in itself."
icon_state = "heavy_railgun" icon_state = "heavy_railgun"
initial_cell_type = /obj/item/weapon/cell/infinite cell = /obj/item/weapon/cell/infinite
initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor/super capacitor = /obj/item/weapon/stock_parts/capacitor/super
fire_delay = 0 fire_delay = 0
slowdown = 2 slowdown = 2
@@ -87,8 +81,8 @@
icon_state = "flechette_gun" icon_state = "flechette_gun"
item_state = "z8carbine" item_state = "z8carbine"
initial_cell_type = /obj/item/weapon/cell/hyper cell = /obj/item/weapon/cell/hyper
initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor/adv capacitor = /obj/item/weapon/stock_parts/capacitor/adv
fire_delay = 0 fire_delay = 0
@@ -109,6 +103,36 @@
list(mode_name="short bursts", burst=3, fire_delay=null, move_delay=5, one_handed_penalty=30, burst_accuracy=list(0,-15,-15), dispersion=list(0.0, 0.6, 1.0)), list(mode_name="short bursts", burst=3, fire_delay=null, move_delay=5, one_handed_penalty=30, burst_accuracy=list(0,-15,-15), dispersion=list(0.0, 0.6, 1.0)),
) )
/obj/item/weapon/gun/magnetic/railgun/flechette/pistol
name = "flechette pistol"
desc = "The MI-6a Ullr is a small-form-factor railgun that fires flechette rounds at high velocity. Deadly against armour, but much less effective against soft targets."
icon_state = "railpistol"
item_state = "combatrevolver"
w_class = ITEMSIZE_SMALL
cell = /obj/item/weapon/cell/super
capacitor = /obj/item/weapon/stock_parts/capacitor
fire_delay = 0
slot_flags = SLOT_BELT
slowdown = 0
slowdown_held = 0
slowdown_worn = 0
power_cost = 100
load_type = /obj/item/weapon/magnetic_ammo/pistol
projectile_type = /obj/item/projectile/bullet/magnetic/flechette/small
loaded = /obj/item/weapon/magnetic_ammo/pistol
removable_components = TRUE
empty_sound = 'sound/weapons/smg_empty_alarm.ogg'
firemodes = list(
list(mode_name="semiauto", burst=1, fire_delay=0, move_delay=null, one_handed_penalty=15, burst_accuracy=null, dispersion=null),
list(mode_name="short bursts", burst=3, fire_delay=null, move_delay=5, one_handed_penalty=30, burst_accuracy=list(0,-15,-15), dispersion=list(0.0, 0.6, 1.0)),
)
/obj/item/weapon/gun/magnetic/railgun/heater /obj/item/weapon/gun/magnetic/railgun/heater
name = "coil rifle" name = "coil rifle"
desc = "A large rifle designed and produced after the Grey Hour." desc = "A large rifle designed and produced after the Grey Hour."
@@ -119,8 +143,8 @@
removable_components = TRUE removable_components = TRUE
initial_cell_type = /obj/item/weapon/cell/device/weapon cell = /obj/item/weapon/cell/device/weapon
initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor capacitor = /obj/item/weapon/stock_parts/capacitor
fire_delay = 8 fire_delay = 8
@@ -152,8 +176,8 @@
slowdown_held = 0.1 slowdown_held = 0.1
initial_cell_type = /obj/item/weapon/cell/device/weapon cell = /obj/item/weapon/cell/device/weapon
initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor capacitor = /obj/item/weapon/stock_parts/capacitor
slot_flags = SLOT_BELT|SLOT_HOLSTER slot_flags = SLOT_BELT|SLOT_HOLSTER
@@ -181,8 +205,8 @@
icon_state = "railgun_sifguard" icon_state = "railgun_sifguard"
item_state = "z8carbine" item_state = "z8carbine"
initial_cell_type = /obj/item/weapon/cell/high cell = /obj/item/weapon/cell/high
initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor/adv capacitor = /obj/item/weapon/stock_parts/capacitor/adv
slot_flags = SLOT_BACK slot_flags = SLOT_BACK

View File

@@ -22,6 +22,13 @@
damage = 20 damage = 20
armor_penetration = 100 armor_penetration = 100
/obj/item/projectile/bullet/magnetic/flechette/small
name = "small flechette"
icon_state = "flechette"
fire_sound = 'sound/weapons/rapidslice.ogg'
damage = 12
armor_penetration = 100
/obj/item/projectile/bullet/magnetic/flechette/hunting /obj/item/projectile/bullet/magnetic/flechette/hunting
name = "shredder slug" name = "shredder slug"
armor_penetration = 30 armor_penetration = 30

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 10 KiB