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

Firing Pin System - The Lockbox Solution #6925

Merged
merged 10 commits into from Jan 15, 2015
6 changes: 6 additions & 0 deletions code/datums/uplink_item.dm
Expand Up @@ -550,6 +550,12 @@ var/list/uplink_items = list()
item = /obj/item/weapon/storage/box/syndie_kit/imp_adrenal
cost = 8

/datum/uplink_item/implants/explosive
name = "Explosive Implant"
desc = "An implant injected into the body, and later activated either manually or automatically upon death. Creates a moderately-sized fiery explosion. For those agents who know there is no going back."
item = /obj/item/weapon/storage/box/syndie_kit/imp_explosive
cost = 9

// POINTLESS BADASSERY

/datum/uplink_item/badass
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/nuclear/nuclear.dm
Expand Up @@ -179,7 +179,7 @@
U.hidden_uplink.uses = 20
synd_mob.equip_to_slot_or_del(U, slot_in_backpack)

var/obj/item/weapon/implant/explosive/E = new/obj/item/weapon/implant/explosive(synd_mob)
var/obj/item/weapon/implant/weapons_auth/E = new/obj/item/weapon/implant/weapons_auth(synd_mob)
E.imp_in = synd_mob
E.implanted = 1
E.implanted(synd_mob)
Expand Down
32 changes: 22 additions & 10 deletions code/game/gamemodes/wizard/rightandwrong.dm
Expand Up @@ -40,10 +40,6 @@
new /obj/item/weapon/gun/projectile/revolver(get_turf(H))
if("detective")
new /obj/item/weapon/gun/projectile/revolver/detective(get_turf(H))
if("c20r")
new /obj/item/weapon/gun/projectile/automatic/c20r(get_turf(H))
if("nuclear")
new /obj/item/weapon/gun/energy/gun/nuclear(get_turf(H))
if("deagle")
new /obj/item/weapon/gun/projectile/automatic/pistol/deagle/camo(get_turf(H))
if("gyrojet")
Expand All @@ -61,18 +57,34 @@
new /obj/item/weapon/gun/projectile/shotgun(get_turf(H))
if("combatshotgun")
new /obj/item/weapon/gun/projectile/shotgun/combat(get_turf(H))
if("bulldog")
new /obj/item/weapon/gun/projectile/automatic/shotgun/bulldog(get_turf(H))
if("mateba")
new /obj/item/weapon/gun/projectile/revolver/mateba(get_turf(H))
if("sabr")
new /obj/item/weapon/gun/projectile/automatic(get_turf(H))
if("crossbow")
new /obj/item/weapon/gun/projectile/automatic/crossbow(get_turf(H))
if("nuclear")
var/obj/item/weapon/gun/energy/gun/nuclear/gat
gat.pin = /obj/item/device/firing_pin //no authentication pins for spawned guns. fun allowed.
new gat(get_turf(H))
if("sabr")
var/obj/item/weapon/gun/projectile/automatic/gat
gat.pin = /obj/item/device/firing_pin
new gat(get_turf(H))
if("bulldog")
var/obj/item/weapon/gun/projectile/automatic/shotgun/bulldog/gat
gat.pin = /obj/item/device/firing_pin
new gat(get_turf(H))
if("c20r")
var/obj/item/weapon/gun/projectile/automatic/c20r/gat
gat.pin = /obj/item/device/firing_pin
new gat(get_turf(H))
if("saw")
new /obj/item/weapon/gun/projectile/automatic/l6_saw(get_turf(H))
var/obj/item/weapon/gun/projectile/automatic/l6_saw/gat
gat.pin = /obj/item/device/firing_pin
new gat(get_turf(H))
if("car")
new /obj/item/weapon/gun/projectile/automatic/m90(get_turf(H))
var/obj/item/weapon/gun/projectile/automatic/m90/gat
gat.pin = /obj/item/device/firing_pin
new gat(get_turf(H))
else
switch (randomizemagic)
if("fireball")
Expand Down
13 changes: 12 additions & 1 deletion code/game/objects/items/weapons/implants/implant.dm
Expand Up @@ -64,7 +64,18 @@
Implant Specifics:<BR>"}
return dat

