Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed icons/mob/inhands/equipment/fishing_lefthand.dmi
Binary file not shown.
61 changes: 50 additions & 11 deletions yogstation/code/datums/components/fishable.dm
Original file line number Diff line number Diff line change
@@ -1,28 +1,67 @@
#define FISHING_LOOT_NOTHING "nothing"
#define FISHING_LOOT_JUNK "junk"
#define FISHING_LOOT_COMMON "common"
#define FISHING_LOOT_UNCOMMON "uncommon"
#define FISHING_LOOT_RARE "rare"

/datum/component/fishable
dupe_mode = COMPONENT_DUPE_UNIQUE
var/datum/fishing_loot/common_loot = new /datum/fishing_loot/water/common
var/datum/fishing_loot/loot = new /datum/fishing_loot/water

/datum/component/fishable/proc/getCommonLoot()
return pick(common_loot.rewards)

/datum/component/fishable/Initialize()
if(!istype(parent, /turf))
return COMPONENT_INCOMPATIBLE

/datum/component/fishable/proc/get_reward(var/fishing_power = 0)
var/chance = list(
FISHING_LOOT_NOTHING = min(max(0,100 - fishing_power),50),
FISHING_LOOT_JUNK = min(max(0,50 - fishing_power),25),
FISHING_LOOT_COMMON = min(fishing_power / 5,50),
FISHING_LOOT_UNCOMMON = min(fishing_power / 10,33),
FISHING_LOOT_RARE = min(fishing_power / 20,25)
)

var/chosen_rank = pickweight(chance)
switch(chosen_rank)
if(FISHING_LOOT_JUNK)
return pick(loot.junk_loot)
if(FISHING_LOOT_COMMON)
return pick(loot.common_loot)
if(FISHING_LOOT_UNCOMMON)
return pick(loot.uncommon_loot)
if(FISHING_LOOT_RARE)
return pick(loot.rare_loot)
return FISHING_LOOT_NOTHING


//LOOT TABLES

/datum/fishing_loot
var/list/rewards = list()
var/list/junk_loot
var/list/common_loot
var/list/uncommon_loot
var/list/rare_loot

/datum/fishing_loot/water/common
rewards = list(
/datum/fishing_loot/water
junk_loot = list(
/obj/item/trash/plate,
/obj/item/reagent_containers/food/drinks/soda_cans/cola,
/obj/item/shard
)
common_loot = list(
/obj/item/reagent_containers/food/snacks/fish/goldfish,
/obj/item/reagent_containers/food/snacks/fish/goldfish/giant,
/obj/item/reagent_containers/food/snacks/fish/salmon,
/obj/item/reagent_containers/food/snacks/fish/bass,
/obj/item/reagent_containers/food/snacks/fish/tuna,
/obj/item/reagent_containers/food/snacks/fish/shrimp,
/obj/item/reagent_containers/food/snacks/fish/squid,
/obj/item/reagent_containers/food/snacks/fish/puffer,
/obj/item/reagent_containers/food/snacks/bait/leech
)
uncommon_loot = list(
/obj/item/reagent_containers/food/snacks/fish/goldfish/giant,
/obj/item/reagent_containers/food/snacks/fish/shrimp,
/obj/item/reagent_containers/food/snacks/fish/puffer,
/obj/item/reagent_containers/food/snacks/fish/tuna
)
rare_loot = list(
/obj/item/reagent_containers/food/snacks/fish/squid,
/obj/item/stack/sheet/bluespace_crystal
)
8 changes: 4 additions & 4 deletions yogstation/code/game/objects/items/fishing/fish.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
var/mutable_appearance/showoff_overlay

/obj/item/reagent_containers/food/snacks/fish/Initialize(mapload)
. = ..()
length = rand(min_length,max_length)
weight = rand(min_weight,max_weight)
list_reagents = list(/datum/reagent/consumable/nutriment = (3 * slices_num), /datum/reagent/consumable/nutriment/vitamin = (2 * slices_num))
. = ..()

/obj/item/reagent_containers/food/snacks/fish/proc/GetChumValue()
return //not used yet

/obj/item/reagent_containers/food/snacks/fish/examine(mob/user)
. = ..()
. += "It's [length] inches and [weight] ounces!"
. += "It's [length] inch[length > 1 ? "es" : ""] and [weight] ounce[weight > 1 ? "s" : ""]!"

/obj/item/reagent_containers/food/snacks/fish/attack_self(mob/M)
if(showoff_overlay)
Expand All @@ -44,8 +44,8 @@
showoff_overlay = mutable_appearance(icon,icon_state)
M.add_overlay(showoff_overlay)
showoffer = M
M.visible_message("[M] shows off [src]. It's [length] inches long and weighs [weight] ounces!", \
span_notice("You show off [src]. It's [length] inches long and weighs [weight] ounces!"))
M.visible_message("[M] shows off [src]. It's [length] inch[length > 1 ? "es" : ""] long and weighs [weight] ounce[weight > 1 ? "s" : ""]!", \
span_notice("You show off [src]. It's [length] inch[length > 1 ? "es" : ""] long and weighs [weight] ounce[weight > 1 ? "s" : ""]!"))
RegisterSignal(M,COMSIG_ATOM_DIR_CHANGE,.proc/stop_overlay,TRUE)

/obj/item/reagent_containers/food/snacks/fish/proc/stop_overlay()
Expand Down
71 changes: 64 additions & 7 deletions yogstation/code/game/objects/items/fishing/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
desc = "A rod used for fishing. Despite ordinary appearances, fishing has evolved to suit the cosmos with various features, like auto-reeling."
icon = 'yogstation/icons/obj/fishing/fishing.dmi'
icon_state = "fishing_rod"
lefthand_file = 'icons/mob/inhands/equipment/fishing_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
lefthand_file = 'yogstation/icons/mob/inhands/equipment/fishing_lefthand.dmi'
righthand_file = 'yogstation/icons/mob/inhands/equipment/fishing_righthand.dmi'
usesound = 'sound/items/crowbar.ogg'
slot_flags = ITEM_SLOT_BACK
force = 2
throwforce = 5
w_class = WEIGHT_CLASS_NORMAL
w_class = WEIGHT_CLASS_BULKY
materials = list(/datum/material/iron=50)

var/fishing_power = 10
Expand Down Expand Up @@ -78,7 +78,11 @@
/obj/item/twohanded/fishingrod/proc/reel_in(var/forced = FALSE)
if(!forced && bite) // we got something!!!
playsound(fishing_component, 'sound/effects/water_emerge.ogg', 50, FALSE, -5)
spawn_reward()
var/power = 0
if(iscarbon(fisher)) //sorry, non-carbons don't get to wear cool fishing outfits
var/mob/living/carbon/carbonfisher = fisher
power = carbonfisher.fishing_power
spawn_reward(fishing_power + power)
if(bait && prob(max(50 - bait.fishing_power,0))) //50 - bait.fishing_power% chance to lose your bait
to_chat(fisher, span_notice("Your [bait] is lost!"))
cut_overlays()
Expand Down Expand Up @@ -112,15 +116,18 @@
I.alpha = 0
animate(I, pixel_z = 32, alpha = 255, time = 2, easing = ELASTIC_EASING)

/obj/item/twohanded/fishingrod/proc/spawn_reward()
var/obj/picked_reward = fishing_component.getCommonLoot()
/obj/item/twohanded/fishingrod/proc/spawn_reward(var/fishing_power = 0)
var/picked_reward = fishing_component.get_reward(fishing_power)
if(!picked_reward || picked_reward == FISHING_LOOT_NOTHING) //nothing or something messed up
fisher.visible_message(span_notice("[fisher] reels in ... nothing!"), span_notice("You reel in... nothing! Better luck next time!"))
return
var/obj/reward_item = new picked_reward(fishing_component.parent)
reward_item.alpha = 0
reward_item.pixel_y = -12
animate(reward_item,time = 0.25 SECONDS,pixel_y = 0,alpha = 255,easing = SINE_EASING)
if(!fisher) //uh oh
return
fisher.visible_message(span_notice("[fisher] reels in a [reward_item]!"), span_notice("You reel in a [reward_item]!"))
fisher.visible_message(span_notice("[fisher] reels in [reward_item]!"), span_notice("You reel in [reward_item]!"))
if(fisher.Adjacent(fishing_component.parent))
unwield(fisher,show_message = FALSE)
if(fisher.put_in_hands(reward_item))
Expand All @@ -147,10 +154,60 @@
if(bait)
user.put_in_hands(bait)
to_chat(user, span_notice("You take the [bait] off the fishing rod."))
cut_overlays()
bait = null
recalculate_power()

/obj/item/twohanded/fishingrod/proc/recalculate_power()
fishing_power = initial(fishing_power)
if(bait)
fishing_power += bait.fishing_power

/obj/item/twohanded/fishingrod/collapsable
name = "collapsable fishing rod"
icon_state = "fishing_rod_collapse_c"
desc = "A collapsable fishing rod! This one can fit into your backpack for space hikes and the like."
var/opened = FALSE
fishing_power = 15

/obj/item/twohanded/fishingrod/collapsable/attackby(obj/item/B, mob/user, params)
if(!istype(B,/obj/item/reagent_containers/food/snacks/bait))
return
if(!opened)
to_chat(user,"You can't put bait on a collapsed rod!")
return
..()

/obj/item/twohanded/fishingrod/collapsable/AltClick(mob/living/user)
if(bait)
return ..()
toggle(user)

/obj/item/twohanded/fishingrod/collapsable/proc/toggle(mob/user)
if(wielded)
to_chat(user,"You can't collapse the rod if you are holding it with both hands")
return
if(fishing)
to_chat(user,"You can't collapse the fishing rod if you are currently using it!")
return
if(!user.is_holding(src)) //no uncollapsing in your backpack or pockets
return
opened = !opened
w_class = opened ? WEIGHT_CLASS_BULKY : WEIGHT_CLASS_SMALL
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
update_icon()

/obj/item/twohanded/fishingrod/collapsable/update_icon()
icon_state = "fishing_rod_collapse[opened ? "" : "_c"]"

/obj/item/twohanded/fishingrod/collapsable/attack_self(mob/user)
if(!opened)
toggle(user)
return
..()

/obj/item/twohanded/fishingrod/collapsable/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
if(!opened)
to_chat(user,"The collapsable rod has to be open before you can do anything!")
return
..()
2 changes: 1 addition & 1 deletion yogstation/code/modules/clothing/fishing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
alternate_worn_icon = 'yogstation/icons/mob/head.dmi'
icon = 'yogstation/icons/obj/clothing/hats.dmi'

/obj/item/clothing/head/fishingcap/Initialize()
/obj/item/clothing/head/fishing/Initialize()
. = ..()
AddComponent(/datum/component/fishingbonus,5)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified yogstation/icons/obj/fishing/fishing.dmi
Binary file not shown.