mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
## About The Pull Request this pr adds a new fish to lavaland and icebox, the lavaloop! i noticed neither has any exclusive fish so im trying to add one of my own. u can find this fish by using reinforced rods on lava or plasmarivers. this fish is also lobstrosity's favorite delicacy as you will now often see AI controlled lobstrosities fishing for it in lava and then eating it.  because of its body's curvature and razor sharp spikes, this fish can also be used as a make-shift boomerang weapon against mining mobs, although it comes with some new mechanics. u can increase the damage it does to mobs by winding up ur throw. when the bar reaches purple, this indicates maximum damage. however, if it goes over the purple, it will react violently and explode your arm off, so you have to time it just right to get the best damage possible. On icebox, instead of dealing raw damage, fish will freeze mobs depending on how long you charged ur throw. charging it for too long will cause the fish to freeze you instead https://github.com/tgstation/tgstation/assets/138636438/c8ac3696-3705-45b0-bc43-c5b81d75cb1b while its nowhere near as effective as using PKA's or crushers, it can be a useful tool for hermits and ashwalkers. ## Why It's Good For The Game having lobstrosities fish and hunt for it makes lavaland feel more like an ecosystem with a food chain. also i think tossing fish at eldritch horrors is a funny way to fight them ## Changelog 🆑 add: adds a new fish to lava and plasma rivers, the lava loop /🆑
173 lines
5.7 KiB
Plaintext
173 lines
5.7 KiB
Plaintext
/datum/component/throwbonus_on_windup
|
|
///the maximum windup bonus
|
|
var/maximum_bonus = 20
|
|
///additional behavior if we exceed the maximum bonus
|
|
var/datum/callback/pass_maximum_callback
|
|
///the player currently winding up their throw
|
|
var/datum/weakref/holder
|
|
///the current bonus we are at
|
|
var/throwforce_bonus = 0
|
|
///the bar relaying feedback to the player
|
|
var/obj/effect/overlay/windup_bar/our_bar
|
|
///any additional behavior we should look for before applying the bonus
|
|
var/datum/callback/apply_bonus_callback
|
|
///sound we play after successfully damaging the enemy with a bonus
|
|
var/sound_on_success
|
|
///effect we play after successfully damaging the enemy with a bonus
|
|
var/effect_on_success
|
|
///how fast we increase the wind up counter on process
|
|
var/windup_increment_speed
|
|
///text we display when we start winding up
|
|
var/throw_text
|
|
|
|
/datum/component/throwbonus_on_windup/Initialize(maximum_bonus = 20, windup_increment_speed = 1, pass_maximum_callback, apply_bonus_callback, sound_on_success, effect_on_success, throw_text)
|
|
. = ..()
|
|
if(!isitem(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
src.maximum_bonus = maximum_bonus
|
|
src.pass_maximum_callback = pass_maximum_callback
|
|
src.apply_bonus_callback = apply_bonus_callback
|
|
src.sound_on_success = sound_on_success
|
|
src.effect_on_success = effect_on_success
|
|
src.windup_increment_speed = windup_increment_speed
|
|
src.throw_text = throw_text
|
|
|
|
/datum/component/throwbonus_on_windup/proc/on_equip(datum/source, mob/living/equipper, slot)
|
|
SIGNAL_HANDLER
|
|
|
|
if(!(slot & ITEM_SLOT_HANDS) || holder?.resolve())
|
|
return
|
|
holder = WEAKREF(equipper)
|
|
RegisterSignal(equipper, COMSIG_LIVING_THROW_MODE_TOGGLE, PROC_REF(throw_change))
|
|
RegisterSignal(equipper, COMSIG_MOB_SWAP_HANDS, PROC_REF(on_hands_swap))
|
|
if(equipper.throw_mode)
|
|
start_windup()
|
|
|
|
/datum/component/throwbonus_on_windup/proc/start_windup()
|
|
|
|
throwforce_bonus = initial(throwforce_bonus)
|
|
var/mob/living/our_holder = holder?.resolve()
|
|
if(isnull(holder))
|
|
return
|
|
if(throw_text)
|
|
to_chat(our_holder, span_warning(throw_text))
|
|
var/list/offset_to_add = get_icon_dimensions(our_holder.icon)
|
|
var/x_position = CEILING(offset_to_add["width"] * 0.5, 1)
|
|
our_bar = new()
|
|
our_bar.maximum_count = maximum_bonus
|
|
our_bar.pixel_x = x_position
|
|
our_holder.vis_contents += our_bar
|
|
START_PROCESSING(SSfastprocess, src)
|
|
|
|
/datum/component/throwbonus_on_windup/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip))
|
|
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_move))
|
|
RegisterSignal(parent, COMSIG_MOVABLE_PRE_IMPACT, PROC_REF(on_thrown))
|
|
|
|
/datum/component/throwbonus_on_windup/UnregisterFromParent()
|
|
UnregisterSignal(parent, list(COMSIG_ITEM_EQUIPPED, COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_PRE_IMPACT))
|
|
var/atom/our_holder = holder?.resolve()
|
|
if(!isnull(our_holder))
|
|
UnregisterSignal(our_holder, list(COMSIG_LIVING_THROW_MODE_TOGGLE, COMSIG_MOB_SWAP_HANDS))
|
|
|
|
/datum/component/throwbonus_on_windup/Destroy()
|
|
STOP_PROCESSING(SSfastprocess, src)
|
|
QDEL_NULL(our_bar)
|
|
holder = null
|
|
return ..()
|
|
|
|
/datum/component/throwbonus_on_windup/proc/throw_change(datum/source, throw_mode)
|
|
SIGNAL_HANDLER
|
|
|
|
if(throw_mode)
|
|
start_windup()
|
|
else
|
|
end_windup()
|
|
|
|
/datum/component/throwbonus_on_windup/proc/on_hands_swap(mob/living/source)
|
|
SIGNAL_HANDLER
|
|
|
|
if(source.get_active_held_item() != parent)
|
|
end_windup()
|
|
return
|
|
|
|
if(source.throw_mode)
|
|
start_windup()
|
|
|
|
/datum/component/throwbonus_on_windup/process(seconds_per_tick)
|
|
if(throwforce_bonus > maximum_bonus)
|
|
var/mob/living/our_holder = holder?.resolve()
|
|
pass_maximum_callback?.Invoke(our_holder)
|
|
end_windup()
|
|
return PROCESS_KILL
|
|
|
|
our_bar.recalculate_position(min(throwforce_bonus, maximum_bonus))
|
|
throwforce_bonus += windup_increment_speed
|
|
|
|
/datum/component/throwbonus_on_windup/proc/on_move(obj/item/source, atom/entering_loc)
|
|
SIGNAL_HANDLER
|
|
end_windup()
|
|
var/mob/living/our_holder = holder?.resolve()
|
|
if(isnull(our_holder))
|
|
return
|
|
holder = null
|
|
UnregisterSignal(our_holder, list(COMSIG_LIVING_THROW_MODE_TOGGLE, COMSIG_MOB_SWAP_HANDS))
|
|
|
|
/datum/component/throwbonus_on_windup/proc/end_windup()
|
|
QDEL_NULL(our_bar)
|
|
STOP_PROCESSING(SSfastprocess, src)
|
|
|
|
/datum/component/throwbonus_on_windup/proc/on_thrown(datum/source, atom/hit_atom, datum/thrownthing/throwingdatum)
|
|
SIGNAL_HANDLER
|
|
|
|
var/damage_to_apply = throwforce_bonus
|
|
throwforce_bonus = initial(throwforce_bonus)
|
|
if(!isliving(hit_atom))
|
|
return
|
|
|
|
if(apply_bonus_callback && !apply_bonus_callback.Invoke(hit_atom, damage_to_apply))
|
|
return
|
|
|
|
if(effect_on_success)
|
|
new effect_on_success(get_turf(hit_atom))
|
|
if(sound_on_success)
|
|
playsound(hit_atom, sound_on_success, 50, TRUE)
|
|
|
|
var/mob/living/living_target = hit_atom
|
|
living_target.apply_damage(damage_to_apply)
|
|
|
|
/obj/effect/overlay/windup_bar
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
anchored = TRUE
|
|
vis_flags = VIS_INHERIT_DIR | VIS_INHERIT_PLANE
|
|
icon = 'icons/effects/effects.dmi'
|
|
icon_state = "windup_bar"
|
|
layer = ABOVE_ALL_MOB_LAYER
|
|
///the maximum windup bonus
|
|
var/maximum_count = INFINITY
|
|
///the current count we are at
|
|
var/current_count = 0
|
|
|
|
/obj/effect/overlay/windup_bar/proc/recalculate_position(input_count)
|
|
current_count = input_count
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
|
|
/obj/effect/overlay/windup_bar/update_overlays()
|
|
. = ..()
|
|
var/static/list/bar_positions = list(0, 2, 4, 6, 8)
|
|
var/current_percentage = current_count / maximum_count
|
|
var/bars_to_add = CEILING(length(bar_positions) * current_percentage, 1)
|
|
for(var/curr_number in 1 to bars_to_add)
|
|
var/bar_color
|
|
switch(curr_number)
|
|
if(1 to 2)
|
|
bar_color = "windup_red"
|
|
if(2 to 4)
|
|
bar_color = "windup_green"
|
|
if(4 to 5)
|
|
bar_color = "windup_purple"
|
|
var/mutable_appearance/bar_overlay = mutable_appearance(icon = icon, icon_state = bar_color, layer = ABOVE_HUD_PLANE)
|
|
bar_overlay.pixel_y = bar_positions[curr_number]
|
|
. += bar_overlay
|