Makes sif trees pretty. Also, scale can now be adjusted in the X axis and Y axis separately.

This commit is contained in:
Mechoid
2019-05-05 14:23:44 -07:00
parent 2358af981a
commit 20ba94d209
22 changed files with 115 additions and 51 deletions

View File

@@ -16,7 +16,8 @@
var/moved_recently = 0
var/mob/pulledby = null
var/item_state = null // Used to specify the item state for the on-mob overlays.
var/icon_scale = 1 // Used to scale icons up or down in update_transform().
var/icon_scale_x = 1 // Used to scale icons up or down horizonally in update_transform().
var/icon_scale_y = 1 // Used to scale icons up or down vertically in update_transform().
var/icon_rotation = 0 // Used to rotate icons in update_transform()
var/old_x = 0
var/old_y = 0
@@ -469,13 +470,16 @@
/atom/movable/proc/update_transform()
var/matrix/M = matrix()
M.Scale(icon_scale)
M.Scale(icon_scale_x, icon_scale_y)
M.Turn(icon_rotation)
src.transform = M
// Use this to set the object's scale.
/atom/movable/proc/adjust_scale(new_scale)
icon_scale = new_scale
/atom/movable/proc/adjust_scale(new_scale_x, new_scale_y)
if(isnull(new_scale_y))
new_scale_y = new_scale_x
icon_scale_x = new_scale_x
icon_scale_y = new_scale_y
update_transform()
/atom/movable/proc/adjust_rotation(new_rotation)

View File

@@ -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)

View File

@@ -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

View File

@@ -42,7 +42,8 @@
var/accuracy // Positive numbers makes hitting things with guns easier, negatives make it harder.
var/accuracy_dispersion // Positive numbers make gun firing cover a wider tile range, and therefore more inaccurate. Negatives help negate dispersion penalties.
var/metabolism_percent // Adjusts the mob's metabolic rate, which affects reagent processing. Won't affect mobs without reagent processing.
var/icon_scale_percent // Makes the holder's icon get scaled up or down.
var/icon_scale_x_percent // Makes the holder's icon get scaled wider or thinner.
var/icon_scale_y_percent // Makes the holder's icon get scaled taller or shorter.
var/attack_speed_percent // Makes the holder's 'attack speed' (click delay) shorter or longer.
var/pain_immunity // Makes the holder not care about pain while this is on. Only really useful to human mobs.
var/pulse_modifier // Modifier for pulse, will be rounded on application, then added to the normal 'pulse' multiplier which ranges between 0 and 5 normally. Only applied if they're living.
@@ -73,7 +74,7 @@
holder.modifiers.Remove(src)
if(mob_overlay_state) // We do this after removing ourselves from the list so that the overlay won't remain.
holder.update_modifier_visuals()
if(icon_scale_percent) // Correct the scaling.
if(icon_scale_x_percent || icon_scale_y_percent) // Correct the scaling.
holder.update_transform()
if(client_color)
holder.update_client_color()
@@ -140,7 +141,7 @@
mod.on_applied()
if(mod.mob_overlay_state)
update_modifier_visuals()
if(mod.icon_scale_percent)
if(mod.icon_scale_x_percent || mod.icon_scale_y_percent)
update_transform()
if(mod.client_color)
update_client_color()
@@ -232,8 +233,11 @@
effects += "Your metabolism is [metabolism_percent > 1.0 ? "faster" : "slower"], \
causing reagents in your body to process, and hunger to occur [multipler_to_percentage(metabolism_percent, TRUE)] [metabolism_percent > 1.0 ? "faster" : "slower"]."
if(!isnull(icon_scale_percent))
effects += "Your appearance is [multipler_to_percentage(icon_scale_percent, TRUE)] [icon_scale_percent > 1 ? "larger" : "smaller"]."
if(!isnull(icon_scale_x_percent))
effects += "Your appearance is [multipler_to_percentage(icon_scale_x_percent, TRUE)] [icon_scale_x_percent > 1 ? "wider" : "thinner"]."
if(!isnull(icon_scale_y_percent))
effects += "Your appearance is [multipler_to_percentage(icon_scale_y_percent, TRUE)] [icon_scale_y_percent > 1 ? "taller" : "shorter"]."
if(!isnull(attack_speed_percent))
effects += "The delay between attacking is [multipler_to_percentage(attack_speed_percent, TRUE)] [disable_duration_percent > 1.0 ? "longer" : "shorter"]."

