mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Merge pull request #2138 from Cheridan/hydro
[501] Hydroponics Plant Size Scaling
This commit is contained in:
@@ -120,6 +120,19 @@ var/const/Sqrt2 = 1.41421356
|
||||
var/t = round((val - min) / d)
|
||||
return val - (t * d)
|
||||
|
||||
|
||||
//A logarithm that converts an integer to a number scaled between 0 and 1 (can be tweaked to be higher).
|
||||
//Currently, this is used for hydroponics-produce sprite transforming, but could be useful for other transform functions.
|
||||
/proc/TransformUsingVariable(var/input, var/inputmaximum, var/scaling_modifier = 0)
|
||||
|
||||
var/inputToDegrees = (input/inputmaximum)*180 //Converting from a 0 -> 100 scale to a 0 -> 180 scale. The 0 -> 180 scale corresponds to degrees
|
||||
var/size_factor = ((-cos(inputToDegrees) +1) /2) //returns a value from 0 to 1
|
||||
|
||||
return size_factor + scaling_modifier //scale mod of 0 results in a number from 0 to 1. A scale modifier of +0.5 returns 0.5 to 1.5
|
||||
//world<< "Transform multiplier of [src] is [size_factor + scaling_modifer]"
|
||||
|
||||
|
||||
|
||||
//converts a uniform distributed random number into a normal distributed one
|
||||
//since this method produces two random numbers, one is saved for subsequent calls
|
||||
//(making the cost negligble for every second call)
|
||||
|
||||
@@ -20,12 +20,16 @@
|
||||
var/potency = -1
|
||||
var/plant_type = 0
|
||||
icon = 'icons/obj/harvest.dmi'
|
||||
New(newloc,newpotency)
|
||||
if (!isnull(newpotency))
|
||||
potency = newpotency
|
||||
..()
|
||||
src.pixel_x = rand(-5.0, 5)
|
||||
src.pixel_y = rand(-5.0, 5)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/New(newloc,newpotency)
|
||||
if (!isnull(newpotency))
|
||||
potency = newpotency
|
||||
..()
|
||||
pixel_x = rand(-5.0, 5)
|
||||
pixel_y = rand(-5.0, 5)
|
||||
|
||||
transform *= TransformUsingVariable(potency, 100, 0.5) //Makes the resulting produce's sprite larger or smaller based on potency!
|
||||
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
..()
|
||||
|
||||
@@ -14,13 +14,15 @@
|
||||
var/maturation = 7
|
||||
var/production = 7
|
||||
var/yield = 2
|
||||
var/potency = 1
|
||||
var/potency = 20
|
||||
var/plant_type = 0
|
||||
New()
|
||||
create_reagents(50)
|
||||
|
||||
/obj/item/weapon/grown/New()
|
||||
create_reagents(50)
|
||||
|
||||
/obj/item/weapon/grown/proc/changePotency(newValue) //-QualityVan
|
||||
potency = newValue
|
||||
transform *= TransformUsingVariable(potency, 100, 0.5) //Makes the resulting produce's sprite larger or smaller based on potency!
|
||||
|
||||
/obj/item/weapon/grown/log
|
||||
name = "tower-cap log"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
del(src)
|
||||
|
||||
/obj/item/weapon/grown/nettle/changePotency(newValue) //-QualityVan
|
||||
potency = newValue
|
||||
..()
|
||||
force = round((5+potency/5), 1)
|
||||
|
||||
//Deathnettle
|
||||
@@ -90,7 +90,7 @@
|
||||
del(src)
|
||||
|
||||
/obj/item/weapon/grown/deathnettle/changePotency(newValue) //-QualityVan
|
||||
potency = newValue
|
||||
..()
|
||||
force = round((5+potency/2.5), 1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user