Merge branch 'master' into upstream-merge-36953
This commit is contained in:
@@ -99,7 +99,11 @@
|
||||
/obj/item/stack/attack_self(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/item/stack/interact(mob/user, recipes_sublist)
|
||||
/obj/item/stack/interact(mob/user, sublist)
|
||||
ui_interact(user, sublist)
|
||||
|
||||
/obj/item/stack/ui_interact(mob/user, recipes_sublist)
|
||||
. = ..()
|
||||
if (!recipes)
|
||||
return
|
||||
if (!src || get_amount() <= 0)
|
||||
@@ -222,16 +226,16 @@
|
||||
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [R.req_amount*multiplier] [R.title]\s!</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [R.title]!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
if(R.window_checks && !valid_window_location(usr.loc, usr.dir))
|
||||
to_chat(usr, "<span class='warning'>The [R.title] won't fit here!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
if(R.one_per_turf && (locate(R.result_type) in usr.loc))
|
||||
to_chat(usr, "<span class='warning'>There is another [R.title] here!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
if(R.on_floor && !isfloorturf(usr.loc))
|
||||
to_chat(usr, "<span class='warning'>\The [R.title] must be constructed on the floor!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
if(R.placement_checks)
|
||||
switch(R.placement_checks)
|
||||
if(STACK_CHECK_CARDINALS)
|
||||
@@ -240,25 +244,26 @@
|
||||
step = get_step(usr, direction)
|
||||
if(locate(R.result_type) in step)
|
||||
to_chat(usr, "<span class='warning'>\The [R.title] must not be built directly adjacent to another!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
if(STACK_CHECK_ADJACENT)
|
||||
if(locate(R.result_type) in range(1, usr))
|
||||
to_chat(usr, "<span class='warning'>\The [R.title] must be constructed at least one tile away from others of its type!</span>")
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/stack/use(used, transfer = FALSE) // return 0 = borked; return 1 = had enough
|
||||
if(zero_amount())
|
||||
return 0
|
||||
/obj/item/stack/use(used, transfer = FALSE, check = TRUE) // return 0 = borked; return 1 = had enough
|
||||
if(check && zero_amount())
|
||||
return FALSE
|
||||
if (is_cyborg)
|
||||
return source.use_charge(used * cost)
|
||||
if (amount < used)
|
||||
return 0
|
||||
return FALSE
|
||||
amount -= used
|
||||
zero_amount()
|
||||
if(check)
|
||||
zero_amount()
|
||||
update_icon()
|
||||
update_weight()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/stack/tool_use_check(mob/living/user, amount)
|
||||
if(get_amount() < amount)
|
||||
@@ -315,13 +320,14 @@
|
||||
merge(AM)
|
||||
. = ..()
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/item/stack/attack_hand(mob/user)
|
||||
if (user.get_inactive_held_item() == src)
|
||||
if(user.get_inactive_held_item() == src)
|
||||
if(zero_amount())
|
||||
return
|
||||
return change_stack(user,1)
|
||||
else
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
/obj/item/stack/AltClick(mob/living/user)
|
||||
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
@@ -332,7 +338,6 @@
|
||||
if(zero_amount())
|
||||
return
|
||||
//get amount from user
|
||||
var/min = 0
|
||||
var/max = get_amount()
|
||||
var/stackmaterial = round(input(user,"How many sheets do you wish to take out of this stack? (Maximum [max])") as null|num)
|
||||
max = get_amount()
|
||||
@@ -340,19 +345,21 @@
|
||||
if(stackmaterial == null || stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
|
||||
return
|
||||
else
|
||||
change_stack(user,stackmaterial)
|
||||
change_stack(user, stackmaterial)
|
||||
to_chat(user, "<span class='notice'>You take [stackmaterial] sheets out of the stack</span>")
|
||||
|
||||
/obj/item/stack/proc/change_stack(mob/user,amount)
|
||||
var/obj/item/stack/F = new type(user, amount, FALSE)
|
||||
/obj/item/stack/proc/change_stack(mob/user, amount)
|
||||
if(!use(amount, TRUE, FALSE))
|
||||
return FALSE
|
||||
var/obj/item/stack/F = new type(user? user : drop_location(), amount, FALSE)
|
||||
. = F
|
||||
F.copy_evidences(src)
|
||||
user.put_in_hands(F, merge_stacks=FALSE)
|
||||
add_fingerprint(user)
|
||||
F.add_fingerprint(user)
|
||||
use(amount, TRUE)
|
||||
|
||||
|
||||
if(user)
|
||||
if(!user.put_in_hands(F, merge_stacks = FALSE))
|
||||
F.forceMove(user.drop_location())
|
||||
add_fingerprint(user)
|
||||
F.add_fingerprint(user)
|
||||
zero_amount()
|
||||
|
||||
/obj/item/stack/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, merge_type))
|
||||
@@ -408,4 +415,4 @@
|
||||
|
||||
/datum/stack_recipe_list/New(title, recipes)
|
||||
src.title = title
|
||||
src.recipes = recipes
|
||||
src.recipes = recipes
|
||||
Reference in New Issue
Block a user