Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions code/game/objects/items/weapons/power_cells.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@
icon_state = "hcell"
maxcharge = 10000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 60)

/obj/item/weapon/cell/med
name = "WT-2000 power cell"
desc = "A middle-of-the-line power cell produced by Ward-Takahashi."
origin_tech = "powerstorage=1"
icon_state = "hcell"
maxcharge = 2000
matter = list(DEFAULT_WALL_MATERIAL = 700, "glass" = 40)

/obj/item/weapon/cell/high/empty/New()
..()
Expand Down
72 changes: 72 additions & 0 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@
var/accuracy = 0 //accuracy is measured in tiles. +1 accuracy means that everything is effectively one tile closer for the purpose of miss chance, -1 means the opposite. launchers are not supported, at the moment.
var/scoped_accuracy = null

//MFCS vars below

var/modAssembly = 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/mastertype = src
var/list/components = list()
var/list/removable = list()
var/stockmessage = null
var/compilesprite = null

//End of MFCS vars

var/next_fire_time = 0

var/sel_mode = 1 //index of the currently selected mode
Expand All @@ -86,6 +105,29 @@

if(isnull(scoped_accuracy))
scoped_accuracy = accuracy

compilesprite = icon_state

if(modAssembly)
mastertype = src
if(!modAssembly.compiled)
recompile()

/obj/item/weapon/gun/proc/recompile()
var/assembly/A = new modAssembly(src)
A.mastertype = mastertype
A.compilesprite = compilesprite
A.modChassis = modChassis
A.modChamber = modChamber
A.modDriver = modDriver
A.modLoader = modLoader
A.modBarrel = modBarrel
if(modStock)
A.modStock = modStock
if(modScope)
A.modScope = modScope
A.compiled = 0
A.compile()

//Checks whether a given mob can use the gun
//Any checks that shouldn't result in handle_click_empty() being called if they fail should go here.
Expand Down Expand Up @@ -143,13 +185,40 @@
else
return ..() //Pistolwhippin'

/obj/item/weapon/gun/attackby(obj/item/I as obj, mob/user as mob)
if(istype (I, /obj/item/weapon/screwdriver))
user << "<span class="notice">You begin taking apart the [src].</span>"
sleep(20)
recompile()

/obj/item/weapon/gun/proc/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0)
var/isenergy = null
if(!user || !target) return

add_fingerprint(user)

if(!special_check(user))
return

if(istype (src, /obj/item/weapon/gun/energy))
isenergy = 1
if(src.vent_stack)
return
else if(src.heat_level = src.heat_cap)
user << "<span class='warning'>[src] feels hot in your hands!<span>"
else if((src.heat_level - src.heat_cap) = 1)
user << "<span class='warning'>[src] beeps in alarm, painfully hot!<span>"
else 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>"
else 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 +248,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(isenergy)
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
63 changes: 63 additions & 0 deletions code/modules/projectiles/guns/modular/assembly.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//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


obj/item/weapon/modular_firearms/assembly
name = "standard assembly"
desc = "The outer framework for a firearm of some kind. This one looks rather basic."
icon = 'icons/placeholder.dmi'
var/mastertype = null
var/compiled = null
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()
w_class = 3
var/isEnergy = null
var/isKinetic = null
var/list/components = list()
var/list/removable = list()

/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

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

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

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

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

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

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

add_part(I, user, part, prereq)

obj/item/weapon/modular_firearms/assembly/heavy
name = "heavy assembly"
desc = "The outer framework for a firearm. You could probably make something over the top with this."
w_class = 4
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

*/





Loading