-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: A-Dev
Are you sure you want to change the base?
Changes from 82 commits
41b4900
d30ca17
02a92fb
89fb5a8
beff2c1
e758421
3736e6e
88e27ea
030e0e9
5ffda2b
c9cb2c9
a82602c
6f4dcd8
18b5525
78258d9
7d7c46d
53a221b
0433753
1d7bfe4
c72ac08
93cc95c
aa43d17
2a6ac61
4453824
9874a98
4029a0d
b704897
8829218
be91923
a9eba36
6223b8c
17b8dac
8c03525
09a27fb
44b88b5
63dff89
b34ca80
1c50499
7e05091
66a44c2
6fd2b09
d95fb53
c486d7a
a3aa64d
c81005f
a3079e2
4ab2c73
21bc19c
a7ffae9
cb4e064
bbdf5a0
14e94b2
dbb1928
8ba16d8
b54d692
b76bff1
b7354c7
1c3728a
c3abd3a
0439f1e
0c18091
8ce8a7b
f0e7197
65a84cc
9e2497a
49e0eb0
77c267f
eb51a8d
ac914ef
98940d8
3135235
b9742e7
d8744ff
810071e
e395c88
43546a6
fbeaab8
6a87a0c
9ff3805
a05665d
f30f7ad
c834f2e
bae4775
cbe3287
3042717
cebdd5f
cb258b6
b65bc80
9d41e0e
4aa29a3
a4096e9
6771d5b
dac207e
a871763
4b46e3c
750a5d5
1876c00
a3d7873
225d7ff
4a594b6
4d87117
da5c66b
125e8d2
6c565d2
c8168c4
e686188
14dc23b
079ed5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
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 | ||
|
@@ -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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
||
|
||
|
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 | ||
|
||
*/ | ||
|
||
|
||
|
||
|
||
|
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 | ||
|
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 |
There was a problem hiding this comment.
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.