add(atom/movable): Makes it possible for mappers to change scale/rotation of objs (#15835)

* Removes update_transform() from mob/
* Adds new file to _defines to hold default scales
* Tweaks atom/movable to use new defines
* Tweaks mob, living, human, species to use new defines for comparisons
* On atom/movable, we check if it is rotated or otherwise scaled and then call update_transform()
* It is now possible
This commit is contained in:
Runa Dacino
2024-03-16 04:50:03 +10:00
committed by GitHub
parent 69896eaa10
commit db998502f9
7 changed files with 18 additions and 9 deletions
+7
View File
@@ -0,0 +1,7 @@
/*
** Holds defines for code\game\atoms_movable.dm to avoid magic numbers and potential unexpected overwrites down the line
*/
#define DEFAULT_ICON_SCALE_X 1
#define DEFAULT_ICON_SCALE_Y 1
#define DEFAULT_ICON_ROTATION 0
+6 -4
View File
@@ -16,9 +16,9 @@
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_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/icon_scale_x = DEFAULT_ICON_SCALE_X // Used to scale icons up or down horizonally in update_transform().
var/icon_scale_y = DEFAULT_ICON_SCALE_Y // Used to scale icons up or down vertically in update_transform().
var/icon_rotation = DEFAULT_ICON_ROTATION // Used to rotate icons in update_transform()
var/icon_expected_height = 32
var/icon_expected_width = 32
var/old_x = 0
@@ -45,6 +45,8 @@
add_overlay(list(em_block), TRUE)
if(opacity)
AddElement(/datum/element/light_blocking)
if(icon_scale_x != DEFAULT_ICON_SCALE_X || icon_scale_y != DEFAULT_ICON_SCALE_Y || icon_rotation != DEFAULT_ICON_ROTATION)
update_transform()
switch(light_system)
if(STATIC_LIGHT)
update_light()
@@ -637,4 +639,4 @@
return selfimage
/atom/movable/proc/get_cell()
return
return
@@ -1211,7 +1211,7 @@
if(species.default_language)
add_language(species.default_language)
if(species.icon_scale_x != 1 || species.icon_scale_y != 1)
if(species.icon_scale_x != DEFAULT_ICON_SCALE_X || species.icon_scale_y != DEFAULT_ICON_SCALE_Y)
update_transform()
if(example) //VOREStation Edit begin
@@ -32,8 +32,8 @@
var/tail_animation // If set, the icon to obtain tail animation states from.
var/tail_hair
var/icon_scale_x = 1 // Makes the icon wider/thinner.
var/icon_scale_y = 1 // Makes the icon taller/shorter.
var/icon_scale_x = DEFAULT_ICON_SCALE_X // Makes the icon wider/thinner.
var/icon_scale_y = DEFAULT_ICON_SCALE_Y // 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.
+1 -1
View File
@@ -1307,5 +1307,5 @@
/mob/living/set_dir(var/new_dir)
. = ..()
if(size_multiplier != 1 || icon_scale_x != 1 && center_offset > 0)
if(size_multiplier != 1 || icon_scale_x != DEFAULT_ICON_SCALE_X && center_offset > 0)
update_transform(TRUE)
-1
View File
@@ -42,7 +42,6 @@
lastarea = get_area(src)
set_focus(src) // VOREStation Add - Key Handling
hook_vr("mob_new",list(src)) //VOREStation Code
update_transform() // Some mobs may start bigger or smaller than normal.
return ..()
/mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
+1
View File
@@ -33,6 +33,7 @@
#include "code\__defines\admin_vr.dm"
#include "code\__defines\appearance.dm"
#include "code\__defines\atmos.dm"
#include "code\__defines\atoms_movable.dm"
#include "code\__defines\belly_modes_vr.dm"
#include "code\__defines\callbacks.dm"
#include "code\__defines\chat.dm"