mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-30 14:16:39 +01:00
preliminary reorganization of conveyors, disposals, packaging, etc (#6706)
factorio gaming --------- Co-authored-by: LordME <58342752+TheLordME@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
// todo: /obj/structure/large_parcel
|
||||
/obj/structure/bigDelivery
|
||||
desc = "A big wrapped package."
|
||||
name = "large parcel"
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycloset"
|
||||
var/obj/wrapped = null
|
||||
density = 1
|
||||
var/sortTag = null
|
||||
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
|
||||
var/examtext = null
|
||||
var/nameset = 0
|
||||
var/label_y
|
||||
var/label_x
|
||||
var/tag_x
|
||||
|
||||
/obj/structure/bigDelivery/Destroy()
|
||||
if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.forceMove(get_turf(src))
|
||||
if(istype(wrapped, /obj/structure/closet))
|
||||
var/obj/structure/closet/O = wrapped
|
||||
O.sealed = 0
|
||||
wrapped = null
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.forceMove(T)
|
||||
return ..()
|
||||
|
||||
/obj/structure/bigDelivery/attack_hand(mob/user, list/params)
|
||||
unwrap()
|
||||
|
||||
/obj/structure/bigDelivery/proc/unwrap()
|
||||
// Destroy will drop our wrapped object on the turf, so let it.
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
var/obj/item/destTagger/O = W
|
||||
if(O.currTag)
|
||||
if(src.sortTag != O.currTag)
|
||||
to_chat(user, "<span class='notice'>You have labeled the destination as [O.currTag].</span>")
|
||||
if(!src.sortTag)
|
||||
src.sortTag = O.currTag
|
||||
update_icon()
|
||||
else
|
||||
src.sortTag = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The package is already labeled for [O.currTag].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
switch(alert("What would you like to alter?",,"Title","Description", "Cancel"))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='warning'> Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
||||
"<span class='notice'>You title \the [src]: \"[str]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
name = "[name] ([str])"
|
||||
if(!examtext && !nameset)
|
||||
nameset = 1
|
||||
update_icon()
|
||||
else
|
||||
nameset = 1
|
||||
if("Description")
|
||||
var/str = sanitize(input(usr,"Label text?","Set label",""))
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<font color='red'>Invalid text.</font>")
|
||||
return
|
||||
if(!examtext && !nameset)
|
||||
examtext = str
|
||||
update_icon()
|
||||
else
|
||||
examtext = str
|
||||
user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\
|
||||
"<span class='notice'>You label \the [src]: \"[examtext]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
return
|
||||
|
||||
/obj/structure/bigDelivery/update_icon()
|
||||
cut_overlays()
|
||||
if(nameset || examtext)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
if(icon_state == "deliverycloset")
|
||||
I.pixel_x = 2
|
||||
if(label_y == null)
|
||||
label_y = rand(-6, 11)
|
||||
I.pixel_y = label_y
|
||||
else if(icon_state == "deliverycrate")
|
||||
if(label_x == null)
|
||||
label_x = rand(-8, 6)
|
||||
I.pixel_x = label_x
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
if(sortTag)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag")
|
||||
if(icon_state == "deliverycloset")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(-2, 3)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = 9
|
||||
else if(icon_state == "deliverycrate")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(-8, 6)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
|
||||
/obj/structure/bigDelivery/examine(mob/user, dist)
|
||||
. = ..()
|
||||
if(sortTag)
|
||||
. += "<span class='notice'>It is labeled \"[sortTag]\"</span>"
|
||||
if(examtext)
|
||||
. += "<span class='notice'>It has a note attached which reads, \"[examtext]\"</span>"
|
||||
@@ -0,0 +1,107 @@
|
||||
// todo: /obj/item/small_parcel
|
||||
/obj/item/smallDelivery
|
||||
desc = "A small wrapped package."
|
||||
name = "small parcel"
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "deliverycrate3"
|
||||
drop_sound = 'sound/items/drop/cardboardbox.ogg'
|
||||
pickup_sound = 'sound/items/pickup/cardboardbox.ogg'
|
||||
var/obj/item/wrapped = null
|
||||
var/sortTag = null
|
||||
var/examtext = null
|
||||
var/nameset = 0
|
||||
var/tag_x
|
||||
|
||||
/obj/item/smallDelivery/attack_self(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if (wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
if(ishuman(user))
|
||||
user.put_in_hands_or_drop(wrapped)
|
||||
else
|
||||
wrapped.forceMove(drop_location())
|
||||
wrapped = null
|
||||
|
||||
qdel(src)
|
||||
|
||||
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
var/obj/item/destTagger/O = W
|
||||
if(O.currTag)
|
||||
if(src.sortTag != O.currTag)
|
||||
to_chat(user, "<span class='notice'>You have labeled the destination as [O.currTag].</span>")
|
||||
if(!src.sortTag)
|
||||
src.sortTag = O.currTag
|
||||
update_icon()
|
||||
else
|
||||
src.sortTag = O.currTag
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The package is already labeled for [O.currTag].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
switch(alert("What would you like to alter?",,"Title","Description", "Cancel"))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='warning'> Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("\The [user] titles \the [src] with \a [W], marking down: \"[str]\"",\
|
||||
"<span class='notice'>You title \the [src]: \"[str]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
name = "[name] ([str])"
|
||||
if(!examtext && !nameset)
|
||||
nameset = 1
|
||||
update_icon()
|
||||
else
|
||||
nameset = 1
|
||||
|
||||
if("Description")
|
||||
var/str = sanitize(input(usr,"Label text?","Set label",""))
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<font color='red'>Invalid text.</font>")
|
||||
return
|
||||
if(!examtext && !nameset)
|
||||
examtext = str
|
||||
update_icon()
|
||||
else
|
||||
examtext = str
|
||||
user.visible_message("\The [user] labels \the [src] with \a [W], scribbling down: \"[examtext]\"",\
|
||||
"<span class='notice'>You label \the [src]: \"[examtext]\"</span>",\
|
||||
"You hear someone scribbling a note.")
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery/update_icon()
|
||||
cut_overlays()
|
||||
if((nameset || examtext) && icon_state != "deliverycrate1")
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
if(icon_state == "deliverycrate5")
|
||||
I.pixel_y = -1
|
||||
add_overlay(I)
|
||||
if(sortTag)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_tag")
|
||||
switch(icon_state)
|
||||
if("deliverycrate1")
|
||||
I.pixel_y = -5
|
||||
if("deliverycrate2")
|
||||
I.pixel_y = -2
|
||||
if("deliverycrate3")
|
||||
I.pixel_y = 0
|
||||
if("deliverycrate4")
|
||||
if(tag_x == null)
|
||||
tag_x = rand(0,5)
|
||||
I.pixel_x = tag_x
|
||||
I.pixel_y = 3
|
||||
if("deliverycrate5")
|
||||
I.pixel_y = -3
|
||||
add_overlay(I)
|
||||
|
||||
/obj/item/smallDelivery/examine(mob/user, dist)
|
||||
. = ..()
|
||||
if(sortTag)
|
||||
. += "<span class='notice'>It is labeled \"[sortTag]\"</span>"
|
||||
if(examtext)
|
||||
. += "<span class='notice'>It has a note attached which reads, \"[examtext]\"</span>"
|
||||
Reference in New Issue
Block a user