mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +01:00
Code for the janitorial cart. Updates some parts of the old janicart too.
This commit is contained in:
@@ -1,3 +1,119 @@
|
||||
/obj/structure/janitorialcart
|
||||
name = "janitorial cart"
|
||||
icon = 'icons/obj/janitor.dmi'
|
||||
icon_state = "cart"
|
||||
anchored = 0
|
||||
density = 1
|
||||
flags = OPENCONTAINER
|
||||
//copypaste sorry
|
||||
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
|
||||
var/obj/item/weapon/storage/bag/trash/mybag = null
|
||||
var/obj/item/weapon/mop/mymop = null
|
||||
var/signs = 0 //maximum capacity of four signs imposed by sprite
|
||||
|
||||
|
||||
/obj/structure/janitorialcart/New()
|
||||
var/datum/reagents/R = new/datum/reagents(100)
|
||||
reagents = R
|
||||
R.my_atom = src
|
||||
|
||||
|
||||
/obj/structure/janitorialcart/examine()
|
||||
set src in usr
|
||||
usr << "\icon[src] [src] contains [reagents.total_volume] unit\s of water!"
|
||||
usr << "There are [signs] sign\s in [src]."
|
||||
//mop and garbage bag are visible, so don't need to be mentioned.
|
||||
|
||||
|
||||
/obj/structure/janitorialcart/attackby(obj/item/I, mob/user)
|
||||
if(istype(I, /obj/item/weapon/storage/bag/trash) && !mybag)
|
||||
user.drop_item()
|
||||
mybag = I
|
||||
I.loc = src
|
||||
update_icon()
|
||||
updateUsrDialog()
|
||||
user << "<span class='notice'>You put [I] into [src].</span>"
|
||||
|
||||
else if(istype(I, /obj/item/weapon/mop))
|
||||
if(I.reagents.total_volume < 1 && reagents.total_volume > 1)
|
||||
reagents.trans_to(I, 2)
|
||||
user << "<span class='notice'>You wet [I] in [src].</span>"
|
||||
playsound(loc, 'sound/effects/slosh.ogg', 25, 1)
|
||||
else if(!mymop)
|
||||
user.drop_item()
|
||||
mymop = I
|
||||
I.loc = src
|
||||
update_icon()
|
||||
updateUsrDialog()
|
||||
user << "<span class='notice'>You put [I] into [src].</span>"
|
||||
|
||||
else if(istype(I, /obj/item/weapon/caution))
|
||||
if(signs < 4)
|
||||
user.drop_item()
|
||||
I.loc = src
|
||||
signs++
|
||||
update_icon()
|
||||
updateUsrDialog()
|
||||
user << "<span class='notice'>You put [I] into [src].</span>"
|
||||
else
|
||||
user << "<span class='notice'>[src] can't hold any more signs.</span>"
|
||||
|
||||
|
||||
/obj/structure/janitorialcart/attack_hand(mob/user)
|
||||
user.set_machine(src)
|
||||
var/dat
|
||||
if(mybag)
|
||||
dat += "<a href='?src=\ref[src];garbage=1'>[mybag.name]</a><br>"
|
||||
if(mymop)
|
||||
dat += "<a href='?src=\ref[src];mop=1'>[mymop.name]</a><br>"
|
||||
if(signs)
|
||||
dat += "<a href='?src=\ref[src];sign=1'>[signs] sign\s</a><br>"
|
||||
var/datum/browser/popup = new(user, "janicart", name, 240, 160)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
|
||||
/obj/structure/janitorialcart/Topic(href, href_list)
|
||||
if(!ishuman(usr))
|
||||
return
|
||||
var/mob/living/carbon/human/user = usr
|
||||
|
||||
if(href_list["garbage"])
|
||||
if(mybag)
|
||||
user.put_in_hands(mybag)
|
||||
user << "<span class='notice'>You take [mybag] from [src].</span>"
|
||||
mybag = null
|
||||
if(href_list["mop"])
|
||||
if(mymop)
|
||||
user.put_in_hands(mymop)
|
||||
user << "<span class='notice'>You take [mymop] from [src].</span>"
|
||||
mymop = null
|
||||
if(href_list["sign"])
|
||||
if(signs)
|
||||
var/obj/item/weapon/caution/Sign = locate(/obj/item/weapon/caution) in src
|
||||
if(Sign)
|
||||
user.put_in_hands(Sign)
|
||||
user << "<span class='notice'>You take \a [Sign] from [src].</span>"
|
||||
signs--
|
||||
else
|
||||
warning("[src] signs ([signs]) didn't match contents")
|
||||
signs = 0
|
||||
update_icon()
|
||||
|
||||
updateUsrDialog()
|
||||
|
||||
|
||||
/obj/structure/janitorialcart/update_icon()
|
||||
overlays = null
|
||||
if(mybag)
|
||||
overlays += "cart_garbage"
|
||||
if(mymop)
|
||||
overlays += "cart_mop"
|
||||
if(signs)
|
||||
overlays += "cart_sign"
|
||||
|
||||
|
||||
//old style retardo-cart
|
||||
/obj/structure/stool/bed/chair/janicart
|
||||
name = "janicart"
|
||||
icon = 'icons/obj/vehicles.dmi'
|
||||
@@ -8,6 +124,8 @@
|
||||
//copypaste sorry
|
||||
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
|
||||
var/obj/item/weapon/storage/bag/trash/mybag = null
|
||||
var/callme = "pimpin' ride" //how do people refer to it?
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/New()
|
||||
handle_rotation()
|
||||
@@ -19,25 +137,26 @@
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/examine()
|
||||
set src in usr
|
||||
usr << "\icon[src] This pimpin' ride contains [reagents.total_volume] unit\s of water!"
|
||||
usr << "\icon[src] This [callme] contains [reagents.total_volume] unit\s of water!"
|
||||
if(mybag)
|
||||
usr << "\A [mybag] is hanging on the pimpin' ride."
|
||||
usr << "\A [mybag] is hanging on the [callme]."
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/mop))
|
||||
if(reagents.total_volume >= 2)
|
||||
reagents.trans_to(W, 2)
|
||||
user << "<span class='notice'>You wet the mop in the pimpin' ride.</span>"
|
||||
playsound(src.loc, 'sound/effects/slosh.ogg', 25, 1)
|
||||
if(reagents.total_volume < 1)
|
||||
user << "<span class='notice'>This pimpin' ride is out of water!</span>"
|
||||
else if(istype(W, /obj/item/key))
|
||||
user << "Hold [W] in one of your hands while you drive this pimpin' ride."
|
||||
else if(istype(W, /obj/item/weapon/storage/bag/trash))
|
||||
user << "<span class='notice'>You hook the trashbag onto the pimpin' ride.</span>"
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/attackby(obj/item/I, mob/user)
|
||||
if(istype(I, /obj/item/weapon/mop))
|
||||
if(reagents.total_volume > 1)
|
||||
reagents.trans_to(I, 2)
|
||||
user << "<span class='notice'>You wet [I] in the [callme].</span>"
|
||||
playsound(loc, 'sound/effects/slosh.ogg', 25, 1)
|
||||
else
|
||||
user << "<span class='notice'>This [callme] is out of water!</span>"
|
||||
else if(istype(I, /obj/item/key))
|
||||
user << "Hold [I] in one of your hands while you drive this [callme]."
|
||||
else if(istype(I, /obj/item/weapon/storage/bag/trash))
|
||||
user << "<span class='notice'>You hook the trashbag onto the [callme].</span>"
|
||||
user.drop_item()
|
||||
W.loc = src
|
||||
mybag = W
|
||||
I.loc = src
|
||||
mybag = I
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/attack_hand(mob/user)
|
||||
@@ -57,7 +176,8 @@
|
||||
update_mob()
|
||||
handle_rotation()
|
||||
else
|
||||
user << "<span class='notice'>You'll need the keys in one of your hands to drive this pimpin' ride.</span>"
|
||||
user << "<span class='notice'>You'll need the keys in one of your hands to drive this [callme].</span>"
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/Move()
|
||||
..()
|
||||
@@ -65,6 +185,7 @@
|
||||
if(buckled_mob.buckled == src)
|
||||
buckled_mob.loc = loc
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/buckle_mob(mob/M, mob/user)
|
||||
if(M != user || !ismob(M) || get_dist(src, user) > 1 || user.restrained() || user.lying || user.stat || M.buckled || istype(user, /mob/living/silicon))
|
||||
return
|
||||
@@ -72,8 +193,8 @@
|
||||
unbuckle()
|
||||
|
||||
M.visible_message(\
|
||||
"<span class='notice'>[M] climbs onto the pimpin' ride!</span>",\
|
||||
"<span class='notice'>You climb onto the pimpin' ride!</span>")
|
||||
"<span class='notice'>[M] climbs onto the [callme]!</span>",\
|
||||
"<span class='notice'>You climb onto the [callme]!</span>")
|
||||
M.buckled = src
|
||||
M.loc = loc
|
||||
M.dir = dir
|
||||
@@ -81,7 +202,7 @@
|
||||
buckled_mob = M
|
||||
update_mob()
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/unbuckle()
|
||||
if(buckled_mob)
|
||||
@@ -89,6 +210,7 @@
|
||||
buckled_mob.pixel_y = 0
|
||||
..()
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/handle_rotation()
|
||||
if(dir == SOUTH)
|
||||
layer = FLY_LAYER
|
||||
@@ -102,6 +224,7 @@
|
||||
|
||||
update_mob()
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/proc/update_mob()
|
||||
if(buckled_mob)
|
||||
buckled_mob.dir = dir
|
||||
@@ -119,11 +242,13 @@
|
||||
buckled_mob.pixel_x = -13
|
||||
buckled_mob.pixel_y = 7
|
||||
|
||||
|
||||
/obj/structure/stool/bed/chair/janicart/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(buckled_mob)
|
||||
if(prob(65))
|
||||
if(prob(85))
|
||||
return buckled_mob.bullet_act(Proj)
|
||||
visible_message("<span class='warning'>[Proj] ricochets off the pimpin' ride!</span>")
|
||||
visible_message("<span class='warning'>[Proj] ricochets off the [callme]!</span>")
|
||||
|
||||
|
||||
/obj/item/key
|
||||
name = "key"
|
||||
|
||||
Reference in New Issue
Block a user