Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular firearms - MFCS #186

Open
wants to merge 108 commits into
base: A-Dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
41b4900
Added the framework files for components
BlueNexus Sep 1, 2015
d30ca17
Added the different chambers
BlueNexus Sep 1, 2015
02a92fb
WIP Modular firearm code
BlueNexus Sep 2, 2015
89fb5a8
Changed allowed_projectiles to use caliber
BlueNexus Sep 2, 2015
beff2c1
Removed a stray piece of text
BlueNexus Sep 2, 2015
e758421
Moved projectile type into chamber/
BlueNexus Sep 2, 2015
3736e6e
Placeholder code for drivers
BlueNexus Sep 2, 2015
88e27ea
Placeholder drivers to work with
BlueNexus Sep 3, 2015
030e0e9
Assembly driver code.
BlueNexus Sep 3, 2015
5ffda2b
Adds a debug check
BlueNexus Sep 3, 2015
c9cb2c9
Duplicate definition fix
BlueNexus Sep 3, 2015
a82602c
Reworked driver firemodes
BlueNexus Sep 4, 2015
6f4dcd8
Reworked driver firemodes
BlueNexus Sep 4, 2015
18b5525
Added loaders
BlueNexus Sep 4, 2015
78258d9
Moved the C.shell under shell
BlueNexus Sep 4, 2015
7d7c46d
Added loaders, and commenting
BlueNexus Sep 4, 2015
53a221b
Quick patch
BlueNexus Sep 4, 2015
0433753
Will test travis
BlueNexus Sep 4, 2015
1d7bfe4
Revert
BlueNexus Sep 4, 2015
c72ac08
Create energy.dm
BlueNexus Sep 4, 2015
93cc95c
Create automatic
BlueNexus Sep 4, 2015
aa43d17
Create shotgun.dm
BlueNexus Sep 4, 2015
2a6ac61
Rename automatic to automatic.dm
BlueNexus Sep 4, 2015
4453824
Create sniper.dm
BlueNexus Sep 4, 2015
9874a98
Create pistol.dm
BlueNexus Sep 4, 2015
4029a0d
Delete energy.dm
BlueNexus Sep 4, 2015
b704897
Create beam.dm
BlueNexus Sep 4, 2015
8829218
Create special.dm
BlueNexus Sep 4, 2015
be91923
Create nuclear.dm
BlueNexus Sep 4, 2015
a9eba36
Create dart.dm
BlueNexus Sep 4, 2015
6223b8c
Added energy loaders
BlueNexus Sep 4, 2015
17b8dac
Var refactor
BlueNexus Sep 4, 2015
8c03525
Removed obsolete code
BlueNexus Sep 4, 2015
09a27fb
Wiped core.dm, different purpose
BlueNexus Sep 4, 2015
44b88b5
Continue fix
BlueNexus Sep 4, 2015
63dff89
Var fix
BlueNexus Sep 4, 2015
b34ca80
Major component refactor
BlueNexus Sep 7, 2015
1c50499
Further refactor
BlueNexus Sep 7, 2015
7e05091
Removed unnecessary vars
BlueNexus Sep 7, 2015
66a44c2
Cleaning up code
BlueNexus Sep 7, 2015
6fd2b09
Moved procs into core
BlueNexus Sep 7, 2015
d95fb53
Moved procs into core
BlueNexus Sep 7, 2015
c486d7a
Added testing SRC's
BlueNexus Sep 7, 2015
a3aa64d
Added barrels
BlueNexus Sep 7, 2015
c81005f
Added some +fun barrels
BlueNexus Sep 7, 2015
a3079e2
Added barrel handling to core
BlueNexus Sep 7, 2015
4ab2c73
Added stocks
BlueNexus Sep 7, 2015
21bc19c
Comments
BlueNexus Sep 7, 2015
a7ffae9
Fixed a compile error
BlueNexus Sep 7, 2015
cb4e064
Small fix
BlueNexus Sep 8, 2015
bbdf5a0
Small fix
BlueNexus Sep 8, 2015
14e94b2
Fixed assemblies eating parts
BlueNexus Sep 8, 2015
dbb1928
Added assembly handling for sights and stocks
BlueNexus Sep 8, 2015
8ba16d8
Added a var for error handling
BlueNexus Sep 8, 2015
b54d692
Refactored failure messages
BlueNexus Sep 8, 2015
b76bff1
Refactored failure messages and a minor fix
BlueNexus Sep 8, 2015
b7354c7
Glorious refactoring
BlueNexus Sep 8, 2015
1c3728a
Even more refactoring
BlueNexus Sep 8, 2015
c3abd3a
Fixed the refactor
BlueNexus Sep 8, 2015
0439f1e
Fixed errors not returning
BlueNexus Sep 8, 2015
0c18091
Cleaned up code, framework for decon
BlueNexus Sep 8, 2015
8ce8a7b
Removed unnecessary vars
BlueNexus Sep 8, 2015
f0e7197
Added a list
BlueNexus Sep 8, 2015
65a84cc
Added a part removal proc
BlueNexus Sep 8, 2015
9e2497a
Part removal update
BlueNexus Sep 8, 2015
49e0eb0
Hopeful compile fix
BlueNexus Sep 8, 2015
77c267f
Added attachment handling to disassembly
BlueNexus Sep 9, 2015
eb51a8d
Added charge costs
BlueNexus Sep 11, 2015
ac914ef
Create base.dm
BlueNexus Sep 11, 2015
98940d8
Base projectile file
BlueNexus Sep 11, 2015
3135235
Work-in-progress compile proc
BlueNexus Sep 11, 2015
b9742e7
Added casing handling to compile
BlueNexus Sep 14, 2015
d8744ff
Added heat level handling
BlueNexus Sep 14, 2015
810071e
Added a heat limit var for later use
BlueNexus Sep 14, 2015
e395c88
Work-in-progress overheat handling
BlueNexus Sep 14, 2015
43546a6
More heat handling
BlueNexus Sep 14, 2015
fbeaab8
Cooldown handling
BlueNexus Sep 14, 2015
6a87a0c
Further handling
BlueNexus Sep 14, 2015
9ff3805
Create energy.dm
BlueNexus Sep 14, 2015
a05665d
Extra quotation fix
BlueNexus Sep 14, 2015
f30f7ad
Merge branch 'master' into ModularFirearms
BlueNexus Sep 14, 2015
c834f2e
Comments and punctuation
BlueNexus Sep 15, 2015
bae4775
Changed if's to else if's
BlueNexus Sep 21, 2015
cbe3287
Used a var instead of rechecking istype.
BlueNexus Sep 21, 2015
3042717
More handling and a refactor
BlueNexus Sep 21, 2015
cebdd5f
Added some else if's
BlueNexus Sep 21, 2015
cb258b6
Switched to using span classes
BlueNexus Sep 21, 2015
b65bc80
Modifying the P again.
BlueNexus Sep 21, 2015
9d41e0e
Added barrel compiling
BlueNexus Sep 21, 2015
4aa29a3
Added stock compiling
BlueNexus Sep 21, 2015
a4096e9
Added new power supplies
BlueNexus Sep 23, 2015
6771d5b
Update power_cells.dm
BlueNexus Sep 23, 2015
dac207e
Start of the replacement
BlueNexus Sep 28, 2015
a871763
Added a heavy assembly
BlueNexus Sep 28, 2015
4b46e3c
Added mastertype and compiled vars
BlueNexus Sep 28, 2015
750a5d5
Added the framework for recompiling
BlueNexus Sep 28, 2015
1876c00
Small fix
BlueNexus Sep 28, 2015
a3d7873
Update loader.dm
BlueNexus Sep 28, 2015
225d7ff
Rearrangement
BlueNexus Sep 28, 2015
4a594b6
Set the base parts for projectile weaponry
BlueNexus Sep 28, 2015
4d87117
Update projectile.dm
BlueNexus Sep 28, 2015
da5c66b
Added the Z8 driver
BlueNexus Sep 28, 2015
125e8d2
Moved automatic weapons over to the MFCS system.
BlueNexus Sep 28, 2015
6c565d2
Moved pistols over to the MFCS system
BlueNexus Sep 28, 2015
c8168c4
Update core.dm
BlueNexus Sep 28, 2015
e686188
Compilesprites into gun.dm
BlueNexus Sep 28, 2015
14dc23b
Removed redundant code
BlueNexus Sep 28, 2015
079ed5e
WIP readme
BlueNexus Sep 28, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,18 @@
#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\modular\assembly.dm"
#include "code\modules\projectiles\guns\modular\core.dm"
#include "code\modules\projectiles\guns\modular\components\barrel.dm"
#include "code\modules\projectiles\guns\modular\components\chamber.dm"
#include "code\modules\projectiles\guns\modular\components\chassis.dm"
#include "code\modules\projectiles\guns\modular\components\driver.dm"
#include "code\modules\projectiles\guns\modular\components\frame.dm"
#include "code\modules\projectiles\guns\modular\components\loader.dm"
#include "code\modules\projectiles\guns\modular\components\lockpin.dm"
#include "code\modules\projectiles\guns\modular\components\misc.dm"
#include "code\modules\projectiles\guns\modular\components\sight.dm"
#include "code\modules\projectiles\guns\modular\components\stock.dm"
#include "code\modules\projectiles\guns\projectile\automatic.dm"
#include "code\modules\projectiles\guns\projectile\dartgun.dm"
#include "code\modules\projectiles\guns\projectile\pistol.dm"
Expand Down
22 changes: 22 additions & 0 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@