/obj/item/weapon/implant/weapons_auth
name = "firearms authentication implant"
desc = "Lets you shoot your guns"
icon_state = "auth"

/obj/item/weapon/implant/tracking/get_data()
var/dat = {"<b>Implant Specifications:</b><BR>
<b>Name:</b> Firearms Authentication Implant<BR>
<b>Life:</b> 4 hours after death of host<BR>
<b>Implant Details:</b> <BR>
<b>Function:</b> Allows operation of implant-locked weaponry, preventing equipment from falling into enemy hands."}
return dat

/obj/item/weapon/implant/explosive
name = "explosive implant"
Expand All @@ -91,7 +102,7 @@
if(!cause || !imp_in) return 0
if(cause == "action_button" && alert(imp_in, "Are you sure you want to activate your explosive implant? This will cause you to explode and gib!", "Explosive Implant Confirmation", "Yes", "No") != "Yes")
return 0
explosion(src, -1, 0, 2, 3, 0) //This might be a bit much, dono will have to see.
explosion(src,0,1,5,7,10, flame_range = 5)
if(imp_in)
imp_in.gib()

Expand Down
13 changes: 7 additions & 6 deletions code/game/objects/items/weapons/storage/uplink_kits.dm
Expand Up @@ -103,21 +103,21 @@
/*/obj/item/weapon/storage/box/syndie_kit/imp_compress
name = "Compressed Matter Implant (with injector)"

/obj/item/weapon/storage/syndie_kit/imp_compress/New()
/obj/item/weapon/storage/box/syndie_kit/imp_compress/New()
new /obj/item/weapon/implanter/compressed(src)
..()
return
*/

/obj/item/weapon/storage/syndie_kit/imp_explosive
/obj/item/weapon/storage/box/syndie_kit/imp_explosive
name = "Explosive Implant (with injector)"

/obj/item/weapon/storage/syndie_kit/imp_explosive/New()
var/obj/item/weapon/implanter/O = new /obj/item/weapon/implanter(src)
/obj/item/weapon/storage/box/syndie_kit/imp_explosive/New()
var/obj/item/weapon/implanter/O = new(src)
O.imp = new /obj/item/weapon/implant/explosive(O)
O.name = "(BIO-HAZARD) BIO-detpack"
O.update_icon()
..()
return*/
return

/obj/item/weapon/storage/box/syndie_kit/imp_uplink
name = "boxed uplink implant (with injector)"
Expand Down Expand Up @@ -152,6 +152,7 @@
new /obj/item/clothing/head/helmet/space/syndicate/black/red(src)
return


/obj/item/weapon/storage/box/syndie_kit/emp
name = "boxed EMP kit"

Expand Down
30 changes: 22 additions & 8 deletions code/modules/projectiles/gun.dm
Expand Up @@ -30,15 +30,20 @@
var/sawn_state = SAWN_INTACT
var/burst_size = 1
var/fire_delay = 0

var/obj/item/device/firing_pin/pin = /obj/item/device/firing_pin //standard firing pin for most guns

var/obj/item/device/flashlight/F = null
var/can_flashlight = 0

/obj/item/weapon/gun/New()
..()
if(pin)
pin = new pin(src)

/obj/item/weapon/gun/proc/process_chamber()
return 0

/obj/item/weapon/gun/proc/special_check(var/mob/M) //Placeholder for any special checks, like detective's revolver.
return 1

//check if there's enough ammo/energy/whatever to shoot one time
//i.e if clicking would make it shoot
/obj/item/weapon/gun/proc/can_shoot()
Expand Down Expand Up @@ -109,12 +114,22 @@
return 0
return 1

/obj/item/weapon/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, var/message = 1, params)
/obj/item/weapon/gun/proc/handle_pins(mob/living/user)
if(pin)
if(pin.pin_auth(user))
return 1
else
user << "<span class='warning'>INVALID USER.</span>"
return 0
else
user << "<span class='notice'>\The [src]'s trigger is locked. This weapon doesn't have a firing pin installed!</span>"
return 0

/obj/item/weapon/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, var/message = 1, params)
add_fingerprint(user)

