mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
snails (#90505)
## About The Pull Request adds snails to the game  these are harmless critters you can find in maints. they love eating all variety of fruits, and are gravitated towards snail people, where they'll dance around them. you can also pick them up and put them on your head. finally, you can also grab them and put them in hydrotrays (they will swim around in it very slowly). they'll help ur plants grow as they act as natural weed-repellants, as they'll eat weeds that grow in trays.  ## Why It's Good For The Game there's not that many mobs you can usually find in maints, currently there's only mice and cockroaches, this helps expand the pools a bit. ## Changelog 🆑 add: adds snails to the game. (keep them away from salt!) /🆑
This commit is contained in:
@@ -59,6 +59,8 @@
|
||||
var/being_pollinated = FALSE
|
||||
///The light level on the tray tile
|
||||
var/light_level = 0
|
||||
///our snail overlay, if any
|
||||
var/obj/effect/overlay/vis_effect/snail/our_snail
|
||||
|
||||
/obj/machinery/hydroponics/Initialize(mapload)
|
||||
//ALRIGHT YOU DEGENERATES. YOU HAD REAGENT HOLDERS FOR AT LEAST 4 YEARS AND NONE OF YOU MADE HYDROPONICS TRAYS HOLD NUTRIENT CHEMS INSTEAD OF USING "Points".
|
||||
@@ -212,6 +214,16 @@
|
||||
. = ..()
|
||||
if(!QDELETED(src) && gone == myseed)
|
||||
set_seed(null, FALSE)
|
||||
if(!istype(gone, /obj/item/clothing/head/mob_holder/snail))
|
||||
return
|
||||
var/obj/item/clothing/head/mob_holder/snail_object = gone
|
||||
if(snail_object.held_mob)
|
||||
UnregisterSignal(snail_object.held_mob, list(
|
||||
COMSIG_LIVING_DEATH,
|
||||
COMSIG_MOVABLE_ATTEMPTED_MOVE,
|
||||
))
|
||||
QDEL_NULL(our_snail)
|
||||
|
||||
|
||||
/obj/machinery/hydroponics/constructable/attackby(obj/item/I, mob/living/user, list/modifiers)
|
||||
if (!user.combat_mode)
|
||||
@@ -313,6 +325,9 @@
|
||||
/obj/machinery/hydroponics/process(seconds_per_tick)
|
||||
var/needs_update = FALSE // Checks if the icon needs updating so we don't redraw empty trays every time
|
||||
|
||||
if(!isnull(our_snail))
|
||||
handle_snail()
|
||||
|
||||
if(self_sustaining)
|
||||
if(powered())
|
||||
adjust_waterlevel(rand(1,2) * seconds_per_tick * 0.5)
|
||||
@@ -646,6 +661,17 @@
|
||||
/obj/machinery/hydroponics/proc/adjust_pestlevel(amt)
|
||||
set_pestlevel(clamp(pestlevel + amt, 0, MAX_TRAY_PESTS), FALSE)
|
||||
|
||||
/obj/machinery/hydroponics/proc/remove_snail(mob/source)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/atom/movable/mob_holder = source.loc
|
||||
mob_holder.forceMove(drop_location())
|
||||
|
||||
/obj/machinery/hydroponics/proc/handle_snail()
|
||||
if(prob(15))
|
||||
our_snail.handle_animation() //our snail waddles throughout the tray
|
||||
if(prob(5))
|
||||
adjust_weedlevel(-2)
|
||||
|
||||
/**
|
||||
* Adjust Weeds.
|
||||
@@ -1110,11 +1136,17 @@
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
var/warning = tgui_alert(user, "Are you sure you wish to empty the tray's nutrient beaker?","Empty Tray Nutrients?", list("Yes", "No"))
|
||||
if(warning == "Yes" && user.can_perform_action(src, FORBID_TELEKINESIS_REACH))
|
||||
reagents.clear_reagents()
|
||||
to_chat(user, span_warning("You empty [src]'s nutrient tank."))
|
||||
empty_tray(user)
|
||||
update_appearance()
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
|
||||
|
||||
/obj/machinery/hydroponics/proc/empty_tray(mob/user)
|
||||
reagents.clear_reagents()
|
||||
for(var/obj/item/clothing/head/mob_holder/snail/possible_snail in contents)
|
||||
possible_snail.forceMove(drop_location())
|
||||
to_chat(user, span_warning("You empty [src]'s nutrient tank."))
|
||||
|
||||
/**
|
||||
* Update Tray Proc
|
||||
* Handles plant harvesting on the tray side, by clearing the seed, names, description, and dead stat.
|
||||
@@ -1243,6 +1275,17 @@
|
||||
plant_health = add_output_port("Plant Health", PORT_TYPE_NUMBER)
|
||||
reagents_level = add_output_port("Reagents Level", PORT_TYPE_NUMBER)
|
||||
|
||||
/obj/machinery/hydroponics/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs)
|
||||
. = ..()
|
||||
if(!istype(arrived, /obj/item/clothing/head/mob_holder/snail))
|
||||
return
|
||||
our_snail = new
|
||||
vis_contents += our_snail
|
||||
our_snail.layer = layer + 0.01
|
||||
var/obj/item/clothing/head/mob_holder/snail = arrived
|
||||
RegisterSignals(snail.held_mob, list(COMSIG_MOVABLE_ATTEMPTED_MOVE, COMSIG_LIVING_DEATH), PROC_REF(remove_snail)) //rip
|
||||
|
||||
|
||||
/obj/item/circuit_component/hydroponics/register_usb_parent(atom/movable/parent)
|
||||
. = ..()
|
||||
if(istype(parent, /obj/machinery/hydroponics))
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#define SNAIL_MOVEMENT_DISTANCE 5
|
||||
#define SNAIL_MOVEMENT_TIME 10 SECONDS
|
||||
|
||||
/obj/effect/overlay/vis_effect/snail
|
||||
name = "snail"
|
||||
vis_flags = VIS_INHERIT_PLANE
|
||||
icon = 'icons/obj/service/hydroponics/equipment.dmi'
|
||||
icon_state = "snail_hydrotray"
|
||||
///are we currently walking?
|
||||
var/is_waddling = FALSE
|
||||
|
||||
/obj/effect/overlay/vis_effect/snail/proc/handle_animation()
|
||||
if(is_waddling)
|
||||
return
|
||||
is_waddling = TRUE
|
||||
var/movement_direction = pixel_x >= 0 ? -1 : 1
|
||||
transform = transform.Scale(-1, 1) //face the other direction
|
||||
animate(src, pixel_x = movement_direction * SNAIL_MOVEMENT_DISTANCE, time = SNAIL_MOVEMENT_TIME)
|
||||
addtimer(VARSET_CALLBACK(src, is_waddling, FALSE), SNAIL_MOVEMENT_TIME)
|
||||
|
||||
#undef SNAIL_MOVEMENT_DISTANCE
|
||||
#undef SNAIL_MOVEMENT_TIME
|
||||
Reference in New Issue
Block a user