Ports Bay's railguns, and assorted gun sprites

This commit is contained in:
Anewbe
2017-10-02 17:29:24 -05:00
parent 54f9c858ac
commit a248a4a4a1
14 changed files with 473 additions and 5 deletions

View File

@@ -425,6 +425,24 @@
origin_tech = list(TECH_POWER = 1)
matter = list(DEFAULT_WALL_MATERIAL = 50,"glass" = 50)
var/charge = 0
var/max_charge = 1000
/obj/item/weapon/stock_parts/capacitor/New()
. = ..()
max_charge *= rating
/obj/item/weapon/stock_parts/capacitor/proc/charge(var/amount)
charge += amount
if(charge > max_charge)
charge = max_charge
/obj/item/weapon/stock_parts/capacitor/proc/use(var/amount)
if(charge)
charge -= amount
if(charge < 0)
charge = 0
/obj/item/weapon/stock_parts/scanning_module
name = "scanning module"
desc = "A compact, high resolution scanning module used in the construction of certain devices."

View File

@@ -17,6 +17,7 @@
matter = list(DEFAULT_WALL_MATERIAL = 50000)
var/datum/effect/effect/system/spark_spread/spark_system
var/stored_matter = 0
var/max_stored_matter = 30
var/working = 0
var/mode = 1
var/list/modes = list("Floor & Walls","Airlock","Deconstruct")
@@ -32,7 +33,7 @@
/obj/item/weapon/rcd/examine()
..()
if(src.type == /obj/item/weapon/rcd && loc == usr)
usr << "It currently holds [stored_matter]/30 matter-units."
usr << "It currently holds [stored_matter]/[max_stored_matter] matter-units."
/obj/item/weapon/rcd/New()
..()
@@ -48,14 +49,15 @@
/obj/item/weapon/rcd/attackby(obj/item/weapon/W, mob/user)
if(istype(W, /obj/item/weapon/rcd_ammo))
if((stored_matter + 10) > 30)
user << "<span class='notice'>The RCD can't hold any more matter-units.</span>"
var/obj/item/weapon/rcd_ammo/cartridge = W
if((stored_matter + cartridge.remaining) > max_stored_matter)
to_chat(user, "<span class='notice'>The RCD can't hold that many additional matter-units.</span>")
return
stored_matter += cartridge.remaining
user.drop_from_inventory(W)
qdel(W)
stored_matter += 10
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user << "<span class='notice'>The RCD now holds [stored_matter]/30 matter-units.</span>"
to_chat(user, "<span class='notice'>The RCD now holds [stored_matter]/[max_stored_matter] matter-units.</span>")
return
..()
@@ -164,6 +166,14 @@
w_class = ITEMSIZE_SMALL
origin_tech = list(TECH_MATERIAL = 2)
matter = list(DEFAULT_WALL_MATERIAL = 30000,"glass" = 15000)
var/remaining = 10
/obj/item/weapon/rcd_ammo/large
name = "high-capacity matter cartridge"
desc = "Do not ingest."
matter = list(DEFAULT_WALL_MATERIAL = 45000,"glass" = 22500)
remaining = 30
origin_tech = list(TECH_MATERIAL = 4)
/obj/item/weapon/rcd/borg
canRwall = 1

View File

@@ -135,6 +135,7 @@
recipes += new/datum/stack_recipe("book shelf", /obj/structure/bookcase, 5, time = 15, one_per_turf = 1, on_floor = 1)
recipes += new/datum/stack_recipe("noticeboard frame", /obj/item/frame/noticeboard, 4, time = 5, one_per_turf = 0, on_floor = 1)
recipes += new/datum/stack_recipe("wooden bucket", /obj/item/weapon/reagent_containers/glass/bucket/wood, 2, time = 4, one_per_turf = 0, on_floor = 0)
recipes += new/datum/stack_recipe("coilgun stock", /obj/item/weapon/coilgun_assembly, 5)
/material/cardboard/generate_recipes()
..()

View File

@@ -0,0 +1,13 @@
/obj/item/weapon/magnetic_ammo
name = "flechette magazine"
desc = "A magazine containing steel flechettes."
icon = 'icons/obj/ammo.dmi'
icon_state = "5.56"
w_class = ITEMSIZE_SMALL
matter = list(DEFAULT_WALL_MATERIAL = 1800)
origin_tech = list(TECH_COMBAT = 1)
var/remaining = 9
/obj/item/weapon/magnetic_ammo/examine(mob/user)
. = ..()
to_chat(user, "There [(remaining == 1)? "is" : "are"] [remaining] flechette\s left!")