if(!special_check(user))
return
if(!handle_pins(user))
return 0

for(var/i = 1 to burst_size)
if(!issilicon(user))
Expand All @@ -125,8 +140,6 @@
shoot_with_empty_chamber(user)
break
else
if(!special_check(user))
return
if(get_dist(user, target) <= 1) //Making sure whether the target is in vicinity for the pointblank shot
shoot_live_shot(user, 1, target, message)
else
Expand All @@ -143,6 +156,7 @@
else
user.update_inv_r_hand(0)


/obj/item/weapon/gun/attack(mob/M as mob, mob/user)
if(user.a_intent == "harm") //Flogging
..()
Expand Down
25 changes: 4 additions & 21 deletions code/modules/projectiles/guns/energy/laser.dm
Expand Up @@ -84,7 +84,7 @@ obj/item/weapon/gun/energy/laser/retro
slot_flags = SLOT_BACK
origin_tech = "combat=4;materials=3;powerstorage=3"
ammo_type = list(/obj/item/ammo_casing/energy/laser/heavy)

pin = null

/obj/item/weapon/gun/energy/xray
name = "xray laser gun"
Expand All @@ -93,7 +93,7 @@ obj/item/weapon/gun/energy/laser/retro
item_state = "laser"
origin_tech = "combat=5;materials=3;magnets=2;syndicate=2"
ammo_type = list(/obj/item/ammo_casing/energy/xray)

pin = null

////////Laser Tag////////////////////

Expand All @@ -105,24 +105,16 @@ obj/item/weapon/gun/energy/laser/retro
origin_tech = "combat=1;magnets=2"
clumsy_check = 0
var/charge_tick = 0

/obj/item/weapon/gun/energy/laser/bluetag/special_check(var/mob/living/carbon/human/M)
if(ishuman(M))
if(istype(M.wear_suit, /obj/item/clothing/suit/bluetag))
return 1
M << "<span class='danger'>You need to be wearing your laser tag vest!</span>"
return 0
pin = /obj/item/device/firing_pin/tag/blue

/obj/item/weapon/gun/energy/laser/bluetag/New()
..()
SSobj.processing.Add(src)


/obj/item/weapon/gun/energy/laser/bluetag/Destroy()
SSobj.processing.Remove(src)
..()


/obj/item/weapon/gun/energy/laser/bluetag/process()
charge_tick++
if(charge_tick < 4)
Expand All @@ -135,7 +127,6 @@ obj/item/weapon/gun/energy/laser/retro
return 1



/obj/item/weapon/gun/energy/laser/redtag
name = "laser tag gun"
icon_state = "redtag"
Expand All @@ -144,24 +135,16 @@ obj/item/weapon/gun/energy/laser/retro
origin_tech = "combat=1;magnets=2"
clumsy_check = 0
var/charge_tick = 0

/obj/item/weapon/gun/energy/laser/redtag/special_check(var/mob/living/carbon/human/M)
if(ishuman(M))
if(istype(M.wear_suit, /obj/item/clothing/suit/redtag))
return 1
M << "<span class='danger'>You need to be wearing your laser tag vest!</span>"
return 0
pin = /obj/item/device/firing_pin/tag/red

/obj/item/weapon/gun/energy/laser/redtag/New()
..()
SSobj.processing.Add(src)


/obj/item/weapon/gun/energy/laser/redtag/Destroy()
SSobj.processing.Remove(src)
..()


/obj/item/weapon/gun/energy/laser/redtag/process()
charge_tick++
if(charge_tick < 4)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/projectiles/guns/energy/nuclear.dm
Expand Up @@ -22,6 +22,7 @@
modifystate = 0
ammo_type = list(/obj/item/ammo_casing/energy/electrode, /obj/item/ammo_casing/energy/laser)
can_flashlight = 0
pin = null