View File

@@ -56,7 +56,8 @@ the artifact triggers the rage.
outgoing_melee_damage_percent = 1.5 // 50% more damage from melee.
max_health_percent = 1.5 // More health as a buffer, however the holder might fall into crit after this expires if they're mortally wounded.
disable_duration_percent = 0.25 // Disables only last 25% as long.
icon_scale_percent = 1.2 // Look scarier.
icon_scale_x_percent = 1.2 // Look scarier.
icon_scale_y_percent = 1.2
pain_immunity = TRUE // Avoid falling over from shock (at least until it expires).
// The less good stuff.

View File

@@ -64,25 +64,29 @@
name = "Larger"
desc = "Your body is larger than average."
icon_scale_percent = 1.1
icon_scale_x_percent = 1.1
icon_scale_y_percent = 1.1
/datum/modifier/trait/large
name = "Large"
desc = "Your body is a bit larger than average."
icon_scale_percent = 1.05
icon_scale_x_percent = 1.05
icon_scale_y_percent = 1.05
/datum/modifier/trait/small
name = "Small"
desc = "Your body is a bit smaller than average."
icon_scale_percent = 0.95
icon_scale_x_percent = 0.95
icon_scale_y_percent = 0.95
/datum/modifier/trait/smaller
name = "Smaller"
desc = "Your body is smaller than average."
icon_scale_percent = 0.9
icon_scale_x_percent = 0.9
icon_scale_y_percent = 0.9
/datum/modifier/trait/colorblind_protanopia
name = "Protanopia"

View File

@@ -14,7 +14,8 @@
disable_duration_percent = 0.25 // Disables only last 25% as long.
incoming_damage_percent = 0.5 // 50% incoming damage.
icon_scale_percent = 1.2 // Become a bigger target.
icon_scale_x_percent = 1.2 // Become a bigger target.
icon_scale_y_percent = 1.2
pain_immunity = TRUE
slowdown = 2

View File

@@ -1120,7 +1120,7 @@
if(species.default_language)
add_language(species.default_language)
if(species.icon_scale != 1)
if(species.icon_scale_x != 1 || species.icon_scale_y != 1)
update_transform()
if(species.base_color && default_colour)

View File

@@ -32,7 +32,8 @@
var/tail_animation // If set, the icon to obtain tail animation states from.
var/tail_hair
var/icon_scale = 1 // Makes the icon larger/smaller.
var/icon_scale_x = 1 // Makes the icon wider/thinner.
var/icon_scale_y = 1 // Makes the icon taller/shorter.
var/race_key = 0 // Used for mob icon cache string.
var/icon/icon_template // Used for mob icon generation for non-32x32 species.

View File

