mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-24 17:11:40 +00:00
Makes sif trees pretty. Also, scale can now be adjusted in the X axis and Y axis separately.
This commit is contained in:
@@ -14,11 +14,27 @@
|
||||
var/product_amount = 10 // How much of a stack you get, if the above is defined.
|
||||
var/is_stump = FALSE // If true, suspends damage tracking and most other effects.
|
||||
var/indestructable = FALSE // If true, the tree cannot die.
|
||||
var/randomize_size = FALSE // If true, the tree will choose a random scale in the X and Y directions to stretch.
|
||||
|
||||
/obj/structure/flora/tree/Initialize()
|
||||
icon_state = choose_icon_state()
|
||||
|
||||
if(randomize_size)
|
||||
icon_scale_x = rand(90, 125) / 100
|
||||
icon_scale_y = rand(90, 125) / 100
|
||||
|
||||
if(prob(50))
|
||||
icon_scale_x *= -1
|
||||
update_transform()
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/structure/flora/tree/update_transform()
|
||||
var/matrix/M = matrix()
|
||||
M.Scale(icon_scale_x, icon_scale_y)
|
||||
M.Translate(0, 16*(icon_scale_y-1))
|
||||
animate(src, transform = M, time = 10)
|
||||
|
||||
// Override this for special icons.
|
||||
/obj/structure/flora/tree/proc/choose_icon_state()
|
||||
return icon_state
|
||||
@@ -57,8 +73,11 @@
|
||||
/obj/structure/flora/tree/proc/hit_animation()
|
||||
var/init_px = pixel_x
|
||||
var/shake_dir = pick(-1, 1)
|
||||
animate(src, transform=turn(matrix(), shake_animation_degrees * shake_dir), pixel_x=init_px + 2*shake_dir, time=1)
|
||||
animate(transform=null, pixel_x=init_px, time=6, easing=ELASTIC_EASING)
|
||||
var/matrix/M = matrix()
|
||||
M.Scale(icon_scale_x, icon_scale_y)
|
||||
M.Translate(0, 16*(icon_scale_y-1))
|
||||
animate(src, transform=turn(M, shake_animation_degrees * shake_dir), pixel_x=init_px + 2*shake_dir, time=1)
|
||||
animate(transform=M, pixel_x=init_px, time=6, easing=ELASTIC_EASING)
|
||||
|
||||
// Used when the tree gets hurt.
|
||||
/obj/structure/flora/tree/proc/adjust_health(var/amount, var/damage_wood = FALSE)
|
||||
@@ -247,13 +266,19 @@
|
||||
base_state = "tree_sif"
|
||||
product = /obj/item/stack/material/log/sif
|
||||
catalogue_data = list(/datum/category_item/catalogue/flora/sif_tree)
|
||||
randomize_size = TRUE
|
||||
var/light_shift = 0
|
||||
|
||||
/obj/structure/flora/tree/sif/choose_icon_state()
|
||||
light_shift = rand(0, 5)
|
||||
return "[base_state][light_shift]"
|
||||
|
||||
/obj/structure/flora/tree/sif/Initialize()
|
||||
. = ..()
|
||||
update_icon()
|
||||
return ..()
|
||||
|
||||
/obj/structure/flora/tree/sif/update_icon()
|
||||
set_light(5, 1, "#33ccff")
|
||||
var/image/glow = image(icon = 'icons/obj/flora/deadtrees.dmi', icon_state = "[base_state]_glow")
|
||||
set_light(5 - light_shift, 1, "#33ccff") // 5 variants, missing bulbs. 5th has no bulbs, so no glow.
|
||||
var/image/glow = image(icon = icon, icon_state = "[base_state][light_shift]_glow")
|
||||
glow.plane = PLANE_LIGHTING_ABOVE
|
||||
overlays = list(glow)
|
||||
|
||||
@@ -781,7 +781,8 @@ Loot piles can be depleted, if loot_depleted is turned on. Note that players wh
|
||||
// Todo: Better loot.
|
||||
/obj/structure/loot_pile/mecha/gygax/dark/adv
|
||||
icon_state = "darkgygax_adv-broken"
|
||||
icon_scale = 1.5
|
||||
icon_scale_x = 1.5
|
||||
icon_scale_y = 1.5
|
||||
pixel_y = 8
|
||||
|
||||
/obj/structure/loot_pile/mecha/gygax/medgax
|
||||
|
||||
Reference in New Issue
Block a user