Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes stacks/sheets building turfs not calling ChangeTurf #4661

Merged
merged 3 commits into from
Oct 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions code/game/objects/items/stacks/stack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,21 @@ Also change the icon to reflect the amount of sheets, if possible.*/
if(check_one_per_turf(R,usr))
return

var/atom/O = new R.result_type(usr.loc, usr)
usr.visible_message(SPAN_NOTICE("[usr] assembles \a [O]."),
SPAN_NOTICE("You assemble \a [O]."))
O.setDir(usr.dir)
var/atom/new_item
if(ispath(R.result_type, /turf))
var/turf/current_turf = get_turf(usr)
if(!current_turf)
return
new_item = current_turf.ChangeTurf(R.result_type)
else
new_item = new R.result_type(usr.loc, usr)

usr.visible_message(SPAN_NOTICE("[usr] assembles \a [new_item]."),
SPAN_NOTICE("You assemble \a [new_item]."))
new_item.setDir(usr.dir)
if(R.max_res_amount > 1)
var/obj/item/stack/new_item = O
new_item.amount = R.res_amount * multiplier
var/obj/item/stack/new_stack = new_item
new_stack.amount = R.res_amount * multiplier
amount -= R.req_amount * multiplier
update_icon()

Expand All @@ -218,8 +226,8 @@ Also change the icon to reflect the amount of sheets, if possible.*/
usr.drop_inv_item_on_ground(oldsrc)
qdel(oldsrc)

if(istype(O,/obj/item/stack)) //floor stacking convenience
var/obj/item/stack/S = O
if(istype(new_item,/obj/item/stack)) //floor stacking convenience
var/obj/item/stack/S = new_item
fira marked this conversation as resolved.
Show resolved Hide resolved
for(var/obj/item/stack/F in usr.loc)
fira marked this conversation as resolved.
Show resolved Hide resolved
if(S.stack_id == F.stack_id && S != F)
var/diff = F.max_amount - F.amount
Expand All @@ -231,11 +239,11 @@ Also change the icon to reflect the amount of sheets, if possible.*/
F.amount += diff
break

O?.add_fingerprint(usr)
new_item?.add_fingerprint(usr)

//BubbleWrap - so newly formed boxes are empty
if(isstorage(O))
for (var/obj/item/I in O)
if(isstorage(new_item))
for (var/obj/item/I in new_item)
fira marked this conversation as resolved.
Show resolved Hide resolved
qdel(I)
//BubbleWrap END
if(src && usr.interactee == src) //do not reopen closed window
Expand Down
Loading