Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

[MIRROR] Wooden tables now obey The Law of Conservation of Mass #574

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AeonSS13
Copy link

Original PR: tgstation/tgstation#56156

About The Pull Request

Fixes Issue tgstation/tgstation#56152 making wood tables deconstruct at they should be.

Bug vivisection:
Okay, see here? This is the proc for creating a table, we can introduce three arguments. One of them is _buildstack. _buildstack overrides Buildstack on initialize, a variable used for storing the type of raw "ore" that the table is supposed to drop in deconstruction. Here is supposed to be null unless we want to override the buildstack with another ore.

/obj/structure/table_frame/proc/make_new_table(table_type, custom_materials, _buildstack) 
	var/obj/structure/table/T = new table_type(loc, _buildstack)
	T.frame = type
	T.framestack = framestack
	T.framestackamount = framestackamount
	if(custom_materials)
		T.set_custom_materials(custom_materials)
	qdel(src)

What happened? The proc for building a wood table from a wooden frame, shown below, passed the "type" variable, used for storing the type of table_frame, as a _buildstack argument to the make_new_table proc. This overrides the buildstack variable of the final wooden table, causing it to drop a wooden frame as it was an ore on deconstruction.

/obj/structure/table_frame/wood/attackby(obj/item/I, mob/user, params)
[...]
		if (toConstruct)
			if(material.get_amount() < 1)
				to_chat(user, "<span class='warning'>You need one [material.name] sheet to do this!</span>")
				return
			to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
			if(do_after(user, 20, target = src) && material.use(1))
				make_new_table(toConstruct, null, type)

This is funnier (not very much, to be honest) when we consider that deconstructing with a screwdriver would drop a frame normally, causing it to drop two frames. We could repeat this ad nauseam, essentially cloning wood frames in place as we pleased.

So TL;DR: this is another of those simple but hard to hunt bugs that would be prevented with testing and a null on its right place.

If this PR description is too long blame @聽LemonInTheDark

Why It's Good For The Game

A bugfix a day keeps the spaguetti chef away

Changelog

馃啈
fix: Fixed wood table and poker table construction/deconstruction
/:cl:

Manybones and others added 2 commits January 15, 2021 20:42
## About The Pull Request
Fixes Issue tgstation/tgstation#56152 making wood tables deconstruct at they should be.

Bug vivisection:
Okay, see here? This is the proc for creating a table, we can introduce three arguments. One of them is _buildstack. _buildstack overrides Buildstack on initialize, a variable used for storing the type of raw "ore" that the table is supposed to drop in deconstruction. Here is supposed to be null unless we want to override the buildstack with another ore.

```DM
/obj/structure/table_frame/proc/make_new_table(table_type, custom_materials, _buildstack)
	var/obj/structure/table/T = new table_type(loc, _buildstack)
	T.frame = type
	T.framestack = framestack
	T.framestackamount = framestackamount
	if(custom_materials)
		T.set_custom_materials(custom_materials)
	qdel(src)
```

What happened? The proc for building a wood table from a wooden frame, shown below, passed the "type" variable, used for storing the type of table_frame, as a _buildstack argument to the make_new_table proc. This overrides the buildstack variable of the final wooden table, causing it to drop a wooden frame as it was an ore on deconstruction.

```DM
/obj/structure/table_frame/wood/attackby(obj/item/I, mob/user, params)
[...]
		if (toConstruct)
			if(material.get_amount() < 1)
				to_chat(user, "<span class='warning'>You need one [material.name] sheet to do this!</span>")
				return
			to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
			if(do_after(user, 20, target = src) && material.use(1))
				make_new_table(toConstruct, null, type)
```
This is funnier (not very much, to be honest) when we consider that deconstructing with a screwdriver would drop a frame normally, causing it to drop two frames. We could repeat this ad nauseam, essentially cloning wood frames in place as we pleased.

So TL;DR: this is another of those simple but hard to hunt bugs that would be prevented with testing and a null on its right place.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants