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

Introducing "COOLDOWN_LIST", and some botany changes #9324

Closed
wants to merge 12 commits into from

Conversation

EvilDragonfiend
Copy link
Member

@EvilDragonfiend EvilDragonfiend commented Jun 30, 2023

About The Pull Request

  • Introduces "COOLDOWN_LIST" mecros
    • This is list type cooldown declare as you can see, and mob will be used as list assoc key
    • This is useful when you want to set cooldown time to individual mobs.
    • In this PR, botany Hypodermic prickles gene has this feature
  • Some botany changes
    • plants' bite size mod is now saner than before. It no longer adds weird +1 extra bite. If bite size mod is 2, it means you'll eat a plant for 2u.
    • Omage weed bite size is now 1u
    • Hypodermic Prickles gene is nerfed. Its mechanism is changed
      • (The examples are said when it has 100 Potency)
      • It will only inject 2u from normal plants
        • If a plant has Liquid Contents, it will inject 1u.
          This is more dominant than below, so do not mix this with deathnettle unless you have a strong purpose.
        • else If a plant is Deathnettle, it will inject 6u
        • else If a plant has force (damage), it will inject 4u. (Nettle, pineapple, etc)
      • If you throw a plant to the same victim within 10 seconds, the injection will be halved. (6u to 3u)
        i.e.) Deathnettle has 100u of Water. If you throw it to a person, they get 6u water.
        If you throw it again to the same person within 10 seconds, they get 3u water.
        If you throw a tomato with Hypodermic prickles and 100u water within 10 seconds again, they only get 0.5u water
    • Electrical Activity will no longer shock a target twice when they're slipt on a squashable plant.
    • Plant desc length is now 1024

Why It's Good For The Game

  • new code feature (cooldown list)
  • Adjusting balancing about botany

I really don't see any issue with Richer Juice, but the actual issue is Hypodermic Prickles. It's better to be nerfed already.

20u is too much. even 10u (half of 20u) is too much still. so I made it quite reduced.

Testing Photographs and Procedure

image

image

Changelog

🆑
code: COOLDOWN_LIST macros are newly added.
balance: Electrical Activity will not shock the same victim within 2 seconds.
balance: Hypodermic Prickles will inject half units of the original effectiveness into the same victim within 10 seconds. (i.e. 10u, 5u, 5u in 3 rows)
balance: Hypodermic Prickles maximum injection is 2u. Liquid Content trait makes it 1u. Deathnattle makes it 6u. Damaging plants (pineapple or nettle) makes it 4u. Priority is said here, so you'll want to avoid Liquid Content.
tweak: Omega weed (can hold 420u) bite size is now 1u. I hope your jaw is strong enough.
tweak: Botany plants' bite size no longer adds one extra bite size, so 2u bite size means you'll eat a plant as 2u size.
tweak: Plant desc length is now 1024
/:cl:

/// IMPORTANT: "cd_target" should be individual because it's assoc key
#define COOLDOWN_LIST_START(cd_target, cd_source, cd_index, cd_time) (cd_source.cd_index[cd_target] = world.time + (cd_time))

#define COOLDOWN_LIST_FINISHED(cd_target, cd_source, cd_index) (cd_source.cd_index[cd_target] < world.time)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These macro param names are confusing considering the index is actually the name of the cooldown and the target is the index.
The order of arguments should be:
object, cooldown name, index (cd_target), value (time/length)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed macro param names. would that work?

@Crossedfall
Copy link
Member

Provide actual testing evidence.

@Fronsis
Copy link

Fronsis commented Jun 30, 2023

Does this affect the pneumatic cannon death neetle cheese? Or this nerf is not enough and even with halved injection you can get insta crit by a good plant mix?

@EvilDragonfiend
Copy link
Member Author

Does this affect the pneumatic cannon death neetle cheese? Or this nerf is not enough and even with halved injection you can get insta crit by a good plant mix?

This primarily prevents deathnettle to have Liquid Content trait. Deathnettle will be still used as cheese, and it's still possible to give fuckton of reagents, but you won't do the multiple things with a single plant throwing.

  • Before: Deathnettle with Liquid Content Acid, and a lot of toxins - Fucks up your victim with a single throw. (You get a lot of toxins, and your gear gets acid)
  • Now: You can still do that, but only 5u will be injected. If you do not put Liquid Content, 20u will be injected. Multiple throwing will make it half.

Maybe the default value might need to be lowered more than the suggested PR

@EvilDragonfiend
Copy link
Member Author

todo:

  • test evidence
  • ooc filter in the name / desc
  • renaming / redesc log in investigation

@EvilDragonfiend
Copy link
Member Author

  • test evidence is uploaded
  • injection amount is now 2u/1u/6u/4u (default / liquid / deathnettle / blunt plant)
    20u is too much to be honest

code/modules/hydroponics/seeds.dm Outdated Show resolved Hide resolved
code/modules/hydroponics/seeds.dm Outdated Show resolved Hide resolved
code/modules/hydroponics/seeds.dm Outdated Show resolved Hide resolved
@PowerfulBacon
Copy link
Member

