mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-23 23:54:45 +00:00
## What's going on here Kept you waitin huh! This pr resprites most all walls, windows and other "wall adjacent" things to a 3/4th perspective, technical term is "tall" walls (we are very smart). If you're trying to understand the technical details here, much of the "rendering tech" is built off the idea of split-vis. Basically, split a sprite up and render it on adjacent turfs, to prevent seeing "through" walls/doors, and to support seeing "edges" without actually seeing the atom itself. Most of the rest of it is pipelining done to accommodate how icons are cut. ## Path To Merge Almost* all sprites and code is done at this point. There are some things missing both on and off the bounty list, but that will be the case forever unless we force upstream (you guys) to stop adding new shit that doesn't fit the style. I plan on accepting and integrating prs to the current working repo <https://github.com/wall-nerds/wallening> up until a merge, to make contribution simpler and allow things like bounties to close out more easily This pr is quite bulky, even stripping away map changes it's maybe 7000 LOC (We have a few maps that were modified with UpdatePaths, I am also tentatively pring our test map, for future use.) This may inhibit proper review, although that is part of why I am willing to make it despite my perfectionism. Apologies in advance. Due to the perspective shift, a lot of mapping work is going to need to be done at some point. This comes in varying levels of priority. Many wallmounts are offset by hand, some are stuck in the wall/basically cannot be placed on the east/west/north edges of walls (posters), some just don't look great good in their current position. Tests are currently a minor bit yorked, I thought it was more important to get this up then to clean them fully. ## What does it look like?       ## Credits <details> <summary>Historical Mumbojumbo</summary> I am gonna do my best to document how this project came to be. I am operating off third party info and half remembered details, so if I'm wrong please yell at me. This project started sometime in late 2020, as a product of Rohesie trying to integrate and make easier work from Mojave Sun (A recently defunct fallout server) with /tg/. Mojave Sun (Apparently this was LITERALLY JUST infrared baron, that man is insane) was working with tall walls, IE walls that are 48px tall instead of the normal 32. This was I THINK done based off a technical prototype from aao7 proving A it was possible and B it didn't look like dogwater. This alongside oranges begging the art team for 3/4th walls (he meant TGMC style) lead to Rohesie bringing on contributors from general /tg/, including actionninja who would eventually take over as technical lead and Kryson, who would define /tg/'s version of the artstyle. Much of the formative aspects of this project are their work. The project was coming along pretty well for a few months, but ran into serious technical issues with `SIDE_MAP`, a byond map_format that allows for simpler 3/4th rendering. Due to BULLSHIT I will not detail here, the map format caused issues both at random with flickering and heavily with multiz. Concurrent with this, action stepped down after hacking out the rendering tech and starting work on an icon cutter that would allow for simpler icon generation, leaving ninjanomnom to manage the project. Some time passed, and the project stalled out due to the technical issues. Eventually I built a test case for the issues we had with `SIDE_MAP` and convinced lummox jr (byond's developer) to explain how the fuckin thing actually worked. This understanding made the project theoretically possible, but did not resolve the problems with multi-z. Resolving those required a full rework of how rendering like, worked. I (alongside tattle) took over project development from ninjanomnom at this time, and started work on Plane Cube (#69115), which when finished would finally make the project technically feasible. The time between then and now has been slow, progressive work. Many many artists and technical folks have dumped their time into this (as you can see from the credits). I will get into this more below but I would like to explicitly thank (in no particular order) tattle, draco, arcanemusic, actionninja, imaginos, viro and kylerace for keeping the project alive in this time period. I would have curled up into a ball and died if I had to do this all myself, your help has been indispensable. </details> <details> <summary>Detailed Credits</summary> Deep apologies if I have forgotten someone (I am sure I have, if someone is you please contact me). I've done my best to collate from the git log/my memory. Thanks to (In no particular order): Raccoff: Being funny to bully, creating threshold decals for airlocks aa07: (I think) inspiring the project ActionNinja: Laying the technical rock we build off, supporting me despite byond trying to kill him, building the icon cutter that makes this possible ArcaneMusic: Artistic and technical work spanning from the project's start to literally today, being a constant of motivation and positivity. I can't list all the stuff he's done Armhulen: Key rendering work (he's the reason thindows render right), an upbeat personality and a kick in the ass. Love you arm Azlan: Damn cool sprites, consistently Ben10Omintrix: You know ben showed up just to make basic mobs work, he's just fuckin like that man BigBimmer: A large amount of bounty work, alongside just like, throwing shit around. An absolute joy to work with Capsandi: Plaques, blastdoors, artistic work early on CapybaraExtravagante: Rendering work on wall frames Draco: SO MUCH STUFF. Much of the spritework done over the past two years is his, constantly engaged and will take on anything. I would have given up if not for you Floyd: Early rendering work, so early I don't even know the details. Enjoy freedom brother Imaginos16: A guiding hand through the middle years, handled much of the sprite review and contribution for a good bit there Iamgoofball: A dedication to detail and aesthetic goals, spends a lot of effort dissecting feedback with a focus on making things as good as they can be at the jump Infrared: Part of the impetus for the project, made all the xenomorph stuff in the MS style Jacquerel: A bunch of little upkeep/technical things, has done so much sprite gruntwork (WHY ARE THERE SO MANY PAINTING TYPES) Justice12354: Solved a bunch of error sprites (and worked out how to actually make prs to the project) Thanks bro! Kryson: Built the artstyle of the project, carrying on for years even when it was technically dying, only stopping to casually beat cancer. So much of our style and art is Kryson KylerAce: Handled annoying technical stuff for me, built window frame logic and fully got rid of grilles. LemonInTheDark: Rendering dirtywork, project management and just so much fucking time in dreammaker editing sprites Meyhazah: Table buttons, brass windows and alll the old style doors Mothblocks: Has provided constant support, gave me a deadline and motivation, erased worries about "it not being done", gave just SO much money to fill in the critical holes in sprites. Thanks moth MTandi: Contributed art despite his own blackjack and hookers club opening right down the road, I'm sorry I rolled over some of your sprites man I wish we had finished earlier Ninjanomnomnom: Consulted on gags issues, kept things alive through some truly shit times oranges: This is his fault Rohesie: Organized the effort, did much of the initial like, proof of concept stuff. I hope you're doin well whatever you're up to. san7890: Consulting on mapper UX/design problems, being my pet mapper Senefi: Offsetting items with a focus on detail/the more unused canidates SimplyLogan: Detailed map work and mapper feedback, personally very kind even if we end up talking past each other sometimes. Thank you! SpaceSmithers: Just like, random mapping support out of nowhere, and bein a straight up cool dude Tattle: A bunch of misc project management stuff, organizing the discord, managing the test server, dealing with all the mapping bullshit for me, being my backup in case of bus. I know you think you didn't do much but your presence and work have been a great help Thunder12345: Came out of nowhere and just so much of the random bounties, I'm kind of upset about how much we paid him Time-Green: I hooked him in by fucking with stuff he made and now he's just doin shit, thanks for helping out man! Twaticus: Provided artistic feedback and authority for my poor feeble coder brain, believed in the project for YEARS, was a constant source of ❤️ and affirmation unit0016: I have no god damn idea who she is, popped out of nowhere on the github one day and dealt with a bunch of annoying rendering/refactoring. Godspeed random furry thank you for all your effort and issue reports Viro: A bunch of detailed spriting moving towards 3/4ths, both on and off the wallening fork. If anyone believed this project would be done, it was viro Wallem: Artistic review and consultation, was my go-to guy for a long time when the other two spritetainers were inactive Waltermeldon: Cracked out a bunch of rendering work, he's the reason windows look like not dogwater. Alongside floyd and action spent a TON of time speaking to lummox/unearthing how byond rendering worked trying to make this thing happen ZephyrTFA: Added directional airlock helpers, dealt with a big fuckin bugaboo that was living in my brain like it was nothing. Love you brother And finally: The Mojave Sun development team. They provided a testbed for the idea, committed hundreds and hundreds of hours to the artstyle, and were a large reason we caught issues early enough to meaningfully deal with them. Your work is a testament to what longterm effort and deep detailed care produce. I hope you're doing well whatever you're up to. Go out with a bang! </details> ## Changelog 🆑 Raccoff, aa07, ActionNinja, ArcaneMusic, Armhulen, Azlan, Ben10Omintrix, BigBimmer, Capsandi, CapybaraExtravagante, Draco, Floyd, Iamgoofball, Imaginos16, Infrared, Jacquerel, Justice12354, Kryson, KylerAce, LemonInTheDark, Meyhazah, Mothblocks, MTandi, Ninjanomnom, oranges, Rohesie, Runi-c, san7890, Senefi, SimplyLogan, SomeAngryMiner, SpaceSmithers, Tattle, Thunder12345, Time-Green, Twaticus, unit0016, Viro, Waltermeldon, ZephyrTFA with thanks to the Mojave Sun team! add: Resprites or offsets almost all "tall" objects in the game to match a 3/4ths perspective add: Bunch of rendering mumbo jumbo to make said 3/4ths perspective work /🆑 --------- Co-authored-by: Jacquerel <hnevard@gmail.com> Co-authored-by: san7890 <the@san7890.com> Co-authored-by: = <stewartareid@outlook.com> Co-authored-by: Capsandi <dansullycc@gmail.com> Co-authored-by: ArcaneMusic <hero12290@aol.com> Co-authored-by: tattle <66640614+dragomagol@users.noreply.github.com> Co-authored-by: SomeAngryMiner <53237389+SomeAngryMiner@users.noreply.github.com> Co-authored-by: KylerAce <kylerlumpkin1@gmail.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: Runi-c <5150427+Runi-c@users.noreply.github.com> Co-authored-by: Roryl-c <5150427+Roryl-c@users.noreply.github.com> Co-authored-by: tattle <article.disaster@gmail.com> Co-authored-by: Senefi <20830349+Peliex@users.noreply.github.com> Co-authored-by: Justice <42555530+Justice12354@users.noreply.github.com> Co-authored-by: BluBerry016 <50649185+unit0016@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com> Co-authored-by: Rob Bailey <github@criticalaction.net> Co-authored-by: MMMiracles <lolaccount1@hotmail.com>
398 lines
13 KiB
Plaintext
398 lines
13 KiB
Plaintext
//RAPID TILING DEVICE
|
|
|
|
/// time taken to create tile
|
|
#define CONSTRUCTION_TIME(cost)((cost * 0.15) SECONDS)
|
|
/// time taken to destroy a tile
|
|
#define DECONSTRUCTION_TIME(cost)((cost * 0.25) SECONDS)
|
|
|
|
/**
|
|
* An tool used to create, destroy, and copy & clear decals of floor tiles
|
|
* Great for janitor but can be made only in engineering
|
|
* Supports silo link upgrade and refill with glass, plasteel & iron
|
|
*/
|
|
/obj/item/construction/rtd
|
|
name = "rapid-tiling-device (RTD)"
|
|
desc = "Used for fast placement & destruction of floor tiles."
|
|
icon = 'icons/obj/tools.dmi'
|
|
icon_state = "rtd"
|
|
worn_icon_state = "RCD"
|
|
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
|
custom_premium_price = PAYCHECK_COMMAND * 3
|
|
max_matter = 350
|
|
slot_flags = ITEM_SLOT_BELT
|
|
item_flags = NO_MAT_REDEMPTION | NOBLUDGEON
|
|
has_ammobar = TRUE
|
|
banned_upgrades = RCD_ALL_UPGRADES & ~RCD_UPGRADE_SILO_LINK
|
|
|
|
/// main category for tile design
|
|
var/root_category = "Conventional"
|
|
/// sub category for tile design
|
|
var/design_category = "Standard"
|
|
/// design selected by player
|
|
var/datum/tile_info/selected_design
|
|
/// temp var to store an single design from GLOB.floor_design while iterating through this list
|
|
var/datum/tile_info/tile_design
|
|
/// overlays on a tile
|
|
var/list/design_overlays = list()
|
|
|
|
/// stores the name, type, icon & cost for each tile type
|
|
/datum/tile_info
|
|
/// name of this tile design for ui
|
|
var/name
|
|
/// path to create this tile type
|
|
var/obj/item/stack/tile/tile_type
|
|
/// icon for this tile to display for ui
|
|
var/icon_state
|
|
/// rcd units to consume for this tile creation
|
|
var/cost
|
|
|
|
///directions this tile can be placed on the turf
|
|
var/list/tile_directions
|
|
/// user friendly names of the tile_directions to be sent to ui
|
|
var/list/ui_directional_data
|
|
/// current direction this tile should be rotated in before being placed on the plating
|
|
var/selected_direction
|
|
|
|
/// decompress a single tile design list element from GLOB.floor_designs into its individual variables
|
|
/datum/tile_info/proc/set_info(list/design)
|
|
name = design["name"]
|
|
tile_type = design["type"]
|
|
icon_state = initial(tile_type.icon_state)
|
|
cost = design["tile_cost"]
|
|
|
|
tile_directions = design["tile_rotate_dirs"]
|
|
if(!tile_directions)
|
|
selected_direction = null
|
|
ui_directional_data = null
|
|
return
|
|
|
|
ui_directional_data = list()
|
|
for(var/tile_direction in tile_directions)
|
|
ui_directional_data += dir2text(tile_direction)
|
|
selected_direction = tile_directions[1]
|
|
|
|
/// fill all information to be sent to the UI
|
|
/datum/tile_info/proc/fill_ui_data(list/data)
|
|
data["selected_recipe"] = name
|
|
data["selected_icon"] = get_icon_state()
|
|
|
|
if(!tile_directions)
|
|
data["selected_direction"] = null
|
|
return
|
|
|
|
data["tile_dirs"] = ui_directional_data
|
|
data["selected_direction"] = dir2text(selected_direction)
|
|
|
|
/// change the direction the tile is laid on the turf
|
|
/datum/tile_info/proc/set_direction(direction)
|
|
if(tile_directions == null || !(direction in tile_directions))
|
|
return
|
|
selected_direction = direction
|
|
|
|
/**
|
|
* retrieve the icon for this tile design based on its direction
|
|
* for complex directions like NORTHSOUTH etc we create an seperated blended icon in the asset file for example floor-northsouth
|
|
* so we check which icons we want to retrieve based on its direction
|
|
* for basic directions its rotated with CSS so there is no need for icon
|
|
*/
|
|
/datum/tile_info/proc/get_icon_state()
|
|
var/prefix = ""
|
|
if(selected_direction)
|
|
prefix = (selected_direction in GLOB.tile_dont_rotate) ? "" : "-[dir2text(selected_direction)]"
|
|
return icon_state + prefix
|
|
|
|
///convinience proc to quickly convert the tile design into an physical tile to lay on the plating
|
|
/datum/tile_info/proc/new_tile(loc)
|
|
var/obj/item/stack/tile/final_tile = new tile_type(loc, 1)
|
|
final_tile.turf_dir = selected_direction
|
|
return final_tile
|
|
|
|
/**
|
|
* Stores the decal & overlays on the floor to preserve texture of the design
|
|
* in short its just an wrapper for mutable appearance where we retrieve the nessassary information
|
|
* to recreate an mutable appearance
|
|
*/
|
|
/datum/overlay_info
|
|
/// icon var of the mutable appearance
|
|
var/icon/icon
|
|
/// icon_state var of the mutable appearance
|
|
var/icon_state
|
|
/// direction var of the mutable appearance
|
|
var/direction
|
|
/// alpha var of the mutable appearance
|
|
var/alpha
|
|
/// color var of the mutable appearance
|
|
var/color
|
|
|
|
//decompressing nessasary information required to re-create an mutable appearance
|
|
/datum/overlay_info/New(mutable_appearance/appearance)
|
|
icon = appearance.icon
|
|
icon_state = appearance.icon_state
|
|
alpha = appearance.alpha
|
|
direction = appearance.dir
|
|
color = appearance.color
|
|
|
|
/// re create the appearance
|
|
/datum/overlay_info/proc/add_decal(turf/the_turf)
|
|
the_turf.AddElement(/datum/element/decal, icon, icon_state, direction, null, null, alpha, color, null, null, null, FALSE, null)
|
|
|
|
/obj/item/construction/rtd/Initialize(mapload)
|
|
. = ..()
|
|
selected_design = new
|
|
tile_design = new
|
|
selected_design.set_info(GLOB.floor_designs[root_category][design_category][1])
|
|
|
|
/obj/item/construction/rtd/Destroy()
|
|
QDEL_NULL(selected_design)
|
|
QDEL_NULL(tile_design)
|
|
QDEL_LIST(design_overlays)
|
|
. = ..()
|
|
|
|
/obj/item/construction/rtd/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "RapidTilingDevice", name)
|
|
ui.open()
|
|
|
|
|
|
/obj/item/construction/rtd/ui_assets(mob/user)
|
|
return list(
|
|
get_asset_datum(/datum/asset/spritesheet/rtd),
|
|
)
|
|
|
|
/obj/item/construction/rtd/attack_self(mob/user)
|
|
. = ..()
|
|
ui_interact(user)
|
|
|
|
/obj/item/construction/rtd/ui_static_data(mob/user)
|
|
var/list/data = ..()
|
|
|
|
data["root_categories"] = list()
|
|
for(var/category in GLOB.floor_designs)
|
|
data["root_categories"] += category
|
|
data["selected_root"] = root_category
|
|
|
|
data["categories"] = list()
|
|
for(var/sub_category as anything in GLOB.floor_designs[root_category])
|
|
var/list/target_category = GLOB.floor_designs[root_category][sub_category]
|
|
|
|
var/list/designs = list() //initialize all designs under this category
|
|
for(var/list/design as anything in target_category)
|
|
tile_design.set_info(design)
|
|
designs += list(list("name" = tile_design.name, "icon" = tile_design.get_icon_state()))
|
|
|
|
data["categories"] += list(list("category_name" = sub_category, "recipes" = designs))
|
|
|
|
return data
|
|
|
|
/obj/item/construction/rtd/ui_data(mob/user)
|
|
var/list/data = ..()
|
|
|
|
data["selected_category"] = design_category
|
|
selected_design.fill_ui_data(data)
|
|
|
|
return data
|
|
|
|
/obj/item/construction/rtd/handle_ui_act(action, params, datum/tgui/ui, datum/ui_state/state)
|
|
|
|
var/floor_designs = GLOB.floor_designs
|
|
switch(action)
|
|
if("root_category")
|
|
var/new_root = params["root_category"]
|
|
if(floor_designs[new_root] != null) //is a valid category
|
|
root_category = new_root
|
|
update_static_data_for_all_viewers()
|
|
|
|
if("set_dir")
|
|
var/direction = text2dir(params["dir"])
|
|
if(!direction)
|
|
return TRUE
|
|
selected_design.set_direction(direction)
|
|
|
|
if("recipe")
|
|
var/list/main_root = floor_designs[root_category]
|
|
if(main_root == null)
|
|
return TRUE
|
|
var/list/sub_category = main_root[params["category_name"]]
|
|
if(sub_category == null)
|
|
return TRUE
|
|
var/list/target_design = sub_category[text2num(params["id"])]
|
|
if(target_design == null)
|
|
return
|
|
|
|
QDEL_LIST(design_overlays)
|
|
design_category = params["category_name"]
|
|
selected_design.set_info(target_design)
|
|
blueprint_changed = TRUE
|
|
|
|
return TRUE
|
|
|
|
/obj/item/construction/rtd/ranged_interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
|
if(!range_check(interacting_with, user))
|
|
return NONE
|
|
return try_tiling(interacting_with, user)
|
|
|
|
/obj/item/construction/rtd/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
|
. = ..()
|
|
if(. & ITEM_INTERACT_ANY_BLOCKER)
|
|
return .
|
|
|
|
return try_tiling(interacting_with, user)
|
|
|
|
/obj/item/construction/rtd/proc/try_tiling(atom/interacting_with, mob/living/user)
|
|
var/turf/open/floor/floor = interacting_with
|
|
if(!istype(floor))
|
|
return NONE
|
|
|
|
var/floor_designs = GLOB.floor_designs
|
|
if(!istype(floor, /turf/open/floor/plating)) //we infer what floor type it is if its not the usual plating
|
|
user.Beam(floor, icon_state = "light_beam", time = 5)
|
|
for(var/main_root in floor_designs)
|
|
for(var/sub_category in floor_designs[main_root])
|
|
for(var/list/design_info in floor_designs[main_root][sub_category])
|
|
var/obj/item/stack/tile/tile_type = design_info["type"]
|
|
if(initial(tile_type.turf_type) != floor.type)
|
|
continue
|
|
|
|
//infer available overlays on the floor to recreate them to the best extent
|
|
QDEL_LIST(design_overlays)
|
|
var/floor_overlays = floor.managed_overlays
|
|
if(isnull(floor_overlays))
|
|
floor_overlays = list()
|
|
else if(!islist(floor_overlays))
|
|
floor_overlays = list(floor.managed_overlays)
|
|
for(var/mutable_appearance/appearance as anything in floor_overlays)
|
|
design_overlays += new /datum/overlay_info(appearance)
|
|
|
|
//store all information about this tile
|
|
root_category = main_root
|
|
design_category = sub_category
|
|
selected_design.set_info(design_info)
|
|
selected_design.set_direction(floor.dir)
|
|
balloon_alert(user, "tile changed to [selected_design.name]")
|
|
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
//can't infer floor type!
|
|
balloon_alert(user, "design not supported!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
var/delay = CONSTRUCTION_TIME(selected_design.cost)
|
|
var/obj/effect/constructing_effect/rcd_effect = new(floor, delay, RCD_TURF)
|
|
|
|
//resource sanity check before & after delay along with special effects
|
|
if(!checkResource(selected_design.cost, user))
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
var/beam = user.Beam(floor, icon_state = "light_beam", time = delay)
|
|
playsound(loc, 'sound/effects/light_flicker.ogg', 50, FALSE)
|
|
if(!build_delay(user, delay, target = floor))
|
|
qdel(beam)
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(!checkResource(selected_design.cost, user))
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!useResource(selected_design.cost, user))
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
activate()
|
|
//step 1 create tile
|
|
var/obj/item/stack/tile/final_tile = selected_design.new_tile(user.drop_location())
|
|
if(QDELETED(final_tile)) //if you were standing on a stack of tiles this newly spawned tile could get merged with it cause its spawned on your location
|
|
qdel(rcd_effect)
|
|
balloon_alert(user, "tile got merged with the stack beneath you!")
|
|
return ITEM_INTERACT_SUCCESS
|
|
//step 2 lay tile
|
|
var/turf/open/new_turf = final_tile.place_tile(floor, user)
|
|
if(new_turf) //apply infered overlays
|
|
for(var/datum/overlay_info/info in design_overlays)
|
|
info.add_decal(new_turf)
|
|
rcd_effect.end_animation()
|
|
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/item/construction/rtd/ranged_interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers)
|
|
if(!range_check(interacting_with, user))
|
|
return NONE
|
|
return interact_with_atom_secondary(interacting_with, user, modifiers)
|
|
|
|
/obj/item/construction/rtd/interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers)
|
|
var/turf/open/floor/floor = interacting_with
|
|
if(!istype(floor))
|
|
return NONE
|
|
|
|
if(istype(floor, /turf/open/floor/plating)) //cant deconstruct normal plating thats the RCD's job
|
|
balloon_alert(user, "nothing to deconstruct!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
var/floor_designs = GLOB.floor_designs
|
|
|
|
//we only deconstruct floors which are supported by the RTD
|
|
var/cost = 0
|
|
for(var/main_root in floor_designs)
|
|
if(cost)
|
|
break
|
|
for(var/sub_category in floor_designs[main_root])
|
|
if(cost)
|
|
break
|
|
for(var/list/design_info in floor_designs[main_root][sub_category])
|
|
var/obj/item/stack/tile/tile_type = design_info["type"]
|
|
if(initial(tile_type.turf_type) == floor.type)
|
|
cost = design_info["tile_cost"]
|
|
break
|
|
if(!cost)
|
|
balloon_alert(user, "can't deconstruct this type!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
var/delay = DECONSTRUCTION_TIME(cost)
|
|
var/obj/effect/constructing_effect/rcd_effect = new(floor, delay, RCD_DECONSTRUCT)
|
|
|
|
//resource sanity check before & after delay along with beam effects
|
|
if(!checkResource(cost * 0.7, user)) //no ballon alert for checkResource as it already spans an alert to chat
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
var/beam = user.Beam(floor, icon_state = "light_beam", time = delay)
|
|
playsound(loc, 'sound/effects/light_flicker.ogg', 50, FALSE)
|
|
if(!do_after(user, delay, target = floor))
|
|
qdel(beam)
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(!checkResource(cost * 0.7, user))
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
//do the tiling
|
|
if(!useResource(cost * 0.7, user))
|
|
qdel(rcd_effect)
|
|
return ITEM_INTERACT_BLOCKING
|
|
activate()
|
|
//find & collect all decals
|
|
var/list/all_decals = list()
|
|
for(var/obj/effect/decal in floor.contents)
|
|
all_decals += decal
|
|
//delete all decals
|
|
for(var/obj/effect/decal in all_decals)
|
|
floor.contents -= decal
|
|
qdel(decal)
|
|
if(floor.baseturf_at_depth(1) == /turf/baseturf_bottom) //for turfs whose base is open space we put regular plating in its place else everyone dies
|
|
floor.ChangeTurf(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR)
|
|
else //for every other turf we scrape away exposing base turf underneath
|
|
floor.ScrapeAway(flags = CHANGETURF_INHERIT_AIR)
|
|
rcd_effect.end_animation()
|
|
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/item/construction/rtd/loaded
|
|
matter = 350
|
|
|
|
/obj/item/construction/rtd/admin
|
|
name = "admin RTD"
|
|
max_matter = INFINITY
|
|
matter = INFINITY
|
|
|
|
#undef CONSTRUCTION_TIME
|
|
#undef DECONSTRUCTION_TIME
|