/obj/item/weapon/gun/energy/gun/nuclear/New()
..()
Expand Down Expand Up @@ -110,4 +111,4 @@
/obj/item/weapon/gun/energy/gun/turret
name = "hybrid turret gun"
desc = "A basic hybrid energy gun with two settings: Stun and kill."
ammo_type = list(/obj/item/ammo_casing/energy/electrode, /obj/item/ammo_casing/energy/laser)
ammo_type = list(/obj/item/ammo_casing/energy/electrode, /obj/item/ammo_casing/energy/laser)
2 changes: 2 additions & 0 deletions code/modules/projectiles/guns/energy/special.dm
Expand Up @@ -8,6 +8,7 @@
flags = CONDUCT
slot_flags = SLOT_BACK
ammo_type = list(/obj/item/ammo_casing/energy/ion)
pin = null


/obj/item/weapon/gun/energy/ionrifle/emp_act(severity)
Expand All @@ -19,6 +20,7 @@
icon_state = "decloner"
origin_tech = "combat=5;materials=4;powerstorage=3"
ammo_type = list(/obj/item/ammo_casing/energy/declone)
pin = null

/obj/item/weapon/gun/energy/floragun
name = "floral somatoray"
Expand Down
1 change: 1 addition & 0 deletions code/modules/projectiles/guns/energy/stun.dm
Expand Up @@ -13,6 +13,7 @@
origin_tech = "combat=3;materials=3;powerstorage=2"
ammo_type = list(/obj/item/ammo_casing/energy/electrode/gun)
can_flashlight = 0
pin = null

/obj/item/weapon/gun/energy/gun/advtaser
name = "hybrid taser"
Expand Down
1 change: 1 addition & 0 deletions code/modules/projectiles/guns/energy/temperature.dm
Expand Up @@ -5,6 +5,7 @@
origin_tech = "combat=3;materials=4;powerstorage=3;magnets=2"
ammo_type = list(/obj/item/ammo_casing/energy/temp, /obj/item/ammo_casing/energy/temp/hot)
cell_type = "/obj/item/weapon/stock_parts/cell/high"
pin = null


/obj/item/weapon/gun/energy/temperature/attack_self(mob/living/user as mob)
Expand Down
3 changes: 3 additions & 0 deletions code/modules/projectiles/guns/projectile/automatic.dm
Expand Up @@ -80,6 +80,7 @@
fire_sound = 'sound/weapons/Gunshot_smg.ogg'
fire_delay = 2
burst_size = 2
pin = /obj/item/device/firing_pin/implant/pindicate

/obj/item/weapon/gun/projectile/automatic/c20r/New()
..()
Expand Down Expand Up @@ -112,6 +113,7 @@
can_suppress = 0
burst_size = 5
fire_delay = 3
pin = /obj/item/device/firing_pin/implant/pindicate

/obj/item/weapon/gun/projectile/automatic/l6_saw/attack_self(mob/user as mob)
cover_open = !cover_open
Expand Down Expand Up @@ -165,6 +167,7 @@
var/obj/item/weapon/gun/projectile/revolver/grenadelauncher/underbarrel
burst_size = 3
fire_delay = 2
pin = /obj/item/device/firing_pin/implant/pindicate

/obj/item/weapon/gun/projectile/automatic/m90/New()
..()
Expand Down
14 changes: 14 additions & 0 deletions code/modules/projectiles/guns/projectile/revolver.dm
Expand Up @@ -58,6 +58,7 @@
origin_tech = "combat=2;materials=2"
mag_type = /obj/item/ammo_box/magazine/internal/cylinder/rev38

/*
/obj/item/weapon/gun/projectile/revolver/detective/special_check(var/mob/living/carbon/human/M)
if(magazine.caliber == initial(magazine.caliber))
return 1
Expand All @@ -69,6 +70,19 @@
qdel(src)
return 0
return 1
*/
/obj/item/weapon/gun/projectile/revolver/detective/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, var/message = 1, params)
if(magazine.caliber != initial(magazine.caliber))
if(prob(70 - (magazine.ammo_count() * 10))) //minimum probability of 10, maximum of 60
playsound(user, fire_sound, 50, 1)
user << "<span class='danger'>[src] blows up in your face!</span>"
user.take_organ_damage(0,20)
user.drop_item()
qdel(src)
return 0
..()



/obj/item/weapon/gun/projectile/revolver/detective/verb/rename_gun()
set name = "Name Gun"
Expand Down