Otherwise seems fine

@EvilDragonfiend
Copy link
Member Author

EvilDragonfiend commented Aug 14, 2023

btw, should I use mob as weak_ref for that assoc list key? or textified mob ref?

@Absolucy
Copy link
Contributor

Absolucy commented Aug 21, 2023

btw, should I use mob as weak_ref for that assoc list key? or textified mob ref?

@EvilDragonfiend In theory, weakrefs would be more optimized? As all of a mob's weakrefs are in fact a single /datum/weakref wrapping a text ref, so if a mobs have multiple cooldowns, you'd just have a bunch of pointers to the same weakref, instead of duplicate strings everywhere?

although I don't know how BYOND handles string deduplication, so uh, I might be incorrect here.

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Comment on lines +253 to +254
src.investigate_log("[key_name(user)] has changed [src] ([type]) into '[input]'", INVESTIGATE_BOTANY)
// log_game() might fit, but I wanted botany logs contained in a specific log file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be logged to permanent storage if we are logging it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is permanent logging. It's just categorised rather than all-in-one log_game()

Comment on lines 254 to 275
COOLDOWN_STATIC_LIST_DECLARE(recent_victims)

/datum/plant_gene/trait/cell_charge/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/C)
if(!COOLDOWN_LIST_FINISHED(src, recent_victims, C)) // if you were a victim recently, you won't get it again
return
var/power = round(G.seed.potency*rate)
if(prob(power))
COOLDOWN_LIST_START(src, recent_victims, C, 2 SECONDS)
C.electrocute_act(power, G, 1, 1)
var/turf/T = get_turf(C)
if(C.ckey != G.fingerprintslast)
C.investigate_log("[C] has slipped on an electric plant at [AREACOORD(T)]. Last fingerprint: [G.fingerprintslast].", INVESTIGATE_BOTANY)
log_combat(C, G, "slipped on and got electrocuted by", null, "with the power of 10. Last fingerprint: [G.fingerprintslast]")

/datum/plant_gene/trait/cell_charge/on_squash(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
if(!COOLDOWN_LIST_FINISHED(src, recent_victims, target)) // if you were a victim recently, you won't get it again
return
if(iscarbon(target))
var/mob/living/carbon/C = target
var/power = G.seed.potency*rate
if(prob(power))
COOLDOWN_LIST_START(src, recent_victims, C, 2 SECONDS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't make a lot of sense to have cooldowns on, they execute only on slip and squash which are discrete and non-repeatable events

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can happen when multiple items are thrown to a person, or when you step on a squashable slip plant. That's why CD check exists here

Comment on lines +475 to +484
// Mechanism: It will always inject the amount as "injecting_amount" variable no matter the total size is
var/prick_efficiency = 0.02 // default (maximum: 2u)
if(locate(/datum/plant_gene/trait/squash) in G.seed.genes)
prick_efficiency = 0.01 // how can a smooth plant be deadly? (maximum: 1u)
else if(istype(G, /obj/item/seeds/nettle/death)) // as long as it has not Liquid Content
prick_efficiency = 0.06 // bonus to "death" nettle (maximum: 6u)
else if(G.force)
prick_efficiency = 0.04 // bonus to blunt plants (miaxmum: 4u)
if(!COOLDOWN_LIST_FINISHED(src, recent_victims, L)) // until 10s cooldown time from a victim is finished, the effective becomes half
prick_efficiency = round(prick_efficiency/2, 0.01) // i.e) 4u to 2u
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A maximum of 2 units is just ridiculously low to the point where it isn't doing anything. The cooldown on this one doesn't make a lot of sense either since on throw/slip isn't highly repeated events like attacking.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly it should be so. It's already horrible source of force-injection of toxins. 6u even does powerful enough.

Copy link
Member

@PowerfulBacon PowerfulBacon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a horrible source of hard deletes if atoms are passed into it instead of strings. If the target index is a number it also won't work. The system just isn't very robust as it is.

@EvilDragonfiend
Copy link
Member Author

EvilDragonfiend commented Nov 2, 2023

This is also a horrible source of hard deletes if atoms are passed into it instead of strings. If the target index is a number it also won't work. The system just isn't very robust as it is.

It's a stringified atom reference, not a direct atom reference. Would it be still horrible?
also, if target index is a number, that's ultimately a wrong usage because a number doesn't have any information about any target. It shouldn't be number index. Should I throw a runtime when it takes a number?

(I will work on this after I get answers)

@EvilDragonfiend
Copy link
Member Author

Changed the real reference to textified reference.

@EvilDragonfiend
Copy link
Member Author

Okay, after some researches, I found using text reference works enough instead of using strong reference. It won't be any horrible source of hardelete.

Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@Rukofamicom
Copy link
Contributor

Merge conflicts for over a month.

@github-actions github-actions bot closed this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants