Skip to content

Commit

Permalink
aaa
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Jan 24, 2024
1 parent 08df15f commit 8cc5bfe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 35 deletions.
32 changes: 14 additions & 18 deletions code/modules/guncrafting/frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
// Currently installed mechanism
var/obj/item/part/gun/modular/grip/InstalledMechanism
// Which mechanism the frame accepts?
var/list/validMechanism = /obj/item/part/gun/modular/mechanism
var/list/validMechanisms = list(/obj/item/part/gun/modular/mechanism)

// Currently installed barrel
var/obj/item/part/gun/modular/barrel/InstalledBarrel
// Which barrels does the frame accept?
var/list/barrelvars = list(/obj/item/part/gun/modular/barrel)
var/list/validBarrels = list(/obj/item/part/gun/modular/barrel)

// Bonuses from forging/type or maluses from printing
var/cheap = FALSE // Set this to true for cheap variants
var/quality = 4

/obj/item/part/gun/frame/New(loc)
..()
Expand All @@ -32,9 +31,10 @@
for(var/part in parts_list)
switch(part)
if("mechanism")
InstalledMechanism = new validMechanism(src)
var/select = pick(validMechanisms)
InstalledMechanism = new select(src)
if("barrel")
var/select = pick(barrelvars)
var/select = pick(validBarrels)
InstalledBarrel = new select(src)
if("grip")
var/select = pick(validGrips)
Expand Down Expand Up @@ -78,21 +78,21 @@
to_chat(user, span_warning("[src] already has a grip attached!"))
return
else
handle_gripvar(I, user)
handle_grip(I, user)

if(istype(I, /obj/item/part/gun/modular/mechanism))
if(InstalledMechanism)
to_chat(user, span_warning("[src] already has a mechanism attached!"))
return
else
handle_validMechanism(I, user)
handle_mechanism(I, user)

if(istype(I, /obj/item/part/gun/modular/barrel))
if(InstalledBarrel)
to_chat(user, span_warning("[src] already has a barrel attached!"))
return
else
handle_barrelvar(I, user)
handle_barrel(I, user)

if(I.tool_behaviour == TOOL_SCREWDRIVER)
var/list/possibles = contents.Copy()
Expand All @@ -110,22 +110,18 @@

return ..()

/obj/item/part/gun/frame/proc/handle_gripvar(obj/item/I, mob/living/user)
/obj/item/part/gun/frame/proc/handle_grip(obj/item/I, mob/living/user)
if(I.type in validGrips)
if(insert_item(I, user))
/*
var/variantnum = validGrips.Find(I.type)
result = resultvars[variantnum]
*/
InstalledGrip = I
to_chat(user, span_notice("You have attached the grip to \the [src]."))
return
else
to_chat(user, span_warning("This grip does not fit!"))
return

/obj/item/part/gun/frame/proc/handle_validMechanism(obj/item/I, mob/living/user)
if(I.type == validMechanism)
/obj/item/part/gun/frame/proc/handle_mechanism(obj/item/I, mob/living/user)
if(I.type == validMechanisms)
if(insert_item(I, user))
InstalledMechanism = I
to_chat(user, span_notice("You have attached the mechanism to \the [src]."))
Expand All @@ -134,8 +130,8 @@
to_chat(user, span_warning("This mechanism does not fit!"))
return

/obj/item/part/gun/frame/proc/handle_barrelvar(obj/item/I, mob/living/user)
if(I.type in barrelvars)
/obj/item/part/gun/frame/proc/handle_barrel(obj/item/I, mob/living/user)
if(I.type in validBarrels)
if(insert_item(I, user))
InstalledBarrel = I
to_chat(user, span_notice("You have attached the barrel to \the [src]."))
Expand Down
17 changes: 0 additions & 17 deletions code/modules/guncrafting/lathe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,3 @@
icon = 'icons/obj/guncrafting.dmi'
icon_state = "work_piece"
max_amount = 10

/obj/item/modgun
name = "gun"
desc = "A gun."
icon = 'icons/obj/guns/projectile.dmi'
icon_state = "detective"
item_state = "gun"
var/caliber = 357
var/gun_parts = list()

/obj/item/blueprint
name = "Blueprint"
desc = "This could be used to make a gun."
icon = 'icons/obj/guncrafting.dmi'
icon_state = "blueprint"
var/design = FALSE
var/blueprint = FALSE

0 comments on commit 8cc5bfe

Please sign in to comment.