mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Adds Collapsible AM rifle. Createes new uplink entry (#3644)
* Adds Collapsible AM rifle, and adds case with parts and 5 shots to Uplink. Separates it and intended merc version, both costing default telecrystal amount. Does NOT make them antagonist type specific. * Addresses review. * Makes rifle case traitor/merc specific. Enables ability to have specific uplink items be available only for specific antags.
This commit is contained in:
@@ -5,7 +5,7 @@ var/datum/uplink/uplink = new()
|
||||
var/list/datum/uplink_item/items
|
||||
var/list/datum/uplink_category/categories
|
||||
|
||||
/datum/uplink/New()
|
||||
/datum/uplink/New(var/type)
|
||||
items_assoc = list()
|
||||
items = init_subtypes(/datum/uplink_item)
|
||||
categories = init_subtypes(/datum/uplink_category)
|
||||
@@ -38,7 +38,8 @@ var/datum/uplink/uplink = new()
|
||||
|
||||
/datum/uplink_item/New()
|
||||
..()
|
||||
antag_roles = list()
|
||||
if(!antag_roles)
|
||||
antag_roles = list()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -99,10 +99,18 @@
|
||||
item_cost = 40
|
||||
path = /obj/item/weapon/gun/projectile/derringer
|
||||
|
||||
/datum/uplink_item/item/visible_weapons/heavysniper
|
||||
/datum/uplink_item/item/visible_weapons/heavysnipermerc
|
||||
name = "Anti-Materiel Rifle (14.5mm)"
|
||||
item_cost = DEFAULT_TELECRYSTAL_AMOUNT
|
||||
path = /obj/item/weapon/gun/projectile/heavysniper
|
||||
antag_roles = list("Mercenary")
|
||||
|
||||
/datum/uplink_item/item/visible_weapons/heavysnipertraitor
|
||||
name = "Anti-Materiel Rifle (14.5mm)"
|
||||
desc = "A convenient collapsible rifle for covert assassination. Comes with 4 shots and its own secure carrying case."
|
||||
item_cost = DEFAULT_TELECRYSTAL_AMOUNT
|
||||
path = /obj/item/weapon/storage/secure/briefcase/rifle
|
||||
antag_roles = list("Traitor")
|
||||
|
||||
/datum/uplink_item/item/visible_weapons/tommygun
|
||||
name = "Tommygun (.45)" // We're keeping this because it's CLASSY. -Spades
|
||||
|
||||
@@ -57,7 +57,7 @@ var/datum/uplink_random_selection/all_uplink_selection = new/datum/uplink_random
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/ammo/mc9mm)
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/revolver)
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/ammo/a357)
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/heavysniper, 15, 0)
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/heavysnipermerc, 15, 0)
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/ammo/sniperammo, 15, 0)
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/grenades/emp, 50)
|
||||
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/crossbow, 33)
|
||||
|
||||
@@ -149,7 +149,9 @@
|
||||
force = 8.0
|
||||
throw_speed = 1
|
||||
throw_range = 4
|
||||
max_w_class = ITEMSIZE_NORMAL
|
||||
w_class = ITEMSIZE_LARGE
|
||||
max_storage_space = ITEMSIZE_COST_NORMAL * 4
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if ((src.loc == user) && (src.locked == 1))
|
||||
|
||||
@@ -282,3 +282,16 @@
|
||||
..()
|
||||
new /obj/item/weapon/syndie/c4explosive/heavy/super_heavy(src)
|
||||
new /obj/item/weapon/screwdriver(src)
|
||||
|
||||
|
||||
/obj/item/weapon/storage/secure/briefcase/rifle
|
||||
name = "secure briefcase"
|
||||
|
||||
/obj/item/weapon/storage/secure/briefcase/rifle/New()
|
||||
..()
|
||||
new /obj/item/sniper_rifle_part/barrel(src)
|
||||
new /obj/item/sniper_rifle_part/stock(src)
|
||||
new /obj/item/sniper_rifle_part/trigger_group(src)
|
||||
|
||||
for(var/i = 1 to 4)
|
||||
new /obj/item/ammo_casing/a145(src)
|
||||
|
||||
@@ -32,13 +32,14 @@
|
||||
//var/list/icon_keys = list() //keys
|
||||
//var/list/ammo_states = list() //values
|
||||
|
||||
/obj/item/weapon/gun/projectile/New()
|
||||
/obj/item/weapon/gun/projectile/New(loc, var/starts_loaded = 1)
|
||||
..()
|
||||
if(ispath(ammo_type) && (load_method & (SINGLE_CASING|SPEEDLOADER)))
|
||||
for(var/i in 1 to max_shells)
|
||||
loaded += new ammo_type(src)
|
||||
if(ispath(magazine_type) && (load_method & MAGAZINE))
|
||||
ammo_magazine = new magazine_type(src)
|
||||
if(starts_loaded)
|
||||
if(ispath(ammo_type) && (load_method & (SINGLE_CASING|SPEEDLOADER)))
|
||||
for(var/i in 1 to max_shells)
|
||||
loaded += new ammo_type(src)
|
||||
if(ispath(magazine_type) && (load_method & MAGAZINE))
|
||||
ammo_magazine = new magazine_type(src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/projectile/consume_next_projectile()
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
////////////// PTR-7 Anti-Materiel Rifle //////////////
|
||||
|
||||
/obj/item/weapon/gun/projectile/heavysniper/collapsible
|
||||
|
||||
/obj/item/weapon/gun/projectile/heavysniper/collapsible/verb/take_down()
|
||||
set category = "Object"
|
||||
set name = "Disassemble Rifle"
|
||||
|
||||
var/mob/living/carbon/human/user = usr
|
||||
if(user.stat)
|
||||
return
|
||||
|
||||
if(chambered)
|
||||
to_chat(user, "<span class='warning'>You need to empty the rifle to break it down.</span>")
|
||||
else
|
||||
collapse_rifle(user)
|
||||
|
||||
/obj/item/weapon/gun/projectile/heavysniper/proc/collapse_rifle(mob/user)
|
||||
to_chat(user, "<span class='warning'>You begin removing \the [src]'s barrel.</span>")
|
||||
if(do_after(user, 40))
|
||||
if(user.unEquip(src, force=1))
|
||||
to_chat(user, "<span class='warning'>You remove \the [src]'s barrel.</span>")
|
||||
qdel(src)
|
||||
var/obj/item/barrel = new /obj/item/sniper_rifle_part/barrel(user)
|
||||
var/obj/item/sniper_rifle_part/assembly = new /obj/item/sniper_rifle_part/trigger_group(user)
|
||||
var/obj/item/sniper_rifle_part/stock/stock = new(assembly)
|
||||
assembly.stock = stock
|
||||
assembly.part_count = 2
|
||||
assembly.update_build()
|
||||
user.put_in_any_hand_if_possible(assembly) || assembly.dropInto(user.loc)
|
||||
user.put_in_any_hand_if_possible(barrel) || barrel.dropInto(user.loc)
|
||||
|
||||
|
||||
/obj/item/sniper_rifle_part
|
||||
name = "AM rifle part"
|
||||
desc = "A part of an antimateriel rifle."
|
||||
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
|
||||
icon = 'icons/obj/gun.dmi'
|
||||
|
||||
var/obj/item/sniper_rifle_part/barrel = null
|
||||
var/obj/item/sniper_rifle_part/stock = null
|
||||
var/obj/item/sniper_rifle_part/trigger_group = null
|
||||
var/part_count = 1
|
||||
|
||||
|
||||
/obj/item/sniper_rifle_part/barrel
|
||||
name = "AM rifle barrel"
|
||||
icon_state = "heavysniper-barrel"
|
||||
|
||||
/obj/item/sniper_rifle_part/barrel/New()
|
||||
..()
|
||||
barrel = src
|
||||
|
||||
/obj/item/sniper_rifle_part/stock
|
||||
name = "AM rifle stock"
|
||||
icon_state = "heavysniper-stock"
|
||||
|
||||
/obj/item/sniper_rifle_part/stock/New()
|
||||
..()
|
||||
stock = src
|
||||
|
||||
/obj/item/sniper_rifle_part/trigger_group
|
||||
name = "AM rifle trigger assembly"
|
||||
icon_state = "heavysniper-trig"
|
||||
|
||||
/obj/item/sniper_rifle_part/trigger_group/New()
|
||||
..()
|
||||
trigger_group = src
|
||||
|
||||
/obj/item/sniper_rifle_part/attack_self(mob/user as mob)
|
||||
if(part_count == 1)
|
||||
to_chat(user, "<span class='warning'>You can't disassemble this further!</span>")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You start disassembling \the [src].</span>")
|
||||
if(!do_after(user, 40))
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You disassemble \the [src].</span>")
|
||||
for(var/obj/item/sniper_rifle_part/P in list(barrel, stock, trigger_group))
|
||||
if(P.barrel != P)
|
||||
P.barrel = null
|
||||
if(P.stock != P)
|
||||
P.stock = null
|
||||
if(P.trigger_group != P)
|
||||
P.trigger_group = null
|
||||
if(P != src)
|
||||
user.put_in_any_hand_if_possible(P) || P.dropInto(loc)
|
||||
P.part_count = 1
|
||||
|
||||
update_build()
|
||||
|
||||
/obj/item/sniper_rifle_part/attackby(var/obj/item/sniper_rifle_part/A as obj, mob/user as mob)
|
||||
|
||||
to_chat(user, "<span class='notice'>You begin adding \the [A] to \the [src].</span>")
|
||||
if(!do_after(user, 30))
|
||||
return
|
||||
|
||||
|
||||
|
||||
if(istype(A, /obj/item/sniper_rifle_part/trigger_group))
|
||||
if(A.part_count > 1 && src.part_count > 1)
|
||||
to_chat(user, "<span class='warning'>Disassemble one of these parts first!</span>")
|
||||
return
|
||||
|
||||
if(!trigger_group)
|
||||
if(user.unEquip(A, force=1))
|
||||
trigger_group = A
|
||||
else
|
||||
to_chat(user, "<span class='warning'>There's already a trigger group!</span>")
|
||||
return
|
||||
|
||||
else if(istype(A, /obj/item/sniper_rifle_part/barrel))
|
||||
if(!barrel)
|
||||
if(user.unEquip(A, force=1))
|
||||
barrel = A
|
||||
else
|
||||
to_chat(user, "<span class='warning'>There's already a barrel!</span>")
|
||||
return
|
||||
|
||||
else if(istype(A, /obj/item/sniper_rifle_part/stock))
|
||||
if(!stock)
|
||||
if(user.unEquip(A, force=1))
|
||||
stock = A
|
||||
else
|
||||
to_chat(user, "<span class='warning'>There's already a stock!</span>")
|
||||
return
|
||||
|
||||
A.forceMove(src)
|
||||
to_chat(user, "<span class='notice'>You install \the [A].</span>")
|
||||
|
||||
if(A.barrel && !src.barrel)
|
||||
src.barrel = A.barrel
|
||||
if(A.stock && !src.stock)
|
||||
src.stock = A.stock
|
||||
if(A.trigger_group && !src.trigger_group)
|
||||
src.trigger_group = A.trigger_group
|
||||
|
||||
|
||||
part_count = A.part_count + src.part_count
|
||||
update_build(user)
|
||||
|
||||
|
||||
/obj/item/sniper_rifle_part/proc/update_build()
|
||||
switch(part_count)
|
||||
if(1)
|
||||
name = initial(name)
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
icon_state = initial(icon_state)
|
||||
if(2)
|
||||
if(barrel && trigger_group)
|
||||
name = "AM rifle barrel-trigger assembly"
|
||||
icon_state = "heavysniper-trigbar"
|
||||
else if(stock && trigger_group)
|
||||
name = "AM rifle stock-trigger assembly"
|
||||
icon_state = "heavysniper-trigstock"
|
||||
else if(stock && barrel)
|
||||
name = "AM rifle stock-barrel assembly"
|
||||
icon_state = "heavysniper-barstock"
|
||||
w_class = ITEMSIZE_LARGE
|
||||
|
||||
if(3)
|
||||
var/obj/item/weapon/gun/projectile/heavysniper/collapsible/gun = new (get_turf(src), 0)
|
||||
if(usr && istype(usr, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/user = usr
|
||||
user.unEquip(src, force=1)
|
||||
user.put_in_any_hand_if_possible(gun) || gun.dropInto(loc)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/gun/projectile/heavysniper/update_icon()
|
||||
if(bolt_open)
|
||||
icon_state = "heavysniper-open"
|
||||
else
|
||||
icon_state = "heavysniper"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 71 KiB |
@@ -1931,6 +1931,7 @@
|
||||
#include "code\modules\projectiles\guns\projectile\revolver.dm"
|
||||
#include "code\modules\projectiles\guns\projectile\shotgun.dm"
|
||||
#include "code\modules\projectiles\guns\projectile\sniper.dm"
|
||||
#include "code\modules\projectiles\guns\projectile\sniper\collapsible_sniper.dm"
|
||||
#include "code\modules\projectiles\projectile\animate.dm"
|
||||
#include "code\modules\projectiles\projectile\beams.dm"
|
||||
#include "code\modules\projectiles\projectile\bullets.dm"
|
||||
|
||||
Reference in New Issue
Block a user