Skip to content

Commit

Permalink
add: rework floral somatoray [bounty] (#5786)
Browse files Browse the repository at this point in the history
rework floralgun
  • Loading branch information
endipe authored Aug 25, 2024
1 parent 3dcf2d9 commit bd63cfb
Show file tree
Hide file tree
Showing 13 changed files with 155 additions and 68 deletions.
9 changes: 9 additions & 0 deletions code/game/objects/effects/temporary_visuals/miscellaneous.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@
icon_state = "explosionfast"
duration = 4

/obj/effect/temp_visual/explosion/florawave
icon_state = "florawave"
duration = 4

/obj/effect/temp_visual/removing_flora
icon = 'icons/effects/effects.dmi'
icon_state = "greenshatter2"
duration = 2

/obj/effect/temp_visual/heart
name = "heart"
icon = 'icons/mob/animal.dmi'
Expand Down
22 changes: 18 additions & 4 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#define PLANT_LAYER OBJ_LAYER + 0.01
#define LID_LAYER OBJ_LAYER + 0.02

// Floragun
/// Maximum value after which GAMMA mode (/energy/floragun) does not work
#define MAX_MATURATION_SPEED 15

/obj/machinery/hydroponics
name = "hydroponics tray"
icon = 'icons/obj/hydroponics/equipment.dmi'
Expand Down Expand Up @@ -140,10 +144,12 @@
/obj/machinery/hydroponics/bullet_act(obj/item/projectile/Proj) //Works with the Somatoray to modify plant variables.
if(!myseed)
return ..()
if(istype(Proj ,/obj/item/projectile/energy/floramut))
mutate()
else if(istype(Proj ,/obj/item/projectile/energy/florayield))
return myseed.bullet_act(Proj)
if(istype(Proj, /obj/item/projectile/energy/floragamma))
make_grow()
else if(istype(Proj, /obj/item/projectile/energy/florabeta))
myseed.on_floragun_beta_act()
else if(istype(Proj, /obj/item/projectile/energy/floraalpha) && !lid_closed)
plantdies()
else
return ..()

Expand Down Expand Up @@ -425,6 +431,12 @@
plant_hud_set_status()
visible_message("<span class='warning'>The [oldPlantName] is overtaken by some [myseed.plantname]!</span>")

/obj/machinery/hydroponics/proc/make_grow()
if(!myseed || harvest || dead)
return
if(myseed.maturation < MAX_MATURATION_SPEED)
age += myseed.maturation
update_state()

/obj/machinery/hydroponics/proc/mutate(lifemut = 2, endmut = 5, productmut = 1, yieldmut = 2, potmut = 25, wrmut = 2, wcmut = 5, traitmut = 0) // Mutates the current seed
if(!myseed)
Expand Down Expand Up @@ -1128,3 +1140,5 @@
return
if(user.plant_analyzer)
send_plant_details(user)

#undef MAX_MATURATION_SPEED
29 changes: 19 additions & 10 deletions code/modules/hydroponics/seeds.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// Floragun
/// The amount by which a plant's characteristics increase when hit_act to BETA mode (/energy/floragun)
#define FLORAGUN_POTENCY 50
#define FLORAGUN_YIELD 2
#define FLORAGUN_PRODUCTION -1
#define FLORAGUN_ENDURANCE 10

// ********************************************************
// Here's all the seeds (plants) that can be used in hydro
// ********************************************************
Expand Down Expand Up @@ -122,16 +129,8 @@ GLOBAL_LIST_EMPTY(plant_seeds)


/obj/item/seeds/bullet_act(obj/item/projectile/Proj) //Works with the Somatoray to modify plant variables.
if(istype(Proj, /obj/item/projectile/energy/florayield))
var/rating = 1
if(istype(loc, /obj/machinery/hydroponics))
var/obj/machinery/hydroponics/H = loc
rating = H.rating

if(yield == 0)//Oh god don't divide by zero you'll doom us all.
adjust_yield(1 * rating)
else if(prob(1/(yield * yield) * 100))//This formula gives you diminishing returns based on yield. 100% with 1 yield, decreasing to 25%, 11%, 6, 4, 2...
adjust_yield(1 * rating)
if(istype(Proj, /obj/item/projectile/energy/florabeta))
on_floragun_beta_act()
else
return ..()

Expand Down Expand Up @@ -322,6 +321,11 @@ GLOBAL_LIST_EMPTY(plant_seeds)
/obj/item/seeds/proc/on_chem_reaction(datum/reagents/S) //in case seeds have some special interaction with special chems
return

/obj/item/seeds/proc/on_floragun_beta_act()
adjust_potency(FLORAGUN_POTENCY)
adjust_yield(FLORAGUN_YIELD)
adjust_production(FLORAGUN_PRODUCTION)
adjust_endurance(FLORAGUN_ENDURANCE)

/obj/item/seeds/attackby(obj/item/I, mob/user, params)
if(is_pen(I))
Expand Down Expand Up @@ -448,3 +452,8 @@ GLOBAL_LIST_EMPTY(plant_seeds)
return
if(user.plant_analyzer)
to_chat(user, get_analyzer_text())

#undef FLORAGUN_POTENCY
#undef FLORAGUN_YIELD
#undef FLORAGUN_PRODUCTION
#undef FLORAGUN_ENDURANCE
37 changes: 31 additions & 6 deletions code/modules/projectiles/ammunition/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,38 @@
muzzle_flash_color = LIGHT_COLOR_GREEN
harmful = FALSE

/obj/item/ammo_casing/energy/flora/yield
projectile_type = /obj/item/projectile/energy/florayield
select_name = "yield"
/obj/item/ammo_casing/energy/flora/alpha
name = "alpha"
select_name = "floraalpha"
fire_sound = 'sound/weapons/gunshots/1declone.ogg'
projectile_type = /obj/item/projectile/energy/floraalpha
harmful = TRUE
click_cooldown_override = 2
e_cost = 150

/obj/item/ammo_casing/energy/flora/alpha/emag
projectile_type = /obj/item/projectile/energy/floraalpha/emag
e_cost = 225

/obj/item/ammo_casing/energy/flora/beta
name = "beta"
select_name = "florabeta"
projectile_type = /obj/item/projectile/energy/florabeta
click_cooldown_override = 1
e_cost = 75

/obj/item/ammo_casing/energy/flora/gamma
name = "gamma"
select_name = "floragamma"
projectile_type = /obj/item/projectile/energy/floragamma
delay = 10
e_cost = 675

/obj/item/ammo_casing/energy/flora/mut
projectile_type = /obj/item/projectile/energy/floramut
select_name = "mutation"
/obj/item/ammo_casing/energy/flora/gamma/fire(atom/target, mob/living/user, params, distro, quiet, zone_override, spread, atom/firer_source_atom)
playsound(src.loc, 'sound/weapons/floragun_gamma.ogg', 75, TRUE)
if(!do_after(user, 0.5 SECONDS, user, DA_IGNORE_USER_LOC_CHANGE, progress = FALSE))
return FALSE
. = ..()

/obj/item/ammo_casing/energy/temp
projectile_type = /obj/item/projectile/temp
Expand Down
5 changes: 3 additions & 2 deletions code/modules/projectiles/guns/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@
"ion" = "ионный выстрел",
"declone" = "деклонер",
"MINDFUCK" = "мозгодавка",
"yield" = "режим урожайности",
"mutation" = "режим мутации",
"floraalpha" = "альфа режим",
"florabeta" = "бета режим",
"floragamma" = "гамма режим",
"goddamn meteor" = "стрельба чертовым метеоритом",
"disable" = "нейтрализатор",
"plasma burst" = "пучок плазмы",
Expand Down
16 changes: 13 additions & 3 deletions code/modules/projectiles/guns/energy/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,30 @@
if(cell.charge > shot.e_cost)
. += "decloner_spin"


// Flora Gun //
/obj/item/gun/energy/floragun
name = "floral somatoray"
desc = "A tool that discharges controlled radiation which induces mutation in plant cells."
icon_state = "flora"
item_state = "gun"
fire_sound = 'sound/effects/stealthoff.ogg'
ammo_type = list(/obj/item/ammo_casing/energy/flora/yield, /obj/item/ammo_casing/energy/flora/mut)
origin_tech = "materials=2;biotech=4"
materials = list(MAT_GOLD = 2000, MAT_BLUESPACE = 1500, MAT_DIAMOND = 800, MAT_URANIUM = 500, MAT_GLASS = 500)
origin_tech = "materials=5;biotech=6;powerstorage=6;enginerring=5"
ammo_type = list(/obj/item/ammo_casing/energy/flora/alpha, /obj/item/ammo_casing/energy/flora/beta, /obj/item/ammo_casing/energy/flora/gamma)
modifystate = TRUE
ammo_x_offset = 1
can_charge = FALSE
selfcharge = TRUE

/obj/item/gun/energy/floragun/emag_act(mob/user)
. = ..()
ammo_type = list(/obj/item/ammo_casing/energy/flora/alpha/emag, /obj/item/ammo_casing/energy/flora/beta, /obj/item/ammo_casing/energy/flora/gamma)
update_ammo_types()

/obj/item/gun/energy/floragun/examine(mob/user)
. = ..()
. += span_notice("Mode: [ammo_type[select]]\nCharge: [cell.percent()]%")

// Meteor Gun //
/obj/item/gun/energy/meteorgun
name = "meteor gun"
Expand Down
94 changes: 55 additions & 39 deletions code/modules/projectiles/projectile/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,59 @@
if(!mob.stat)
shake_camera(mob, 3, 1)


/obj/item/projectile/energy/floramut
// FLORAGUN
/obj/item/projectile/energy/floraalpha
name = "alpha somatoray"
icon_state = "declone"
damage = 2
hitsound = 'sound/weapons/tap.ogg'
damage_type = BURN
nodamage = FALSE
flag = "energy"
range = 7
impact_effect_type = /obj/effect/temp_visual/impact_effect/green_laser
/// how strong the fire will be
var/fire_stacks = 0.3

/obj/item/projectile/energy/floraalpha/prehit(atom/target)
if(target && !HAS_TRAIT(target, TRAIT_PLANT_ORIGIN)) // burn damage for only plant
damage = 0
. = ..()

/obj/item/projectile/energy/floraalpha/on_range()
strike_thing()
. = ..()

/obj/item/projectile/energy/floraalpha/on_hit(atom/target, blocked = 0, hit_zone)
strike_thing(target)
. = ..()

/obj/item/projectile/energy/floraalpha/proc/strike_thing(atom/target)
var/turf/target_turf = get_turf(target)
if(!target_turf)
target_turf = get_turf(src)
new /obj/effect/temp_visual/explosion/florawave(target_turf)
for(var/currentTurf in RANGE_TURFS(1, target_turf))
for(var/object in currentTurf)
if(isdiona(object))
var/mob/living/plant = object
if(!plant.on_fire) // the hit has no effect if the target is on fire
plant.adjust_fire_stacks(fire_stacks)
plant.IgniteMob()
else if(is_type_in_list(object, list(/obj/structure/glowshroom, /obj/structure/spacevine)))
if(prob(5))
new /obj/effect/decal/cleanable/molten_object(get_turf(object))
else
new /obj/effect/temp_visual/removing_flora(get_turf(object))
qdel(object)

/obj/item/projectile/energy/floraalpha/emag
range = 9
damage = 15
fire_stacks = 10

/obj/item/projectile/energy/florabeta
name = "beta somatoray"
icon_state = "energy"
damage = 0
hitsound = 'sound/weapons/tap.ogg'
Expand All @@ -155,50 +205,16 @@
impact_effect_type = /obj/effect/temp_visual/impact_effect/green_laser
flag = "energy"

/obj/item/projectile/energy/floramut/on_hit(var/atom/target, var/blocked = 0)
..()
var/mob/living/M = target
if(ishuman(target))
var/mob/living/carbon/human/H = M
if(HAS_TRAIT(H, TRAIT_PLANT_ORIGIN))
if(prob(15))
M.apply_effect((rand(30,80)),IRRADIATE)
M.Weaken(10 SECONDS)
M.visible_message("<span class='warning'>[M] writhes in pain as [M.p_their()] vacuoles boil.</span>", "<span class='userdanger'>You writhe in pain as your vacuoles boil!</span>", "<span class='italics'>You hear the crunching of leaves.</span>")
if(prob(80))
randmutb(M)
else
randmutg(M)
M.check_genes()
else
M.adjustFireLoss(rand(5,15))
M.show_message("<span class='warning'>The radiation beam singes you!</span>")
else if(iscarbon(target))
M.show_message("<span class='notice'>The radiation beam dissipates harmlessly through your body.</span>")
else
return 1

/obj/item/projectile/energy/florayield
name = "beta somatoray"
/obj/item/projectile/energy/floragamma
name = "gamma somatoray"
icon_state = "energy2"
damage = 0
hitsound = 'sound/weapons/tap.ogg'
damage_type = TOX
nodamage = TRUE
impact_effect_type = /obj/effect/temp_visual/impact_effect/green_laser
flag = "energy"


/obj/item/projectile/energy/florayield/on_hit(mob/living/target, blocked = 0)
..()
var/living_target = isliving(target)
if(living_target && HAS_TRAIT(target, TRAIT_PLANT_ORIGIN)) //These rays make plantmen fat.
target.set_nutrition(min(target.nutrition + 30, NUTRITION_LEVEL_FULL))
else if(living_target)
to_chat(target, span_notice("The radiation beam dissipates harmlessly through your body."))
else
return 1


/obj/item/projectile/beam/mindflayer
name = "flayer ray"

Expand Down
7 changes: 3 additions & 4 deletions code/modules/research/designs/weapon_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@

/datum/design/flora_gun
name = "Floral Somatoray"
desc = "A tool that discharges controlled radiation which induces mutation in plant cells. Harmless to other organic life."
desc = "A tool that discharges controlled radiation which induces mutation in plant cells. Can be harmful in the wrong hands."
id = "flora_gun"
req_tech = list("materials" = 2, "biotech" = 4)
req_tech = list("powerstorage" = 7, "biotech" = 7, "engineering" = 6, "materials" = 5)
build_type = PROTOLATHE
materials = list(MAT_METAL = 2000, MAT_GLASS = 500)
reagents_list = list("radium" = 20)
materials = list(MAT_GOLD = 2000, MAT_BLUESPACE = 1500, MAT_DIAMOND = 800, MAT_URANIUM = 500, MAT_GLASS = 500)
build_path = /obj/item/gun/energy/floragun
category = list("Weapons")

Expand Down
4 changes: 4 additions & 0 deletions code/modules/w_examine/descriptions/weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
description_info = "This is an energy weapon. Most energy weapons can fire through windows harmlessly. To recharge this weapon, use a weapon recharger. \
To use the scope, use the appropriate verb in the object tab."

/obj/item/gun/energy/floragun
description_info = "This is an energy weapon. Has 3 shooting modes: alpha, beta, gamma. Alpha destroys plants. Beta improves plant genes. Gamma accelerates plant \
growth. Cannot be charged in the charger."

/obj/item/gun/projectile
description_info = "This is a ballistic weapon. To reload, click the weapon in your hand to unload (if needed), then add the appropriate ammo. The description \
will tell you what caliber you need."
Expand Down
Binary file modified icons/effects/96x96.dmi
Binary file not shown.
Binary file modified icons/obj/weapons/energy.dmi
Binary file not shown.
Binary file modified icons/obj/weapons/projectiles.dmi
Binary file not shown.
Binary file added sound/weapons/floragun_gamma.ogg
Binary file not shown.

0 comments on commit bd63cfb

Please sign in to comment.