mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
some anti duplication ensurance
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
var/sheettype = null //this is used for girders in the creation of walls/false walls. Used by both tiles and sheets.
|
||||
var/last_work = 0 //rounded last world.time at which a crafting began
|
||||
|
||||
/atom
|
||||
var/recycles_cash = TRUE
|
||||
|
||||
/obj/item/stack/New(var/loc, var/amount=null)
|
||||
..()
|
||||
if (amount)
|
||||
@@ -273,10 +276,7 @@
|
||||
gender = PLURAL
|
||||
|
||||
/obj/item/stack/proc/can_stack_with(obj/item/other_stack)
|
||||
if(ispath(other_stack))
|
||||
return (src.type == other_stack)
|
||||
|
||||
return (src.type == other_stack.type)
|
||||
return ispath(other_stack) ? src.type == other_stack : src.type == other_stack.type && src.recycles_cash == other_stack.recycles_cash
|
||||
|
||||
/obj/item/stack/attack_hand(mob/user as mob)
|
||||
if (user.get_inactive_hand() == src)
|
||||
@@ -363,7 +363,7 @@
|
||||
|
||||
*/
|
||||
|
||||
/proc/drop_stack(new_stack_type = /obj/item/stack, atom/loc, add_amount = 1, mob/user)
|
||||
/proc/drop_stack(new_stack_type = /obj/item/stack, atom/loc, add_amount = 1, mob/user, recyclescash = TRUE)
|
||||
if(!ispath(new_stack_type, /obj/item/stack))
|
||||
return new new_stack_type(loc)
|
||||
for(var/obj/item/stack/S in loc)
|
||||
@@ -382,6 +382,7 @@
|
||||
add_amount -= S.amount
|
||||
S.update_materials()
|
||||
S.update_icon()
|
||||
S.recycles_cash = recyclescash
|
||||
return S
|
||||
|
||||
/obj/item/stack/verb_pickup(mob/living/user)
|
||||
|
||||
@@ -102,12 +102,13 @@
|
||||
return
|
||||
var/atom/O
|
||||
if(ispath(result_type, /obj/item/stack))
|
||||
O = drop_stack(result_type, construct_loc, (max_res_amount>1 ? res_amount*multiplier : 1), usr)
|
||||
O = drop_stack(result_type, construct_loc, (max_res_amount>1 ? res_amount*multiplier : 1), usr, S.recycles_cash)
|
||||
var/obj/item/stack/SS = O
|
||||
SS.update_materials()
|
||||
else
|
||||
for(var/i = 1 to (max_res_amount>1 ? res_amount*multiplier : 1))
|
||||
O = new result_type(construct_loc)
|
||||
O.recycles_cash = S.recycles_cash
|
||||
|
||||
S.stop_build(current_work == S.last_work)
|
||||
O.change_dir(usr.dir)
|
||||
|
||||
@@ -226,6 +226,16 @@
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/computer/smelting/emag_act(mob/user)
|
||||
if(req_access?.len)
|
||||
playsound(src, 'sound/effects/sparks4.ogg', 75, 1)
|
||||
req_access = list()
|
||||
if(user)
|
||||
to_chat(user, "<span class='notice'>You disable the security protocols</span>")
|
||||
return 1
|
||||
if(user)
|
||||
to_chat(user, "<span class='warning'>No security protocols enabled</span>")
|
||||
|
||||
//Just a little helper proc
|
||||
/obj/machinery/computer/smelting/proc/send_signal(list/data)
|
||||
if(!frequency)
|
||||
@@ -428,7 +438,7 @@
|
||||
ore.removeAmount(ore_id, R.ingredients[ore_id]) //arg1 = ore name, arg2 = how much per sheet
|
||||
score.oremined += 1 //Count this ore piece as processed for the scoreboard
|
||||
|
||||
drop_stack(R.yieldtype, out_T)
|
||||
drop_stack(R.yieldtype, out_T, recyclescash = FALSE)
|
||||
|
||||
sheets_this_tick++
|
||||
if(sheets_this_tick >= max_moved)
|
||||
@@ -488,7 +498,7 @@
|
||||
continue
|
||||
|
||||
if(!(A.w_type in list(NOT_RECYCLABLE, RECYK_BIOLOGICAL)))
|
||||
if(A.materials && !istype(A,/obj/item/stack/sheet)) // no infinite money glitches allowed
|
||||
if(A.materials && A.recycles_cash) // no infinite money glitches allowed
|
||||
credits += A.materials.getValue()
|
||||
if(A.recycle(ore))
|
||||
ore.addFrom(A.materials, FALSE)
|
||||
|
||||
Reference in New Issue
Block a user