@@ -121,13 +121,17 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
/mob/living/carbon/human/update_transform()
// First, get the correct size.
var/desired_scale = icon_scale
var/desired_scale_x = icon_scale_x
var/desired_scale_y = icon_scale_y
desired_scale *= species.icon_scale
desired_scale_x *= species.icon_scale_x
desired_scale_y *= species.icon_scale_y
for(var/datum/modifier/M in modifiers)
if(!isnull(M.icon_scale_percent))
desired_scale *= M.icon_scale_percent
if(!isnull(M.icon_scale_x_percent))
desired_scale_x *= M.icon_scale_x_percent
if(!isnull(M.icon_scale_y_percent))
desired_scale_y *= M.icon_scale_y_percent
// Regular stuff again.
var/matrix/M = matrix()
@@ -139,12 +143,12 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
if(lying && !species.prone_icon) //Only rotate them if we're not drawing a specific icon for being prone.
M.Turn(90)
M.Scale(desired_scale)
M.Scale(desired_scale_x, desired_scale_y)
M.Translate(1,-6)
layer = MOB_LAYER -0.01 // Fix for a byond bug where turf entry order no longer matters
else
M.Scale(desired_scale)
M.Translate(0, 16*(desired_scale-1))
M.Scale(desired_scale_x, desired_scale_y)
M.Translate(0, 16*(desired_scale_y-1))
layer = MOB_LAYER // Fix for a byond bug where turf entry order no longer matters
animate(src, transform = M, time = anim_time)

View File

@@ -1115,15 +1115,18 @@ default behaviour is:
/mob/living/update_transform()
// First, get the correct size.
var/desired_scale = icon_scale
var/desired_scale_x = icon_scale_x
var/desired_scale_y = icon_scale_y
for(var/datum/modifier/M in modifiers)
if(!isnull(M.icon_scale_percent))
desired_scale *= M.icon_scale_percent
if(!isnull(M.icon_scale_x_percent))
desired_scale_x *= M.icon_scale_x_percent
if(!isnull(M.icon_scale_y_percent))
desired_scale_y *= M.icon_scale_y_percent
// Now for the regular stuff.
var/matrix/M = matrix()
M.Scale(desired_scale)
M.Translate(0, 16*(desired_scale-1))
M.Scale(desired_scale_x, desired_scale_y)
M.Translate(0, 16*(desired_scale_y-1))
animate(src, transform = M, time = 10)
// This handles setting the client's color variable, which makes everything look a specific color.

View File

@@ -217,7 +217,8 @@
the ferocity of other apex predators in this region of Sif. As such, it is a very invasive species."
description_info = "This slime makes other entities near it feel much colder, and is more resilient to the cold. It also has learned advanced combat tactics from \
having to endure the harsh world outside its lab. Note that processing this large slime will give six cores."
icon_scale = 2
icon_scale_x = 2
icon_scale_y = 2
optimal_combat = TRUE // Gotta be sharp to survive out there.
rabid = TRUE
rainbow_core_candidate = FALSE

View File

@@ -57,7 +57,8 @@
icon_state = "commonblackbird"
icon_dead = "commonblackbird-dead"
tt_desc = "E Turdus merula"
icon_scale = 0.5
icon_scale_x = 0.5
icon_scale_y = 0.5
/mob/living/simple_mob/animal/passive/bird/azure_tit
name = "azure tit"
@@ -65,7 +66,8 @@
icon_state = "azuretit"
icon_dead = "azuretit-dead"
tt_desc = "E Cyanistes cyanus"
icon_scale = 0.5
icon_scale_x = 0.5
icon_scale_y = 0.5
/mob/living/simple_mob/animal/passive/bird/european_robin
name = "european robin"
@@ -73,7 +75,8 @@
icon_state = "europeanrobin"
icon_dead = "europeanrobin-dead"
tt_desc = "E Erithacus rubecula"
icon_scale = 0.5
icon_scale_x = 0.5
icon_scale_y = 0.5
/mob/living/simple_mob/animal/passive/bird/goldcrest
name = "goldcrest"
@@ -82,7 +85,8 @@
icon_state = "goldcrest"
icon_dead = "goldcrest-dead"
tt_desc = "E Regulus regulus"
icon_scale = 0.5
icon_scale_x = 0.5
icon_scale_y = 0.5
/mob/living/simple_mob/animal/passive/bird/ringneck_dove
name = "ringneck dove"
@@ -90,4 +94,5 @@
icon_state = "ringneckdove"
icon_dead = "ringneckdove-dead"
tt_desc = "E Streptopelia risoria" // This is actually disputed IRL but since we can't tell the future it'll stay the same for 500+ years.
icon_scale = 0.5
icon_scale_x = 0.5
icon_scale_y = 0.5

