Skip to content

Commit

Permalink
[MIRROR] new syndicate item - bee smoker [MDB IGNORE] (#24450)
Browse files Browse the repository at this point in the history
* new syndicate item - bee smoker (#78988)

## About The Pull Request
this adds a new item for traitor botanists they can buy for 4 tc. it
releases smoke which hypnotizes bees to follow ur every command, it can
be used on a single bee or it can be used on a hive to hypnotize all the
bees who live there. u can command the bees to enter or exit their
beehive, and u can also command them to spiral around u where they will
follow u and swirl around u to confuse whichever opponent u are
fighting, and u can also command them to attack people. the bee smoker
comes with some fuel but u can recharge it by putting cannabis into it.
the stronger the weed the more fuel it will provide

https://github.com/tgstation/tgstation/assets/138636438/18c9a350-8e24-4c49-abfa-dffb7622502f

## Why It's Good For The Game
adds a traitor item which gives a new gameplay alternative for botanist
and pacifist players. also i noticed the pet targetting datum was using
some copy paste code so i made it a subtpye of the basic targetting
datum

## Changelog
:cl:
add: added a new syndicate item - the bee smoker
/:cl:

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>

* new syndicate item - bee smoker

---------

Co-authored-by: Ben10Omintrix <[email protected]>
Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
  • Loading branch information
3 people authored and FFMirrorBot committed Oct 20, 2023
1 parent dc68835 commit 7f3f565
Show file tree
Hide file tree
Showing 26 changed files with 318 additions and 46 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/ai/monsters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#define BB_CURRENT_HOME "BB_current_home"
///the hydro we will pollinate
#define BB_TARGET_HYDRO "BB_target_hydro"
///key to swarm around
#define BB_SWARM_TARGET "BB_swarm_target"

// bear keys
///the hive with honey that we will steal from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
var/list/airlocks = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock)
for(var/i in 1 to run_distance)
var/turf/test_destination = get_ranged_target_turf_direct(source, target, range = i, offset = angle)
if(test_destination.is_blocked_turf(exclude_mobs = !source.density, source_atom = source, ignore_atoms = airlocks))
if(test_destination.is_blocked_turf(source_atom = source, ignore_atoms = airlocks))
break
return_turf = test_destination
return return_turf
Expand Down
36 changes: 9 additions & 27 deletions code/datums/ai/basic_mobs/targetting_datums/dont_target_friends.dm
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
/// Don't target an atom in our friends list (or turfs), anything else is fair game
/datum/targetting_datum/not_friends
/datum/targetting_datum/basic/not_friends
/// Stop regarding someone as a valid target once they pass this stat level, setting it to DEAD means you will happily attack corpses
var/attack_until_past_stat = HARD_CRIT
/// If we can try to closed turfs or not
var/attack_closed_turf = FALSE

///Returns true or false depending on if the target can be attacked by the mob
/datum/targetting_datum/not_friends/can_attack(mob/living/living_mob, atom/target, vision_range)
if (!target)
return FALSE
if (attack_closed_turf)
if (isopenturf(target))
return FALSE
else
if (isturf(target))
return FALSE

if (ismob(target))
var/mob/mob_target = target
if (mob_target.status_flags & GODMODE)
return FALSE
if (mob_target.stat > attack_until_past_stat)
return FALSE
/datum/targetting_datum/basic/not_friends/can_attack(mob/living/living_mob, atom/target, vision_range)
if(attack_closed_turf && isclosedturf(target))
return TRUE

if (living_mob.see_invisible < target.invisibility)
return FALSE
if (isturf(target.loc) && living_mob.z != target.z) // z check will always fail if target is in a mech
return FALSE
if (!living_mob.ai_controller) // How did you get here?
if(target in living_mob.ai_controller.blackboard[BB_FRIENDS_LIST])
return FALSE

if (!(target in living_mob.ai_controller.blackboard[BB_FRIENDS_LIST]))
// We don't have any friends, anything's fair game
// OR This is not our friend, fire at will
return TRUE
return ..()

///friends dont care about factions
/datum/targetting_datum/basic/not_friends/faction_check(mob/living/living_mob, mob/living/the_target)
return FALSE

/datum/targetting_datum/not_friends/attack_closed_turfs
/datum/targetting_datum/basic/not_friends/attack_closed_turfs
attack_closed_turf = TRUE

/// Subtype that allows us to target items while deftly avoiding attacking our allies. Be careful when it comes to targetting items as an AI could get trapped targetting something it can't destroy.
Expand Down
4 changes: 2 additions & 2 deletions code/datums/ai/dog/dog_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
blackboard = list(
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/not_friends(),
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
)
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_dog
Expand All @@ -19,7 +19,7 @@
blackboard = list(
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/not_friends(),
BB_PET_TARGETTING_DATUM = new /datum/targetting_datum/basic/not_friends,
// Find nearby mobs with tongs in hand.
BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/holding_object(/obj/item/kitchen/tongs),
BB_BABIES_PARTNER_TYPES = list(/mob/living/basic/pet/dog),
Expand Down
4 changes: 3 additions & 1 deletion code/datums/components/pet_commands/pet_commands_basic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
radial_icon = 'icons/testing/turf_analysis.dmi'
radial_icon_state = "red_arrow"
speech_commands = list("heel", "follow")
///the behavior we use to follow
var/follow_behavior = /datum/ai_behavior/pet_follow_friend

/datum/pet_command/follow/set_command_active(mob/living/parent, mob/living/commander)
. = ..()
set_command_target(parent, commander)

/datum/pet_command/follow/execute_action(datum/ai_controller/controller)
controller.queue_behavior(/datum/ai_behavior/pet_follow_friend, BB_CURRENT_PET_TARGET)
controller.queue_behavior(follow_behavior, BB_CURRENT_PET_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING

/**
Expand Down
4 changes: 4 additions & 0 deletions code/datums/looping_sounds/item_sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@
end_volume = 35
volume = 40
ignore_walls = FALSE

/datum/looping_sound/beesmoke
mid_sounds = list('sound/weapons/beesmoke.ogg' = 1)
volume = 5
117 changes: 117 additions & 0 deletions code/modules/hydroponics/beekeeping/bee_smoker.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/// multiplier to decide how much fuel we add to a smoker
#define WEED_WINE_MULTIPLIER 0.2

/obj/item/bee_smoker
name = "bee smoker"
desc = "A device which can be used to hypnotize bees!"
icon = 'icons/obj/service/hydroponics/equipment.dmi'
icon_state = "bee_smoker"
inhand_icon_state = "bee_smoker"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
item_flags = NOBLUDGEON
/// current level of fuel we have
var/current_herb_fuel = 50
/// maximum amount of fuel we can hold
var/max_herb_fuel = 50
/// are we currently activated?
var/activated = FALSE
/// sound to play when releasing smoke
var/datum/looping_sound/beesmoke/beesmoke_loop
///how much fuel it costs to use this item
var/single_use_cost = 5

/obj/item/bee_smoker/Initialize(mapload)
. = ..()
beesmoke_loop = new(src)

/obj/item/bee_smoker/attack_self(mob/user)
. = ..()
if(.)
return TRUE
if(!activated && current_herb_fuel <= 0)
user.balloon_alert(user, "no fuel!")
return TRUE
alter_state()
user.balloon_alert(user, "[activated ? "activated" : "deactivated"]")
return TRUE

/obj/item/bee_smoker/afterattack(atom/attacked_atom, mob/living/user, proximity)
. = ..()

if(!proximity)
return

. |= AFTERATTACK_PROCESSED_ITEM

if(!activated)
user.balloon_alert(user, "not activated!")
return

if(current_herb_fuel < single_use_cost)
user.balloon_alert(user, "not enough fuel!")
return

current_herb_fuel -= single_use_cost
playsound(src, 'sound/effects/spray2.ogg', 100, TRUE)
var/turf/target_turf = get_turf(attacked_atom)
new /obj/effect/temp_visual/mook_dust(target_turf)

for(var/mob/living/basic/bee/friend in target_turf)
if(friend.flags_1 & HOLOGRAM_1)
continue
friend.befriend(user)

if(!istype(attacked_atom, /obj/structure/beebox))
return

var/obj/structure/beebox/hive = attacked_atom
for(var/mob/living/bee as anything in hive.bees)
if(bee.flags_1 & HOLOGRAM_1)
continue
bee.befriend(user)

/obj/item/bee_smoker/attackby(obj/item/herb, mob/living/carbon/human/user, list/modifiers)
. = ..()
if(.)
return
if(!istype(herb, /obj/item/food/grown/cannabis))
return
var/obj/item/food/grown/cannabis/weed = herb
if(isnull(weed.wine_power))
return TRUE
if(current_herb_fuel == max_herb_fuel)
user.balloon_alert(user, "already at maximum fuel!")
return TRUE
var/fuel_worth = weed.wine_power * WEED_WINE_MULTIPLIER
current_herb_fuel = (current_herb_fuel + fuel_worth > max_herb_fuel) ? max_herb_fuel : current_herb_fuel + fuel_worth
user.balloon_alert(user, "fuel added")
qdel(weed)
return TRUE

/obj/item/bee_smoker/process(seconds_per_tick)
current_herb_fuel--
if(current_herb_fuel <= 0)
alter_state()

/obj/item/bee_smoker/proc/alter_state()
activated = !activated
playsound(src, 'sound/items/welderdeactivate.ogg', 50, TRUE)

if(!activated)
beesmoke_loop.stop()
QDEL_NULL(particles)
STOP_PROCESSING(SSobj, src)
return

beesmoke_loop.start()
START_PROCESSING(SSobj, src)
particles = new /particles/smoke/bee_smoke

/particles/smoke/bee_smoke
lifespan = 0.4 SECONDS
position = list(-12, 7, 0)
velocity = list(0, 0.15, 0)
fade = 2

#undef WEED_WINE_MULTIPLIER
11 changes: 11 additions & 0 deletions code/modules/mob/living/basic/farm_animals/bee/_bee.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
var/icon_base = "bee"
///the bee is a queen?
var/is_queen = FALSE
///commands we follow
var/list/pet_commands = list(
/datum/pet_command/idle,
/datum/pet_command/free,
/datum/pet_command/beehive/enter,
/datum/pet_command/beehive/exit,
/datum/pet_command/follow/bee,
/datum/pet_command/point_targetting/attack/swirl,
/datum/pet_command/scatter,
)

/mob/living/basic/bee/Initialize(mapload)
. = ..()
Expand All @@ -62,6 +72,7 @@
AddElement(/datum/element/simple_flying)
AddComponent(/datum/component/clickbox, x_offset = -2, y_offset = -2)
AddComponent(/datum/component/swarming)
AddComponent(/datum/component/obeys_commands, pet_commands)
AddElement(/datum/element/swabable, CELL_LINE_TABLE_QUEEN_BEE, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5)
RegisterSignal(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(pre_attack))

Expand Down
Loading

0 comments on commit 7f3f565

Please sign in to comment.