View File

@@ -0,0 +1,195 @@
/obj/item/weapon/gun/magnetic
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?"
icon_state = "coilgun"
item_state = "coilgun"
icon = 'icons/obj/railgun.dmi'
// one_hand_penalty = 1
origin_tech = list(TECH_COMBAT = 5, TECH_MATERIAL = 4, TECH_ILLEGAL = 2, TECH_MAGNET = 4)
w_class = ITEMSIZE_LARGE
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/removable_components = TRUE // Whether or not the gun can be dismantled.
var/gun_unreliable = 15 // Percentage chance of detonating in your hands.
var/obj/item/loaded // Currently loaded object, for retrieval/unloading.
var/load_type = /obj/item/stack/rods // Type of stack to load with.
var/projectile_type = /obj/item/projectile/bullet/magnetic // Actual fire type, since this isn't throw_at rod launcher.
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.
fire_sound = 'sound/weapons/railgun.ogg'
/obj/item/weapon/gun/magnetic/New()
processing_objects.Add(src)
if(capacitor)
power_per_tick = (power_cost*0.15) * capacitor.rating
update_icon()
. = ..()
/obj/item/weapon/gun/magnetic/Destroy()
processing_objects.Remove(src)
qdel_null(cell)
qdel_null(loaded)
qdel_null(capacitor)
. = ..()
/obj/item/weapon/gun/magnetic/process()
if(capacitor)
if(cell)
if(capacitor.charge < capacitor.max_charge && cell.checked_use(power_per_tick))
capacitor.charge(power_per_tick)
else
capacitor.use(capacitor.charge * 0.05)
update_icon()
/obj/item/weapon/gun/magnetic/update_icon()
var/list/overlays_to_add = list()
if(removable_components)
if(cell)
overlays_to_add += image(icon, "[icon_state]_cell")
if(capacitor)
overlays_to_add += image(icon, "[icon_state]_capacitor")
if(!cell || !capacitor)
overlays_to_add += image(icon, "[icon_state]_red")
else if(capacitor.charge < power_cost)
overlays_to_add += image(icon, "[icon_state]_amber")
else
overlays_to_add += image(icon, "[icon_state]_green")
if(loaded)
overlays_to_add += image(icon, "[icon_state]_loaded")
overlays = overlays_to_add
..()
/obj/item/weapon/gun/magnetic/proc/show_ammo(var/mob/user)
if(loaded)
to_chat(user, "<span class='notice'>It has \a [loaded] loaded.</span>")
/obj/item/weapon/gun/magnetic/examine(var/mob/user)
. = ..(user, 2)
if(.)
show_ammo(user)
if(cell)
to_chat(user, "<span class='notice'>The installed [cell.name] has a charge level of [round((cell.charge/cell.maxcharge)*100)]%.</span>")
if(capacitor)
to_chat(user, "<span class='notice'>The installed [capacitor.name] has a charge level of [round((capacitor.charge/capacitor.max_charge)*100)]%.</span>")
if(!cell || !capacitor)
to_chat(user, "<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
if(capacitor.charge < power_cost)
to_chat(user, "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_ORANGE]'>amber</font>.</span>")
else
to_chat(user, "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_GREEN]'>green</font>.</span>")
return TRUE
/obj/item/weapon/gun/magnetic/attackby(var/obj/item/thing, var/mob/user)
if(removable_components)
if(istype(thing, /obj/item/weapon/cell))
if(cell)
to_chat(user, "<span class='warning'>\The [src] already has \a [cell] installed.</span>")
return
cell = thing
user.drop_from_inventory(cell)
cell.forceMove(src)
playsound(loc, 'sound/machines/click.ogg', 10, 1)
user.visible_message("<span class='notice'>\The [user] slots \the [cell] into \the [src].</span>")
update_icon()
return
if(isscrewdriver(thing))
if(!capacitor)
to_chat(user, "<span class='warning'>\The [src] has no capacitor installed.</span>")
return
capacitor.forceMove(get_turf(src))
user.put_in_hands(capacitor)
user.visible_message("<span class='notice'>\The [user] unscrews \the [capacitor] from \the [src].</span>")
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
capacitor = null
update_icon()
return
if(istype(thing, /obj/item/weapon/stock_parts/capacitor))
if(capacitor)
to_chat(user, "<span class='warning'>\The [src] already has \a [capacitor] installed.</span>")
return
capacitor = thing
user.drop_from_inventory(capacitor)
capacitor.forceMove(src)
playsound(loc, 'sound/machines/click.ogg', 10, 1)
power_per_tick = (power_cost*0.15) * capacitor.rating
user.visible_message("<span class='notice'>\The [user] slots \the [capacitor] into \the [src].</span>")
update_icon()
return
if(istype(thing, load_type))
if(loaded)
to_chat(user, "<span class='warning'>\The [src] already has \a [loaded] loaded.</span>")
return
// This is not strictly necessary for the magnetic gun but something using
// specific ammo types may exist down the track.
var/obj/item/stack/ammo = thing
if(!istype(ammo))
loaded = thing
user.drop_from_inventory(thing)
thing.forceMove(src)
else
loaded = new load_type(src, 1)
ammo.use(1)
user.visible_message("<span class='notice'>\The [user] loads \the [src] with \the [loaded].</span>")
playsound(loc, 'sound/weapons/flipblade.ogg', 50, 1)
update_icon()
return
. = ..()
/obj/item/weapon/gun/magnetic/attack_hand(var/mob/user)
if(user.get_inactive_hand() == src)
var/obj/item/removing
if(loaded)
removing = loaded
loaded = null
else if(cell && removable_components)
removing = cell
cell = null
if(removing)
removing.forceMove(get_turf(src))
user.put_in_hands(removing)
user.visible_message("<span class='notice'>\The [user] removes \the [removing] from \the [src].</span>")
playsound(loc, 'sound/machines/click.ogg', 10, 1)
update_icon()
return
. = ..()
/obj/item/weapon/gun/magnetic/proc/check_ammo()
return loaded
/obj/item/weapon/gun/magnetic/proc/use_ammo()
qdel(loaded)
loaded = null
/obj/item/weapon/gun/magnetic/consume_next_projectile()
if(!check_ammo() || !capacitor || capacitor.charge < power_cost)
return
use_ammo()
capacitor.use(power_cost)
update_icon()
if(gun_unreliable && prob(gun_unreliable))
spawn(3) // So that it will still fire - considered modifying Fire() to return a value but burst fire makes that annoying.
visible_message("<span class='danger'>\The [src] explodes with the force of the shot!</span>")
explosion(get_turf(src), -1, 0, 2)
qdel(src)
return new projectile_type(src)

View File

@@ -0,0 +1,101 @@
// We really need some datums for this.
/obj/item/weapon/coilgun_assembly
name = "coilgun stock"
desc = "It might be a coilgun, someday."
icon = 'icons/obj/coilgun.dmi'
icon_state = "coilgun_construction_1"
var/construction_stage = 1
/obj/item/weapon/coilgun_assembly/attackby(var/obj/item/thing, var/mob/user)
if(istype(thing, /obj/item/stack/material) && construction_stage == 1)
var/obj/item/stack/material/reinforcing = thing
var/material/reinforcing_with = reinforcing.get_material()
if(reinforcing_with.name == DEFAULT_WALL_MATERIAL) // Steel
if(reinforcing.get_amount() < 5)
to_chat(user, "<span class='warning'>You need at least 5 [reinforcing.singular_name]\s for this task.</span>")
return
reinforcing.use(5)
user.visible_message("<span class='notice'>\The [user] shapes some steel sheets around \the [src] to form a body.</span>")
increment_construction_stage()
return
if(istype(thing, /obj/item/weapon/tape_roll) && construction_stage == 2)
user.visible_message("<span class='notice'>\The [user] secures \the [src] together with \the [thing].</span>")
increment_construction_stage()
return
if(istype(thing, /obj/item/pipe) && construction_stage == 3)
user.drop_from_inventory(thing)
qdel(thing)
user.visible_message("<span class='notice'>\The [user] jams \the [thing] into \the [src].</span>")
increment_construction_stage()
return
if(istype(thing, /obj/item/weapon/weldingtool) && construction_stage == 4)
var/obj/item/weapon/weldingtool/welder = thing
if(!welder.isOn())
to_chat(user, "<span class='warning'>Turn it on first!</span>")
return
if(!welder.remove_fuel(0,user))
to_chat(user, "<span class='warning'>You need more fuel!</span>")
return
user.visible_message("<span class='notice'>\The [user] welds the barrel of \the [src] into place.</span>")
playsound(src.loc, 'sound/items/Welder2.ogg', 100, 1)
increment_construction_stage()
return
if(istype(thing, /obj/item/stack/cable_coil) && construction_stage == 5)
var/obj/item/stack/cable_coil/cable = thing
if(cable.get_amount() < 5)
to_chat(user, "<span class='warning'>You need at least 5 lengths of cable for this task.</span>")
return
cable.use(5)
user.visible_message("<span class='notice'>\The [user] wires \the [src].</span>")
increment_construction_stage()
return
if(istype(thing, /obj/item/weapon/smes_coil) && construction_stage >= 6 && construction_stage <= 8)
user.visible_message("<span class='notice'>\The [user] installs \a [thing] into \the [src].</span>")
user.drop_from_inventory(thing)
qdel(thing)
increment_construction_stage()
return
if(isscrewdriver(thing) && construction_stage >= 9)
user.visible_message("<span class='notice'>\The [user] secures \the [src] and finishes it off.</span>")
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
var/obj/item/weapon/gun/magnetic/coilgun = new(loc)
var/put_in_hands
var/mob/M = src.loc
if(istype(M))
put_in_hands = M == user
M.drop_from_inventory(src)
if(put_in_hands)
user.put_in_hands(coilgun)
qdel(src)
return
return ..()
/obj/item/weapon/coilgun_assembly/proc/increment_construction_stage()
if(construction_stage < 9)
construction_stage++
icon_state = "coilgun_construction_[construction_stage]"
/obj/item/weapon/coilgun_assembly/examine(var/mob/user)
. = ..(user,2)
if(.)
switch(construction_stage)
if(2) to_chat(user, "<span class='notice'>It has a metal frame loosely shaped around the stock.</span>")
if(3) to_chat(user, "<span class='notice'>It has a metal frame duct-taped to the stock.</span>")
if(4) to_chat(user, "<span class='notice'>It has a length of pipe attached to the body.</span>")
if(4) to_chat(user, "<span class='notice'>It has a length of pipe welded to the body.</span>")
if(6) to_chat(user, "<span class='notice'>It has a cable mount and capacitor jack wired to the frame.</span>")
if(7) to_chat(user, "<span class='notice'>It has a single superconducting coil threaded onto the barrel.</span>")
if(8) to_chat(user, "<span class='notice'>It has a pair of superconducting coils threaded onto the barrel.</span>")
if(9) to_chat(user, "<span class='notice'>It has three superconducting coils attached to the body, waiting to be secured.</span>")

View File

@@ -0,0 +1,104 @@
/obj/item/weapon/gun/magnetic/railgun
name = "railgun"
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
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)
projectile_type = /obj/item/projectile/bullet/magnetic/slug
power_cost = 300
w_class = ITEMSIZE_HUGE
slot_flags = SLOT_BELT
loaded = /obj/item/weapon/rcd_ammo/large
var/initial_cell_type = /obj/item/weapon/cell/hyper
var/initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor/adv
var/slowdown_held = 2
var/slowdown_worn = 1
/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
// load_type and get runtime errors, don't come crying to me.
/obj/item/weapon/gun/magnetic/railgun/show_ammo(var/mob/user)
var/obj/item/weapon/rcd_ammo/ammo = loaded
if (ammo)
to_chat(user, "<span class='notice'>There are [ammo.remaining] shot\s remaining in \the [loaded].</span>")
else
to_chat(user, "<span class='notice'>There is nothing loaded.</span>")
/obj/item/weapon/gun/magnetic/railgun/check_ammo()
var/obj/item/weapon/rcd_ammo/ammo = loaded
return ammo && ammo.remaining
/obj/item/weapon/gun/magnetic/railgun/use_ammo()
var/obj/item/weapon/rcd_ammo/ammo = loaded
ammo.remaining--
if(ammo.remaining <= 0)
spawn(3)
playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1)
out_of_ammo()
/obj/item/weapon/gun/magnetic/railgun/proc/out_of_ammo()
qdel(loaded)
loaded = null
visible_message("<span class='warning'>\The [src] beeps and ejects its empty cartridge.</span>")
/obj/item/weapon/gun/magnetic/railgun/automatic // Adminspawn only, this shit is absurd.
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."
icon_state = "heavy_railgun"
initial_cell_type = /obj/item/weapon/cell/infinite
initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor/super
slowdown_held = 3
slowdown_worn = 2
slot_flags = SLOT_BACK
w_class = ITEMSIZE_NO_CONTAINER
firemodes = list(
list(mode_name="semiauto", burst=1, fire_delay=0, move_delay=null, one_hand_penalty=1, burst_accuracy=null, dispersion=null),
list(mode_name="short bursts", burst=3, fire_delay=null, move_delay=5, one_hand_penalty=2, burst_accuracy=list(0,-1,-1), dispersion=list(0.0, 0.6, 1.0)),
list(mode_name="long bursts", burst=6, fire_delay=null, move_delay=10, one_hand_penalty=2, burst_accuracy=list(0,-1,-1,-1,-2), dispersion=list(0.6, 0.6, 1.0, 1.0, 1.2)),
)
/obj/item/weapon/gun/magnetic/railgun/automatic/examine(var/mob/user)
. = ..(user,1)
if(.)
to_chat(user, "<span class='notice'>Someone has scratched <i>Ultima Ratio Regum</i> onto the side of the barrel.</span>")
/obj/item/weapon/gun/magnetic/railgun/flechette
name = "flechette gun"
desc = "The MI-12 Skadi is a burst fire capable railgun that fires flechette rounds at high velocity. Deadly against armour, but much less effective against soft targets."
icon_state = "flechette_gun"
item_state = "z8carbine"
initial_cell_type = /obj/item/weapon/cell/hyper
initial_capacitor_type = /obj/item/weapon/stock_parts/capacitor/adv
slot_flags = SLOT_BACK
slowdown_held = 0
slowdown_worn = 0
power_cost = 100
load_type = /obj/item/weapon/magnetic_ammo
projectile_type = /obj/item/projectile/bullet/magnetic/flechette
loaded = /obj/item/weapon/magnetic_ammo
fire_sound = 'sound/weapons/rapidslice.ogg'
firemodes = list(
list(mode_name="semiauto", burst=1, fire_delay=0, move_delay=null, one_hand_penalty=1, burst_accuracy=null, dispersion=null),
list(mode_name="short bursts", burst=3, fire_delay=null, move_delay=5, one_hand_penalty=2, burst_accuracy=list(0,-1,-1), dispersion=list(0.0, 0.6, 1.0)),
)
/obj/item/weapon/gun/magnetic/railgun/flechette/out_of_ammo()
audible_message("<span class='warning'>\The [src] beeps to indicate the magazine is empty.</span>")
playsound(loc, 'sound/weapons/smg_empty_alarm.ogg', 40, 1)
..()

