mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
new aquarium ui and few new additions (#85627)
## About The Pull Request gives the aquarium a new ui:  u can now also pet and nickname ur fish through this interface. petting them will have them do a small dance and increase their happiness  the hearts indicate how happy the fish is with the tank's living conditions and if theyve been petted recently. ## Why It's Good For The Game gives aquariums a better UI making it easier to use ## Changelog 🆑 qol: gives aquariums a new easier to use UI /🆑
This commit is contained in:
@@ -307,14 +307,30 @@
|
||||
|
||||
/obj/structure/aquarium/ui_data(mob/user)
|
||||
. = ..()
|
||||
.["fluid_type"] = fluid_type
|
||||
.["fluidType"] = fluid_type
|
||||
.["temperature"] = fluid_temp
|
||||
.["allow_breeding"] = allow_breeding
|
||||
.["feeding_interval"] = feeding_interval / (1 MINUTES)
|
||||
var/list/content_data = list()
|
||||
for(var/atom/movable/fish in contents)
|
||||
content_data += list(list("name"=fish.name,"ref"=ref(fish)))
|
||||
.["contents"] = content_data
|
||||
.["allowBreeding"] = allow_breeding
|
||||
.["FishData"] = list()
|
||||
.["feedingInterval"] = feeding_interval / (1 MINUTES)
|
||||
.["PropData"] = list()
|
||||
for(var/atom/movable/item in contents)
|
||||
if(isfish(item))
|
||||
var/obj/item/fish/fish = item
|
||||
.["fishData"] += list(list(
|
||||
"fish_ref" = REF(fish),
|
||||
"fish_name" = fish.name,
|
||||
"fish_happiness" = fish.get_happiness_value(),
|
||||
"fish_icon" = fish::icon,
|
||||
"fish_icon_state" = fish::icon_state,
|
||||
"fish_health" = fish.health,
|
||||
))
|
||||
continue
|
||||
.["propData"] += list(list(
|
||||
"prop_ref" = REF(item),
|
||||
"prop_name" = item.name,
|
||||
"prop_icon" = item::icon,
|
||||
"prop_icon_state" = item::icon_state,
|
||||
))
|
||||
|
||||
/obj/structure/aquarium/ui_static_data(mob/user)
|
||||
. = ..()
|
||||
@@ -322,6 +338,7 @@
|
||||
.["minTemperature"] = min_fluid_temp
|
||||
.["maxTemperature"] = max_fluid_temp
|
||||
.["fluidTypes"] = fluid_types
|
||||
.["heart_icon"] = 'icons/effects/effects.dmi'
|
||||
|
||||
/obj/structure/aquarium/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
@@ -345,14 +362,19 @@
|
||||
if("feeding_interval")
|
||||
feeding_interval = params["feeding_interval"] MINUTES
|
||||
. = TRUE
|
||||
if("remove")
|
||||
var/atom/movable/inside = locate(params["ref"]) in contents
|
||||
if(inside)
|
||||
if(isitem(inside))
|
||||
user.put_in_hands(inside)
|
||||
else
|
||||
inside.forceMove(get_turf(src))
|
||||
to_chat(user,span_notice("You take out [inside] from [src]."))
|
||||
if("pet_fish")
|
||||
var/obj/item/fish/fish = locate(params["fish_reference"]) in contents
|
||||
fish?.pet_fish(user)
|
||||
if("remove_item")
|
||||
var/atom/movable/item = locate(params["item_reference"]) in contents
|
||||
item?.forceMove(drop_location())
|
||||
to_chat(user, span_notice("You take out [item] from [src]."))
|
||||
if("rename_fish")
|
||||
var/new_name = sanitize_name(params["chosen_name"])
|
||||
if(!new_name)
|
||||
return
|
||||
var/atom/movable/fish = locate(params["fish_reference"]) in contents
|
||||
fish.name = new_name
|
||||
|
||||
/obj/structure/aquarium/ui_interact(mob/user, datum/tgui/ui)
|
||||
. = ..()
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
#define FISH_SAD 0
|
||||
#define FISH_NEUTRAL 1
|
||||
#define FISH_SATISFIED 2
|
||||
#define FISH_HAPPY 3
|
||||
#define FISH_VERY_HAPPY 4
|
||||
|
||||
// Fish path used for autogenerated fish
|
||||
/obj/item/fish
|
||||
name = "generic looking aquarium fish"
|
||||
@@ -147,6 +153,8 @@
|
||||
|
||||
/// The beauty this fish provides to the aquarium it's inserted in.
|
||||
var/beauty = FISH_BEAUTY_GENERIC
|
||||
///have we recently pet this fish
|
||||
var/recently_petted = FALSE
|
||||
|
||||
/obj/item/fish/Initialize(mapload, apply_qualities = TRUE)
|
||||
. = ..()
|
||||
@@ -755,6 +763,31 @@
|
||||
if(HAS_TRAIT(src, TRAIT_FISH_FROM_CASE)) //Avoid printing money by simply ordering fish and sending it back.
|
||||
calculated_price *= 0.05
|
||||
return round(calculated_price)
|
||||
/obj/item/fish/proc/get_happiness_value()
|
||||
var/happiness_value = 0
|
||||
if(recently_petted)
|
||||
happiness_value++
|
||||
if(HAS_TRAIT(src, TRAIT_FISH_NO_HUNGER) || min((world.time - last_feeding) / feeding_frequency, 1) < 0.5)
|
||||
happiness_value++
|
||||
var/obj/structure/aquarium/aquarium = loc
|
||||
if(!istype(aquarium))
|
||||
return happiness_value
|
||||
if(compatible_fluid_type(required_fluid_type, aquarium.fluid_type))
|
||||
happiness_value++
|
||||
if(ISINRANGE(aquarium.fluid_temp, required_temperature_min, required_temperature_max))
|
||||
happiness_value++
|
||||
return happiness_value
|
||||
|
||||
/obj/item/fish/proc/pet_fish(mob/living/user)
|
||||
if(recently_petted)
|
||||
to_chat(user, span_warning("[src] runs away from your finger as you dip it into the water!"))
|
||||
return
|
||||
if(electrogenesis_power > 15 MEGA JOULES)
|
||||
user.electrocute_act(5, src) //was it all worth it?
|
||||
recently_petted = TRUE
|
||||
SEND_SIGNAL(src, COMSIG_FISH_PETTED)
|
||||
to_chat(user, span_notice("[src] dances around!"))
|
||||
addtimer(VARSET_CALLBACK(src, recently_petted, FALSE), 30 SECONDS)
|
||||
|
||||
/// Returns random fish, using random_case_rarity probabilities.
|
||||
/proc/random_fish_type(required_fluid)
|
||||
|
||||
Reference in New Issue
Block a user