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

[FIX] Gun rack parts fix #1400

Merged
merged 16 commits into from
Aug 1, 2024
69 changes: 63 additions & 6 deletions modular_ss220/aesthetics/racks/code/racks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,76 @@
/obj/structure/rack/gunrack/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
density = FALSE
var/obj/item/gunrack_parts/newparts = new(loc)
var/obj/item/rack_parts/gunrack_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
for(var/obj/item/I in loc.contents)
if(istype(I, /obj/item/gun))
var/obj/item/gun/to_remove = I
to_remove.remove_from_rack()
qdel(src)

/obj/item/gunrack_parts
/obj/item/rack_parts/gunrack_parts
skifsky marked this conversation as resolved.
Show resolved Hide resolved
name = "gun rack parts"
desc = "Parts of a gun rack."
icon = 'icons/obj/items.dmi'
icon = 'modular_ss220/aesthetics/racks/icons/racks.dmi'
icon_state = "gunrack_parts"
flags = CONDUCT
materials = list(MAT_METAL=2000)
var/building = FALSE

/obj/item/rack_parts/gunrack_parts/attack_self(mob/user)
if(building)
return
building = TRUE
to_chat(user, "<span class='notice'>You start constructing a gun rack...</span>")
if(do_after(user, 50, target = user, progress=TRUE))
if(!user.drop_item(src))
return
var/obj/structure/rack/gunrack/R = new /obj/structure/rack/gunrack(user.loc)
user.visible_message("<span class='notice'>[user] assembles \a [R].\
</span>", "<span class='notice'>You assemble \a [R].</span>")
R.add_fingerprint(user)
qdel(src)
building = FALSE
AyIong marked this conversation as resolved.
Show resolved Hide resolved

/obj/structure/rack/shelving
name = "shelving"
desc = "A shelving for storing various goods"
icon_state = "shelving"

/obj/structure/rack/shelving/attackby(obj/item/W, mob/user, params)
. = ..()
if(W.loc == get_turf(src))
add_fingerprint(user)
var/list/click_params = params2list(params)
//Center the icon where the user clicked.
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
return
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
W.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
W.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)

/obj/structure/rack/shelving/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
density = FALSE
var/obj/item/rack_parts/shelving_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
qdel(src)
skifsky marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/rack_parts/shelving_parts
skifsky marked this conversation as resolved.
Show resolved Hide resolved
name = "shelving parts"
desc = "Parts of a shelving"
icon = 'modular_ss220/aesthetics/racks/icons/racks.dmi'
icon_state = "shelving_parts"

/obj/item/rack_parts/shelving_parts/attack_self(mob/user)
if(building)
return
building = TRUE
to_chat(user, "<span class='notice'>You start constructing a shelving...</span>")
if(do_after(user, 50, target = user, progress=TRUE))
if(!user.drop_item(src))
return
var/obj/structure/rack/shelving/R = new /obj/structure/rack/shelving(user.loc)
user.visible_message("<span class='notice'>[user] assembles \a [R].\
</span>", "<span class='notice'>You assemble \a [R].</span>")
R.add_fingerprint(user)
qdel(src)
building = FALSE
AyIong marked this conversation as resolved.
Show resolved Hide resolved
Binary file modified modular_ss220/aesthetics/racks/icons/racks.dmi
Binary file not shown.
Loading