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

[PORT] Transforms the chat feedback of cutting down logs and pulling cotton into balloon alerts, and simplifies their merging code #4457

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 5 additions & 17 deletions code/modules/hydroponics/grown/cotton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,15 @@
var/cotton_name = "raw cotton"

/obj/item/grown/cotton/attack_self(mob/user)
user.show_message(span_notice("You pull some [cotton_name] out of the [name]!"), MSG_VISUAL)
var/seed_modifier = 0
var/cotton_count = 1
if(seed)
seed_modifier = round(seed.potency / 25)
var/obj/item/stack/cotton = new cotton_type(user.loc, 1 + seed_modifier)
var/old_cotton_amount = cotton.amount
for(var/obj/item/stack/potential_stack in user.loc)
if(QDELETED(potential_stack))
continue
if(potential_stack == cotton)
continue
if(!istype(potential_stack, cotton_type))
continue
if(potential_stack.amount >= potential_stack.max_amount)
continue
potential_stack.attackby(cotton, user)
cotton_count += round(seed.potency / 25)

if(cotton.amount > old_cotton_amount)
to_chat(user, span_notice("You add the newly-formed [cotton_name] to the stack. It now contains [cotton.amount] [cotton_name]."))
user.balloon_alert(user, "pulled [cotton_count] piece\s")
new cotton_type(user.drop_location(), cotton_count)
qdel(src)


//reinforced mutated variant
/obj/item/seeds/cotton/durathread
name = "pack of durathread seeds"
Expand Down
34 changes: 15 additions & 19 deletions code/modules/hydroponics/grown/towercap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,33 +78,29 @@

return NONE

/obj/item/grown/log/attackby(obj/item/W, mob/user, params)
if(W.get_sharpness())
user.show_message(span_notice("You make [plank_name] out of \the [src]!"), MSG_VISUAL)
var/seed_modifier = 0
/obj/item/grown/log/attackby(obj/item/attacking_item, mob/user, params)
if(attacking_item.get_sharpness())
var/plank_count = 1
if(seed)
seed_modifier = round(seed.potency / 25)
var/obj/item/stack/plank = new plank_type(user.loc, 1 + seed_modifier, FALSE)
var/old_plank_amount = plank.amount
for (var/obj/item/stack/ST in user.loc)
if (ST != plank && istype(ST, plank_type) && ST.amount < ST.max_amount)
ST.attackby(plank, user) //we try to transfer all old unfinished stacks to the new stack we created.
if (plank.amount > old_plank_amount)
to_chat(user, span_notice("You add the newly-formed [plank_name] to the stack. It now contains [plank.amount] [plank_name]."))
plank_count += round(seed.potency / 25)

user.balloon_alert(user, "made [plank_count] [plank_name]")
new plank_type(user.drop_location(), plank_count)
qdel(src)
return

if(CheckAccepted(W))
var/obj/item/food/grown/leaf = W
if(CheckAccepted(attacking_item))
var/obj/item/food/grown/leaf = attacking_item
if(HAS_TRAIT(leaf, TRAIT_DRIED))
user.show_message(span_notice("You wrap \the [W] around the log, turning it into a torch!"))
var/obj/item/flashlight/flare/torch/T = new /obj/item/flashlight/flare/torch(user.loc)
usr.dropItemToGround(W)
usr.put_in_active_hand(T)
user.balloon_alert(user, "torch crafted")
var/obj/item/flashlight/flare/torch/new_torch = new /obj/item/flashlight/flare/torch(user.drop_location())
user.dropItemToGround(attacking_item)
user.put_in_active_hand(new_torch)
qdel(leaf)
qdel(src)
return
else
to_chat(usr, span_warning("You must dry this first!"))
balloon_alert(user, "dry it first!")
else
return ..()

Expand Down
Loading