View File

@@ -0,0 +1,21 @@
// Rod for railguns. Slightly less nasty than the sniper round.
/obj/item/projectile/bullet/magnetic
name = "rod"
icon_state = "rod"
damage = 65
stun = 1
weaken = 1
penetrating = 5
armor_penetration = 70
/obj/item/projectile/bullet/magnetic/slug
name = "slug"
icon_state = "gauss_silenced"
damage = 75
armor_penetration = 90
/obj/item/projectile/bullet/magnetic/flechette
name = "flechette"
icon_state = "flechette"
damage = 20
armor_penetration = 100

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 57 KiB

BIN
icons/obj/coilgun.dmi Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

BIN
icons/obj/railgun.dmi Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1942,6 +1942,7 @@
#include "code\modules\projectiles\gun.dm"
#include "code\modules\projectiles\projectile.dm"
#include "code\modules\projectiles\ammunition\magazines.dm"
#include "code\modules\projectiles\ammunition\magnetic.dm"
#include "code\modules\projectiles\ammunition\rounds.dm"
#include "code\modules\projectiles\guns\energy.dm"
#include "code\modules\projectiles\guns\launcher.dm"
@@ -1958,6 +1959,9 @@
#include "code\modules\projectiles\guns\launcher\pneumatic.dm"
#include "code\modules\projectiles\guns\launcher\rocket.dm"
#include "code\modules\projectiles\guns\launcher\syringe_gun.dm"
#include "code\modules\projectiles\guns\magnetic\magnetic.dm"
#include "code\modules\projectiles\guns\magnetic\magnetic_construction.dm"
#include "code\modules\projectiles\guns\magnetic\magnetic_railgun.dm"
#include "code\modules\projectiles\guns\projectile\automatic.dm"
#include "code\modules\projectiles\guns\projectile\boltaction.dm"
#include "code\modules\projectiles\guns\projectile\contender.dm"
@@ -1974,6 +1978,7 @@
#include "code\modules\projectiles\projectile\change.dm"
#include "code\modules\projectiles\projectile\energy.dm"
#include "code\modules\projectiles\projectile\force.dm"
#include "code\modules\projectiles\projectile\magnetic.dm"
#include "code\modules\projectiles\projectile\special.dm"
#include "code\modules\projectiles\targeting\targeting_client.dm"
#include "code\modules\projectiles\targeting\targeting_gun.dm"

BIN
sound/weapons/railgun.ogg Normal file

Binary file not shown.