View File

@@ -32,7 +32,8 @@
icon_state = "sif_crab"
icon_living = "sif_crab"
icon_dead = "sif_crab_dead"
icon_scale = 1.5
icon_scale_x = 1.5
icon_scale_y = 1.5
faction = "crabs"

View File

@@ -67,7 +67,8 @@
name = "big shantak"
desc = "A piglike creature with a bright iridiscent mane that sparkles as though lit by an inner light. \
This one seems bigger than the others, and has a commanding presence."
icon_scale = 1.5
icon_scale_x = 1.5
icon_scale_y = 1.5
maxHealth = 125
player_msg = "You have the ability to <b>command other shantaks to follow you</b>."

View File

@@ -105,7 +105,8 @@
name = "siege engine hivebot"
desc = "A large robot capable of delivering long range bombardment."
projectiletype = /obj/item/projectile/arc/test
icon_scale = 2
icon_scale_x = 2
icon_scale_y = 2
icon_state = "red"
icon_living = "red"

View File

@@ -39,7 +39,8 @@
desc = "A large robot."
maxHealth = 10 LASERS_TO_KILL // 300 health
health = 10 LASERS_TO_KILL
icon_scale = 2
icon_scale_x = 2
icon_scale_y = 2
player_msg = "You have a very large amount of health."
@@ -49,7 +50,8 @@
desc = "A robot clad in heavy armor."
maxHealth = 5 LASERS_TO_KILL // 150 health.
health = 5 LASERS_TO_KILL
icon_scale = 1.5
icon_scale_x = 1.5
icon_scale_y = 1.5
player_msg = "You are heavily armored."
// Note that armor effectively makes lasers do about 9 damage instead of 30,
// so it has an effective health of ~16.6 LASERS_TO_KILL if regular lasers are used.

View File

@@ -77,7 +77,8 @@
catalogue_data = list(/datum/category_item/catalogue/technology/adv_dark_gygax)
icon_state = "darkgygax_adv"
wreckage = /obj/structure/loot_pile/mecha/gygax/dark/adv
icon_scale = 1.5
icon_scale_x = 1.5
icon_scale_y = 1.5
movement_shake_radius = 14
maxHealth = 450

View File

@@ -106,7 +106,8 @@
friendly = list("pokes") //Anything nice the Behemoth would do would still Kill the Human. Leave it at poke.
attack_sound = 'sound/weapons/heavysmash.ogg'
resistance = 10
icon_scale = 2
icon_scale_x = 2
icon_scale_y = 2
var/energy = 0
var/max_energy = 1000
armor = list(

View File

@@ -14,7 +14,8 @@
icon_dead = "slime adult dead"
glow_range = 5
glow_intensity = 4
icon_scale = 2 // Twice as big as the xenobio variant.
icon_scale_x = 2 // Twice as big as the xenobio variant.
icon_scale_y = 2
pixel_y = -10 // Since the base sprite isn't centered properly, the pixel auto-adjustment needs some help.
default_pixel_y = -10 // To prevent resetting above var.
@@ -63,7 +64,8 @@
check_armour = "melee"
armor_penetration = 30
speed = 2
icon_scale = 2 // It hits like a truck.
icon_scale_x = 2 // It hits like a truck.
icon_scale_y = 2
sharp = TRUE
/obj/item/projectile/icicle/on_impact(atom/A)

View File

@@ -162,7 +162,8 @@
/obj/item/projectile/arc/radioactive
name = "radiation blast"
icon_state = "green_pellet"
icon_scale = 2
icon_scale_x = 2
icon_scale_y = 2
var/rad_power = 50
/obj/item/projectile/arc/radioactive/on_impact(turf/T)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 33 KiB