if(!special_check(user))
return

if(istype (src, /obj/item/weapon/gun/energy))
if(src.vent_stack)
return
if(src.heat_level = src.heat_cap)
user << "<span class='warning'>[src] feels hot in your hands!<span>"
if((src.heat_level - src.heat_cap) = 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be elseif or you're running checks that you're already establishing as false earlier in the code.

user << "<span class='warning'>[src] beeps in alarm, painfully hot!<span>"
if((src.heat_level - src.heat_cap) = 2)
user << "<span class='warning'>[src] flashes a red warning light, searing hot! It can't take much more!<span>"
if((src.heat_level - src.heat_cap) >= 3)
if(prob(80))
user << "<span class='warning'>[src] overheats, venting boiling-hot steam!"
src.vent_stack += 5
return
else
user << "<span class='danger'>[src] explodes violently in your hands!"
src.explode()
return

if(world.time < next_fire_time)
if (world.time % 3) //to prevent spam
Expand Down Expand Up @@ -179,6 +198,9 @@
var/acc = firemode.accuracy[min(i, firemode.accuracy.len)]
var/disp = firemode.dispersion[min(i, firemode.dispersion.len)]
process_accuracy(projectile, user, target, acc, disp)

if(istype (src, /obj/item/weapon/gun/energy))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set a var at L154 and check it here, saves checking the type every single loop iteration.

src.heat_level += 1

if(pointblank)
process_point_blank(projectile, user, target)
Expand Down
7 changes: 7 additions & 0 deletions code/modules/projectiles/guns/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
var/projectile_type = /obj/item/projectile/beam/practice
var/modifystate
var/charge_meter = 1 //if set, the icon state will be chosen based on the current charge
var/heat_level = null //Handles overheating for energy weapons
var/heat_cap = 5
var/vent_stack = null

//self-recharging
var/self_recharge = 0 //if set, the weapon will recharge itself
Expand Down Expand Up @@ -58,6 +61,10 @@
..()

/obj/item/weapon/gun/energy/process()
if(heat_level)
heat_level -= 0.5
if(vent_stack)
vent_stack -= 1
if(self_recharge) //Every [recharge_time] ticks, recharge a shot for the cyborg
charge_tick++
if(charge_tick < recharge_time) return 0
Expand Down
73 changes: 73 additions & 0 deletions code/modules/projectiles/guns/modular/assembly.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//Frames are the starting blocks of the weapon. The type of frame decides how large a weapon you can build.
//In general, weight affects the size and weight (slow to use, bulky, etc) of the weapon

/datum/firemode/modular
name = "modular-default"
burst = 1
burst_delay = null
fire_delay = null
move_delay = 1
list/accuracy = list(0)
list/dispersion = list(0)

obj/item/weapon/modular_firearms/assembly
name = "basic assembly"
desc = "The outer framework for a firearm of some kind. This one looks rather basic."
icon = 'icons/placeholder.dmi'
var/msg = null
var/modChassis = null
var/modChamber = null
var/modDriver = null
var/modLoader = null
var/modBarrel = null
var/modStock = null
var/modSight = null
var/modMisc = list()
var/framelevel = 2
var/weight = 1
var/isEnergy = null
var/isKinetic = null
var/silenced = null
var/compensated = null
var/list/components = list()
var/list/removable = list()
var/useCell = null
var/useSupply = null
var/useBullet = null

/obj/item/weapon/modular_firearms/assembly/attackby(obj/item/I as obj, mob/user as mob)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either return after setting part/prereq or make these elseif, you're checking type repeatedly even if it evaluates true in the first block.

if(istype(I, /obj/item/weapon/modular_firearms))
var/part = null
var/prereq = null
if(istype(I, /obj/item/weapon/modular_firearms/chassis))
part = modChassis
prereq = null

if(istype(I, /obj/item/weapon/modular_firearms/chamber))
part = modChamber
prereq = modChassis

if(istype(I, /obj/item/weapon/modular_firearms/driver))
part = modDriver
prereq = modChamber

if(istype(I, /obj/item/weapon/modular_firearms/loader))
part = modLoader
prereq = modChamber

if(istype(I, /obj/item/weapon/modular_firearms/barrel))
part = modBarrel
prereq = modChamber

if(istype(I, /obj/item/weapon/modular_firearms/stock))
part = modStock
prereq = modChassis

if(istype(I, /obj/item/weapon/modular_firearms/sight))
part = modSight
prereq = modChassis

add_part(I, user, part, prereq)



96 changes: 96 additions & 0 deletions code/modules/projectiles/guns/modular/components/barrel.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//Barrels define the range of the weapon, as well as affecting their accuracy.
//For energy weapons, this refers to focusing chambers.

obj/item/weapon/modular_firearms/barrel
name = "barrel"
icon = 'icons/placeholder.dmi'
var/accuracy_mod = null
var/weight = null
var/burst_mod = null

obj/item/weapon/modular_firearms/barrel/sniper
name = "marksman barrel"
accuracy_mod = 1
weight = 4

obj/item/weapon/modular_firearms/barrel/rifle
name = "long barrel"
accuracy_mod = 0.5
weight = 3


obj/item/weapon/modular_firearms/barrel/standard
name = "standard barrel"
accuracy_mod = 0
weight = 2

obj/item/weapon/modular_firearms/barrel/short
name = "short barrel"
accuracy_mod = -0.5
weight = 1

obj/item/weapon/modular_firearms/barrel/snub
name = "snub barrel"
accuracy_mod = -1
weight = 0

obj/item/weapon/modular_firearms/barrel/rotating //boom goes your accuracy. Good luck getting one though
name = "rotating barrel"
accuracy_mod = -3
weight = 5
burst_mod = 5

obj/item/weapon/modular_firearms/barrel/double
name = "double barrel"
accuracy_mod = -1
weight = 2
burst_mod = 2

obj/item/weapon/modular_firearms/barrel/triple
name = "triple barrel"
accuracy_mod = -2
weight = 3
burst_mod = 3

/* //Not quite sure about energy barrels yet.
obj/item/weapon/modular_firearms/barrel/energy
var/power_mod = null


obj/item/weapon/modular_firearms/barrel/energy/long
name = "high-refraction focusing chamber"
accuracy_mod = 2
weight = 3
power_mod = 4

obj/item/weapon/modular_firearms/barrel/energy/high
name = "dense focusing chamber"
accuracy_mod = 1
weight = 2
power_mod = 3

obj/item/weapon/modular_firearms/barrel/energy/heavy
name = "heavy focusing chamber"
accuracy_mod = 0
weight = 4
power_mod = 5
var/heavyfocus = 1

obj/item/weapon/modular_firearms/barrel/energy/standard
name = "regulated focusing chamber"
accuracy_mod = 0
weight = 1
power_mod = 2

obj/item/weapon/modular_firearms/barrel/energy/standard
name = "simple focusing chamber"
accuracy_mod = 0
weight = 0.5
power_mod = 1

*/





122 changes: 122 additions & 0 deletions code/modules/projectiles/guns/modular/components/chamber.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//The chamber decides what type of projectile the gun fires.
//For ballistic, there will be a chamber for each bullet type, along with cartridges and shotgun shells
//For energy, it will include each type of beam, excluding pulse weaponry. Heavy lasers may only be made with a heavy frame

obj/item/weapon/modular_firearms/chamber
var/caliber = null
var/projectile_type = null
icon = 'icons/placeholder.dmi'

obj/item/weapon/modular_firearms/chamber/a357
name = ".357 chamber"
desc = "Compatible with .357"
caliber = "357"

obj/item/weapon/modular_firearms/chamber/a50
name = ".50 chamber"
desc = "Compatible with .50"
caliber = ".50"


obj/item/weapon/modular_firearms/chamber/c38
name = ".38 chamber"
desc = "Compatible with .38"
caliber = "38"

obj/item/weapon/modular_firearms/chamber/a75
name = ".75 chamber"
desc = "Compatible with .75 ammunition."
caliber = "75"

obj/item/weapon/modular_firearms/chamber/c9mm
name = "9mm chamber"
desc = "Compatible with 9mm ammunition."
caliber = "9mm"

obj/item/weapon/modular_firearms/chamber/a12mm
name = "12mm chamber"
desc = "Compatible with 12mm ammunition."
caliber = "12mm"

obj/item/weapon/modular_firearms/chamber/c45
name = ".45 chamber"
desc = "Compatible with .45 ammunition."
caliber = ".45"

obj/item/weapon/modular_firearms/chamber/shotgun
name = "shotgun chamber"
desc = "Compatible with all shotgun-grade ammunition."
caliber = "shotgun"

//obj/item/weapon/modular_firearms/chamber/stunshell
// name = "taser cartridge system"
// desc = "Compatible with Taser cartridges."
// allowed_projectiles = list(/obj/item/projectile/energy/electrode/stunshot, /obj/item/projectile/energy/electrode)

obj/item/weapon/modular_firearms/chamber/a762
name = ".762 chamber"
desc = "Compatible with .762 ammunition."
caliber = "a762"

obj/item/weapon/modular_firearms/chamber/a145
name = ".145 chamber"
desc = "Compatible with .145 ammunition."
caliber = "14.5mm"

obj/item/weapon/modular_firearms/chamber/a556
name = ".556 chamber"
desc = "Compatible with .556 ammunition."
caliber = "a556"

obj/item/weapon/modular_firearms/chamber/energy
var/charge_cost = 200

obj/item/weapon/modular_firearms/chamber/energy/laser
name = "laser emitter"
projectile_type = /obj/item/projectile/beam

obj/item/weapon/modular_firearms/chamber/energy/plaser
name = "practice laser emitter"
projectile_type = /obj/item/projectile/beam/practice

obj/item/weapon/modular_firearms/chamber/energy/hlaser
name = "heavy laser emitter"
charge_cost = 400
projectile_type = /obj/item/projectile/beam/heavylaser

obj/item/weapon/modular_firearms/chamber/energy/xray
name = "X-ray laser emitter"
charge_cost = 100
projectile_type = /obj/item/projectile/beam/xray

obj/item/weapon/modular_firearms/chamber/energy/xsniper
name = "sniper laser emitter"
charge_cost = 400
projectile_type = /obj/item/projectile/beam/sniper

obj/item/weapon/modular_firearms/chamber/energy/ltagblue
name = "blue laser-tag emitter"
projectile_type = /obj/item/projectile/beam/lastertag/blue

obj/item/weapon/modular_firearms/chamber/energy/ltagred
name = "red laser-tag emitter"
projectile_type = /obj/item/projectile/beam/lastertag/red

obj/item/weapon/modular_firearms/chamber/energy/stun
name = "stun beam emitter"
projectile_type = /obj/item/projectile/beam/stun

obj/item/weapon/modular_firearms/chamber/energy/ion
name = "ion emitter"
charge_cost = 300
projectile_type = /obj/item/projectile/ion

obj/item/weapon/modular_firearms/chamber/energy/floramut
name = "floral emitter"
charge_cost = 100
projectile_type = /obj/item/projectile/energy/floramut

obj/item/weapon/modular_firearms/chamber/energy/phoron
name = "phoron emitter"
projectile_type = /obj/item/projectile/energy/phoron

10 changes: 10 additions & 0 deletions code/modules/projectiles/guns/modular/components/chassis.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//The chassis is basically the actual framework of the gun, and decides what type of weapon it will be.
//Options are ballistic and energy, for the moment

obj/item/weapon/modular_firearms/chassis
icon = 'icons/placeholder.dmi'
var/weight = 2

obj/item/weapon/modular_firearms/chassis/energy

obj/item/weapon/modular_firearms/chassis/ballistic
Loading