mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 02:24:11 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
135 lines
5.2 KiB
Plaintext
135 lines
5.2 KiB
Plaintext
#define MANUFACTURING_FAIL 0
|
|
#define MANUFACTURING_SUCCESS 1
|
|
|
|
#define MANUFACTURING_TURF_LAG_LIMIT 10 // max items on a turf before we consider it full
|
|
|
|
/obj/machinery/power/manufacturing
|
|
icon = 'icons/obj/machines/manufactorio.dmi'
|
|
name = "base manufacture receiving type"
|
|
desc = "this shouldnt exist"
|
|
density = TRUE
|
|
/// Do we add the simple_rotation component and a text that we are powered by cable? Also allows unwrenching
|
|
var/may_be_moved = TRUE
|
|
/// Allow taking in mobs from conveyors?
|
|
var/allow_mob_bump_intake = FALSE
|
|
|
|
/obj/machinery/power/manufacturing/Initialize(mapload)
|
|
. = ..()
|
|
if(may_be_moved)
|
|
AddElement(/datum/element/simple_rotation)
|
|
if(anchored)
|
|
connect_to_network()
|
|
|
|
/obj/machinery/power/manufacturing/examine(mob/user)
|
|
. = ..()
|
|
if(may_be_moved)
|
|
. += "It receives power via cable, but certain buildings do not need power."
|
|
. += length(contents - circuit) ? "It contains:" : "It contains no items."
|
|
for(var/atom/movable/thing as anything in contents - circuit)
|
|
var/text = thing.name
|
|
var/obj/item/stack/possible_stack = thing
|
|
if(istype(possible_stack))
|
|
text = "[possible_stack.amount] [text]"
|
|
. += text
|
|
|
|
|
|
/obj/machinery/power/manufacturing/Bumped(atom/movable/bumped_atom) //attempt to put in whatever is pushed into us via conveyor
|
|
. = ..()
|
|
if((!allow_mob_bump_intake && ismob(bumped_atom)) || !anchored) //only uncomment if youre brave
|
|
return
|
|
var/conveyor = locate(/obj/machinery/conveyor) in bumped_atom.loc
|
|
if(isnull(conveyor))
|
|
return
|
|
receive_resource(bumped_atom, bumped_atom.loc, get_dir(src, bumped_atom))
|
|
|
|
/obj/machinery/power/manufacturing/wrench_act(mob/living/user, obj/item/tool)
|
|
. = ..()
|
|
if(!may_be_moved)
|
|
return
|
|
default_unfasten_wrench(user, tool)
|
|
if(anchored)
|
|
connect_to_network()
|
|
else
|
|
disconnect_from_network()
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/machinery/power/manufacturing/screwdriver_act(mob/living/user, obj/item/tool)
|
|
return default_deconstruction_screwdriver(user, tool)
|
|
|
|
/obj/machinery/power/manufacturing/setDir(newdir)
|
|
. = ..()
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
|
|
/obj/machinery/power/manufacturing/crowbar_act(mob/living/user, obj/item/tool)
|
|
return default_deconstruction_crowbar(user, tool)
|
|
|
|
/obj/machinery/power/manufacturing/proc/generate_io_overlays(direction, color, offsets_override)
|
|
var/list/dir_offset
|
|
if(islist(offsets_override))
|
|
dir_offset = offsets_override
|
|
else
|
|
dir_offset = dir2offset(direction)
|
|
dir_offset[1] *= 32
|
|
dir_offset[2] *= 32
|
|
var/image/nonemissive = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_[direction]")
|
|
nonemissive.pixel_w = dir_offset[1]
|
|
nonemissive.pixel_z = dir_offset[2]
|
|
nonemissive.color = color
|
|
var/mutable_appearance/emissive = emissive_appearance(nonemissive.icon, nonemissive.icon_state, offset_spokesman = src, alpha = nonemissive.alpha)
|
|
emissive.pixel_w = nonemissive.pixel_w
|
|
emissive.pixel_z = nonemissive.pixel_z
|
|
return list(nonemissive, emissive)
|
|
|
|
/// Returns whatever object it may output, or null if it cant do that
|
|
/obj/machinery/power/manufacturing/proc/request_resource()
|
|
|
|
|
|
/obj/machinery/power/manufacturing/proc/receive_resource(atom/movable/receiving, atom/from, receive_dir)
|
|
CRASH("Unimplemented!") //check can_receive_resource here
|
|
|
|
//use dir please
|
|
/obj/machinery/power/manufacturing/proc/send_resource(atom/movable/sending, atom/what_or_dir)
|
|
if(isobj(what_or_dir))
|
|
var/obj/machinery/power/manufacturing/target = what_or_dir
|
|
return target.receive_resource(sending, src, get_step(src, what_or_dir))
|
|
var/turf/next_turf = isturf(what_or_dir) ? what_or_dir : get_step(src, what_or_dir)
|
|
var/obj/machinery/power/manufacturing/manufactury = locate(/obj/machinery/power/manufacturing) in next_turf
|
|
if(!isnull(manufactury))
|
|
if(!manufactury.anchored)
|
|
return MANUFACTURING_FAIL
|
|
return manufactury.receive_resource(sending, src, isturf(what_or_dir) ? get_dir(src, what_or_dir) : what_or_dir)
|
|
if(next_turf.is_blocked_turf(exclude_mobs = TRUE, source_atom = sending) && !ischasm(next_turf))
|
|
return MANUFACTURING_FAIL
|
|
if(length(get_overfloor_objects(next_turf)) >= MANUFACTURING_TURF_LAG_LIMIT)
|
|
return MANUFACTURING_FAIL
|
|
if(isnull(sending))
|
|
return MANUFACTURING_SUCCESS // for the sake of being used as a check
|
|
if(isnull(sending.loc) || !sending.Move(next_turf, get_dir(src, next_turf)))
|
|
sending.forceMove(next_turf)
|
|
return MANUFACTURING_SUCCESS
|
|
|
|
/// Checks if this stack (if not a stack does not do anything) can merge WITHOUT creating two stacks in contents
|
|
/obj/machinery/power/manufacturing/proc/may_merge_in_contents(obj/item/stack/stack)
|
|
if(!istype(stack))
|
|
return
|
|
for(var/obj/item/stack/other in contents - circuit)
|
|
if(!stack.can_merge(other))
|
|
continue
|
|
if(other.amount + stack.amount <= other.max_amount)
|
|
return other
|
|
|
|
/obj/machinery/power/manufacturing/proc/may_merge_in_contents_and_do_so(obj/item/stack/stack)
|
|
var/merging_into = may_merge_in_contents(stack)
|
|
if(isnull(merging_into))
|
|
return
|
|
return stack.merge(merging_into)
|
|
|
|
/obj/machinery/power/manufacturing/proc/get_overfloor_objects(turf/target)
|
|
. = list()
|
|
if(isnull(target))
|
|
target = get_turf(src)
|
|
for(var/atom/movable/thing as anything in target.contents)
|
|
if(thing == src || isliving(thing) || iseffect(thing) || thing.invisibility >= INVISIBILITY_ABSTRACT || HAS_TRAIT(thing, TRAIT_UNDERFLOOR))
|
|
continue
|
|
. += thing
|