mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-28 14:37:27 +01:00
Fixes inconsistant material refunds and removes material cost from door repair (#15511)
* Oops did two different things at once Started out with me fixing improper material refunds on deconstructs, ended with me making doors not cost materials. Oops! * Graaah code fixius I know how new works now * Huge fart on PR I am so good at code huge fartius epic /obj fail I forgor * More effort than it's worth. unless im being lied to...!
This commit is contained in:
@@ -1141,7 +1141,11 @@ About the new airlock wires panel:
|
||||
if(istype(C, /mob/living))
|
||||
..()
|
||||
return
|
||||
if(!repairing && C.has_tool_quality(TOOL_WELDER) && !( src.operating > 0 ) && src.density)
|
||||
//VOREstation Edit: Removing material cost from repair requirements
|
||||
if(C.has_tool_quality(TOOL_WELDER) && !( src.operating > 0 ) && src.density)
|
||||
if(health < maxhealth && user.a_intent == I_HELP)
|
||||
..()
|
||||
return
|
||||
var/obj/item/weapon/weldingtool/W = C.get_welder()
|
||||
if(W.remove_fuel(0,user))
|
||||
if(!src.welded)
|
||||
@@ -1176,7 +1180,7 @@ About the new airlock wires panel:
|
||||
else if(istype(C, /obj/item/weapon/pai_cable)) // -- TLE
|
||||
var/obj/item/weapon/pai_cable/cable = C
|
||||
cable.plugin(src, user)
|
||||
else if(!repairing && C.has_tool_quality(TOOL_CROWBAR))
|
||||
else if(C.has_tool_quality(TOOL_CROWBAR))
|
||||
if(can_remove_electronics())
|
||||
playsound(src, C.usesound, 75, 1)
|
||||
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to remove electronics from the airlock assembly.")
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
var/destroy_hits = 10 //How many strong hits it takes to destroy the door
|
||||
var/min_force = 10 //minimum amount of force needed to damage the door with a melee weapon
|
||||
var/hitsound = 'sound/weapons/smash.ogg' //sound door makes when hit with a weapon
|
||||
var/repairing = 0
|
||||
//var/repairing = 0 //VOREstation Edit: We're not using materials anymore
|
||||
var/block_air_zones = 1 //If set, air zones cannot merge across the door even when it is opened.
|
||||
var/close_door_at = 0 //When to automatically close the door, if possible
|
||||
|
||||
@@ -226,63 +226,21 @@
|
||||
if(istype(I))
|
||||
if(attackby_vr(I, user)) //VOREStation begin: Fireproofing
|
||||
return //VOREStation begin: Fireproofing
|
||||
if(istype(I, /obj/item/stack/material) && I.get_material_name() == src.get_material_name())
|
||||
if(stat & BROKEN)
|
||||
to_chat(user, "<span class='notice'>It looks like \the [src] is pretty busted. It's going to need more than just patching up now.</span>")
|
||||
return
|
||||
if(health >= maxhealth)
|
||||
to_chat(user, "<span class='notice'>Nothing to fix!</span>")
|
||||
return
|
||||
if(!density)
|
||||
to_chat(user, "<span class='warning'>\The [src] must be closed before you can repair it.</span>")
|
||||
return
|
||||
|
||||
//figure out how much metal we need
|
||||
var/amount_needed = (maxhealth - health) / DOOR_REPAIR_AMOUNT
|
||||
amount_needed = (round(amount_needed) == amount_needed)? amount_needed : round(amount_needed) + 1 //Why does BYOND not have a ceiling proc?
|
||||
|
||||
var/obj/item/stack/stack = I
|
||||
var/amount_given = amount_needed - repairing
|
||||
var/mats_given = stack.get_amount()
|
||||
if(repairing && amount_given <= 0)
|
||||
to_chat(user, "<span class='warning'>You must weld or remove \the [get_material_name()] from \the [src] before you can add anything else.</span>")
|
||||
else
|
||||
if(mats_given >= amount_given)
|
||||
if(stack.use(amount_given))
|
||||
repairing += amount_given
|
||||
else
|
||||
if(stack.use(mats_given))
|
||||
repairing += mats_given
|
||||
amount_given = mats_given
|
||||
if(amount_given)
|
||||
to_chat(user, "<span class='notice'>You fit [amount_given] [stack.singular_name]\s to damaged and broken parts on \the [src].</span>")
|
||||
|
||||
return
|
||||
|
||||
if(repairing && I.has_tool_quality(TOOL_WELDER))
|
||||
if(health < maxhealth && I.has_tool_quality(TOOL_WELDER))
|
||||
if(!density)
|
||||
to_chat(user, "<span class='warning'>\The [src] must be closed before you can repair it.</span>")
|
||||
return
|
||||
|
||||
var/obj/item/weapon/weldingtool/welder = I.get_welder()
|
||||
if(welder.remove_fuel(0,user))
|
||||
to_chat(user, "<span class='notice'>You start to fix dents and weld \the [get_material_name()] into place.</span>")
|
||||
to_chat(user, "<span class='notice'>You start to fix dents and repair \the [src].</span>")
|
||||
playsound(src, welder.usesound, 50, 1)
|
||||
if(do_after(user, (5 * repairing) * welder.toolspeed) && welder && welder.isOn())
|
||||
var/repairtime = maxhealth - health //Since we're not using materials anymore... We'll just calculate how much damage there is to repair.
|
||||
if(do_after(user, repairtime * welder.toolspeed) && welder && welder.isOn())
|
||||
to_chat(user, "<span class='notice'>You finish repairing the damage to \the [src].</span>")
|
||||
health = between(health, health + repairing*DOOR_REPAIR_AMOUNT, maxhealth)
|
||||
health = maxhealth
|
||||
update_icon()
|
||||
repairing = 0
|
||||
return
|
||||
|
||||
if(repairing && I.has_tool_quality(TOOL_CROWBAR))
|
||||
var/datum/material/mat = get_material()
|
||||
var/obj/item/stack/material/repairing_sheet = mat.place_sheet(loc, repairing)
|
||||
repairing = 0
|
||||
to_chat(user, "<span class='notice'>You remove \the [repairing_sheet].</span>")
|
||||
playsound(src, I.usesound, 100, 1)
|
||||
return
|
||||
|
||||
//psa to whoever coded this, there are plenty of objects that need to call attack() on doors without bludgeoning them.
|
||||
if(src.density && istype(I, /obj/item/weapon) && user.a_intent == I_HURT && !istype(I, /obj/item/weapon/card))
|
||||
var/obj/item/weapon/W = I
|
||||
|
||||
@@ -248,7 +248,12 @@
|
||||
return //Don't open the door if we're putting tape on it to tell people 'don't open the door'.
|
||||
if(operating)
|
||||
return//Already doing something.
|
||||
if(C.has_tool_quality(TOOL_WELDER) && !repairing)
|
||||
if(C.has_tool_quality(TOOL_WELDER))
|
||||
//VOREstation Edit: Removing Material requirements on repairs
|
||||
if(health < maxhealth)
|
||||
..()
|
||||
return
|
||||
//VOREstation Edit End
|
||||
if(prying)
|
||||
to_chat(user, "<span class='notice'>Someone's busy prying that [density ? "open" : "closed"]!</span>")
|
||||
var/obj/item/weapon/weldingtool/W = C.get_welder()
|
||||
@@ -269,7 +274,7 @@
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(blocked && C.has_tool_quality(TOOL_CROWBAR) && !repairing)
|
||||
if(blocked && C.has_tool_quality(TOOL_CROWBAR))
|
||||
if(!hatch_open)
|
||||
to_chat(user, "<span class='danger'>You must open the maintenance hatch first!</span>")
|
||||
else
|
||||
|
||||
@@ -64,10 +64,10 @@
|
||||
/obj/structure/catwalk/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1)
|
||||
new /obj/item/stack/rods(src.loc)
|
||||
new /obj/item/stack/rods(src.loc, 2) //VOREstation Edit: Conservation of mass
|
||||
qdel(src)
|
||||
if(2)
|
||||
new /obj/item/stack/rods(src.loc)
|
||||
new /obj/item/stack/rods(src.loc, 2) //VOREstation Edit: Conservation of mass
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/catwalk/attack_robot(var/mob/user)
|
||||
@@ -77,11 +77,12 @@
|
||||
/obj/structure/catwalk/proc/deconstruct(mob/user)
|
||||
playsound(src, 'sound/items/Welder.ogg', 100, 1)
|
||||
to_chat(user, "<span class='notice'>Slicing \the [src] joints ...</span>")
|
||||
new /obj/item/stack/rods(src.loc)
|
||||
new /obj/item/stack/rods(src.loc)
|
||||
//Lattice would delete itself, but let's save ourselves a new obj
|
||||
if(isspace(loc) || isopenspace(loc))
|
||||
if(isopenspace(loc) && user.a_intent == I_HELP)
|
||||
new /obj/structure/lattice/(src.loc)
|
||||
new /obj/item/stack/rods(src.loc, 1)
|
||||
else
|
||||
new /obj/item/stack/rods(src.loc, 2)
|
||||
if(plated_tile)
|
||||
new plated_tile(src.loc)
|
||||
qdel(src)
|
||||
@@ -200,4 +201,4 @@
|
||||
/obj/effect/catwalk_plated/techfloor
|
||||
icon_state = "catwalk_techfloor"
|
||||
tile = /obj/item/stack/tile/floor/techgrey
|
||||
platecolor = "#363f43"
|
||||
platecolor = "#363f43"
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
reinforcing = 0
|
||||
|
||||
/obj/structure/girder/proc/dismantle()
|
||||
girder_material.place_dismantled_product(get_turf(src))
|
||||
girder_material.place_dismantled_product(get_turf(src), 2) //VOREstation Edit: Conservation of mass
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/girder/attack_hand(mob/user as mob)
|
||||
|
||||
@@ -64,20 +64,12 @@
|
||||
if(WT.welding == 1)
|
||||
if(WT.remove_fuel(0, user))
|
||||
to_chat(user, "<span class='notice'>Slicing lattice joints ...</span>")
|
||||
new /obj/item/stack/rods(src.loc)
|
||||
new /obj/item/stack/rods(src.loc, 1) //VOREstation Edit: Return the same amount of rods used to build this.
|
||||
qdel(src)
|
||||
return
|
||||
if(istype(C, /obj/item/stack/rods))
|
||||
var/obj/item/stack/rods/R = C
|
||||
if(R.get_amount() < 2)
|
||||
to_chat(user, "<span class='notice'>You need at least two rods to form a catwalk here.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You start connecting \the [R.name] to \the [src.name] ...</span>")
|
||||
if(do_after(user, 5 SECONDS))
|
||||
R.use(2) //2023-02-27 bugfix to prevent rods being used without catwalk creation
|
||||
src.alpha = 0 // Note: I don't know why this is set, Eris did it, just trusting for now. ~Leshana
|
||||
new /obj/structure/catwalk(src.loc)
|
||||
qdel(src)
|
||||
if(istype(C, /obj/item/stack/rods)) //VOREstation Edit: Modernizes upgrading lattices into catwalks.
|
||||
upgrade(C, user)
|
||||
//VOREstation Edit End
|
||||
return
|
||||
return
|
||||
|
||||
@@ -98,3 +90,11 @@
|
||||
|
||||
icon_state = "lattice[dir_sum]"
|
||||
return
|
||||
|
||||
//Vorestation Edit: Moves upgrading lattices to their own proc for other stuff to call. Also makes them instant.
|
||||
/obj/structure/lattice/proc/upgrade(obj/item/stack/rods/R, mob/user)
|
||||
to_chat(user, "<span class='notice'>You start connecting \the [R.name] to \the [src.name] ...</span>")
|
||||
R.use(1)
|
||||
src.alpha = 0 // Note: I don't know why this is set, Eris did it, just trusting for now. ~Leshana
|
||||
new /obj/structure/catwalk(src.loc)
|
||||
qdel(src)
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
if(!is_plating()) // Flooring -> Plating
|
||||
swap_decals()
|
||||
if(flooring.build_type && place_product)
|
||||
new flooring.build_type(src)
|
||||
new flooring.build_type(src, flooring.build_cost) //VOREstation Edit: conservation of mass
|
||||
var/newtype = flooring.get_plating_type()
|
||||
if(newtype) // Has a custom plating type to become
|
||||
set_flooring(get_flooring_data(newtype))
|
||||
@@ -182,4 +182,4 @@
|
||||
var/mob/living/livingUser = user
|
||||
if(try_graffiti(livingUser, livingUser.get_active_hand()))
|
||||
return
|
||||
. = ..()
|
||||
. = ..()
|
||||
|
||||
@@ -197,9 +197,10 @@
|
||||
else
|
||||
material.place_dismantled_girder(src, null, girder_material)
|
||||
if(!devastated)
|
||||
material.place_dismantled_product(src)
|
||||
if (!reinf_material)
|
||||
if (reinf_material)
|
||||
material.place_dismantled_product(src)
|
||||
else
|
||||
material.place_dismantled_product(src, 2)
|
||||
|
||||
for(var/obj/O in src.contents) //Eject contents!
|
||||
if(istype(O,/obj/structure/sign/poster))
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
if(istype(C, /obj/item/stack/rods))
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L)
|
||||
L.upgrade(C, user)
|
||||
return
|
||||
var/obj/item/stack/rods/R = C
|
||||
if (R.use(1))
|
||||
|
||||
@@ -37,12 +37,10 @@
|
||||
|
||||
/obj/machinery/door/get_description_interaction()
|
||||
var/list/results = list()
|
||||
if(!repairing && (health < maxhealth) && !(stat & BROKEN))
|
||||
results += "[desc_panel_image("metal sheet")]to start repairing damage (May require different material type)."
|
||||
if(repairing && density)
|
||||
results += "[desc_panel_image("welder")]to finish repairs."
|
||||
results += "[desc_panel_image("crowbar")]to undo adding sheets for repairs."
|
||||
|
||||
//VOREstation Edit: Removing material requirements
|
||||
if((health < maxhealth) && !(stat & BROKEN))
|
||||
results += "[desc_panel_image("welder")]to start repairing damage."
|
||||
//VOREstation Edit End
|
||||
return results
|
||||
|
||||
/obj/machinery/door/airlock/get_description_interaction()
|
||||
|
||||
@@ -321,7 +321,7 @@ var/list/name_to_material
|
||||
|
||||
// General wall debris product placement.
|
||||
// Not particularly necessary aside from snowflakey cult girders.
|
||||
/datum/material/proc/place_dismantled_product(var/turf/target, var/amount = 1)
|
||||
/datum/material/proc/place_dismantled_product(var/turf/target, var/amount = 1) //Added an amount var to this. Lets multi-dropped walls to drop all of their sheets together. Woo!
|
||||
place_sheet(target, amount)
|
||||
|
||||
// Debris product. Used ALL THE TIME.
|
||||
|
||||
Reference in New Issue
Block a user