mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-17 02:54:44 +01:00
Add internals to critter crates; factor more crate code into closets
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
var/breakout_time = 2
|
||||
var/lastbang
|
||||
var/can_weld_shut = 1
|
||||
var/allow_mobs = TRUE
|
||||
var/allow_objects = FALSE
|
||||
var/allow_dense = FALSE
|
||||
var/max_mob_size = MOB_SIZE_HUMAN //Biggest mob_size accepted by the container
|
||||
var/mob_storage_capacity = 3 // how many human sized mob/living can fit together inside a closet.
|
||||
var/storage_capacity = 30 //This is so that someone can't pack hundreds of items in a locker/crate then open it in a populated area to crash clients.
|
||||
@@ -117,27 +120,34 @@
|
||||
if(contents.len >= storage_capacity)
|
||||
return -1
|
||||
|
||||
if(istype(AM, /mob/living))
|
||||
var/mob/living/L = AM
|
||||
if(L.buckled || L.buckled_mob || L.mob_size > max_mob_size) //buckled mobs, mobs with another mob attached, and mobs too big for the container don't get inside closets.
|
||||
return 0
|
||||
if(L.mob_size > MOB_SIZE_TINY) //decently sized mobs take more space than objects.
|
||||
var/mob/living/L = AM
|
||||
if(istype(L))
|
||||
if(L.buckled || L.buckled_mob)
|
||||
return
|
||||
if(L.mob_size > MOB_SIZE_TINY) // Tiny mobs are treated as items.
|
||||
if(!allow_mobs)
|
||||
return
|
||||
if(L.mob_size > max_mob_size)
|
||||
return
|
||||
var/mobs_stored = 0
|
||||
for(var/mob/living/M in contents)
|
||||
mobs_stored++
|
||||
if(mobs_stored >= mob_storage_capacity)
|
||||
return 0
|
||||
L.reset_perspective(src)
|
||||
if(++mobs_stored >= mob_storage_capacity)
|
||||
return
|
||||
L.stop_pulling()
|
||||
else if(!istype(AM, /obj/item) && !istype(AM, /obj/effect/dummy/chameleon))
|
||||
return 0
|
||||
else if(AM.density || AM.anchored)
|
||||
return 0
|
||||
else if(AM.flags & NODROP)
|
||||
return 0
|
||||
else if(istype(AM, /obj/structure/closet))
|
||||
return
|
||||
else
|
||||
if(!allow_objects && !istype(AM, /obj/item) && !istype(AM, /obj/effect/dummy/chameleon))
|
||||
return
|
||||
if(!allow_dense && AM.density)
|
||||
return
|
||||
if(AM.anchored || AM.buckled_mob || (AM.flags & NODROP))
|
||||
return
|
||||
|
||||
AM.forceMove(src)
|
||||
if(AM.pulledby)
|
||||
AM.pulledby.stop_pulling()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/structure/closet/proc/close()
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
icon = 'icons/obj/crates.dmi'
|
||||
icon_state = "crate"
|
||||
req_access = null
|
||||
var/allow_mobs = FALSE
|
||||
can_weld_shut = FALSE
|
||||
allow_mobs = FALSE
|
||||
allow_objects = TRUE
|
||||
allow_dense = TRUE
|
||||
var/obj/item/weapon/paper/manifest/manifest
|
||||
|
||||
/obj/structure/closet/crate/New()
|
||||
@@ -37,22 +40,6 @@
|
||||
else if(!place(user, W))
|
||||
attack_hand(user)
|
||||
|
||||
/obj/structure/closet/crate/insert(atom/movable/AM)
|
||||
if(contents.len >= storage_capacity)
|
||||
return -1
|
||||
|
||||
if(istype(AM, /mob/living))
|
||||
var/mob/living/L = AM
|
||||
if(!allow_mobs || L.buckled || L.buckled_mob)
|
||||
return
|
||||
L.stop_pulling()
|
||||
if(AM.flags & NODROP || AM.density || AM.anchored || AM.buckled_mob || istype(AM, /obj/structure/closet))
|
||||
return
|
||||
AM.forceMove(src)
|
||||
if(AM.pulledby)
|
||||
AM.pulledby.stop_pulling()
|
||||
return 1
|
||||
|
||||
/obj/structure/closet/crate/proc/tear_manifest(mob/user)
|
||||
user << "<span class='notice'>You tear the manifest off of the crate.</span>"
|
||||
playsound(src, 'sound/items/poster_ripped.ogg', 75, 1)
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
/obj/structure/closet/crate/critter
|
||||
name = "critter crate"
|
||||
desc = "A crate designed for safe transport of animals. Only openable from the the outside."
|
||||
desc = "A crate designed for safe transport of animals. It has an oxygen tank for safe transport in space."
|
||||
icon_state = "crittercrate"
|
||||
allow_mobs = TRUE
|
||||
allow_objects = FALSE
|
||||
breakout_time = 1
|
||||
material_drop = /obj/item/stack/sheet/mineral/wood
|
||||
var/obj/item/weapon/tank/internals/emergency_oxygen/tank
|
||||
|
||||
/obj/structure/closet/crate/critter/New()
|
||||
..()
|
||||
tank = new
|
||||
|
||||
/obj/structure/closet/crate/critter/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
tank.loc = T
|
||||
tank = null
|
||||
|
||||
for(var/i in 1 to rand(2, 5))
|
||||
new material_drop(T)
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/structure/closet/crate/critter/update_icon()
|
||||
overlays.Cut()
|
||||
@@ -14,8 +31,8 @@
|
||||
if(manifest)
|
||||
overlays += "manifest"
|
||||
|
||||
/obj/structure/closet/crate/critter/attack_hand(mob/user)
|
||||
if(user in src)
|
||||
user << "<span class='notice'>It won't budge!</span>"
|
||||
/obj/structure/closet/crate/critter/return_air()
|
||||
if(tank)
|
||||
return tank.air_contents
|
||||
else
|
||||
..()
|
||||
return loc.return_air()
|
||||
@@ -9,10 +9,8 @@
|
||||
add_fingerprint(user)
|
||||
if(manifest)
|
||||
tear_manifest(user)
|
||||
return
|
||||
else
|
||||
user << "<span class='warning'>You need a crowbar to pry this open!</span>"
|
||||
return
|
||||
|
||||
/obj/structure/closet/crate/large/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(istype(W, /obj/item/weapon/crowbar))
|
||||
|
||||
Reference in New Issue
Block a user