Merge pull request #10090 from Nyksia/resize-fix

Resize fix and polish
This commit is contained in:
Novacat
2021-04-07 11:51:49 -04:00
committed by Chompstation Bot
parent 1b9c7ace1a
commit 9f5bd65d67
13 changed files with 90 additions and 44 deletions

View File

@@ -65,4 +65,14 @@
#define MAT_PLASTITANIUM "plastitanium"
#define MAT_PLASTITANIUMHULL "plastitanium hull"
#define MAT_PLASTITANIUMGLASS "plastitanium glass"
#define MAT_GOLDHULL "gold hull"
#define MAT_GOLDHULL "gold hull"
#define RESIZE_HUGE 2
#define RESIZE_BIG 1.5
#define RESIZE_NORMAL 1
#define RESIZE_SMALL 0.5
#define RESIZE_TINY 0.25
#define RESIZE_A_HUGEBIG (RESIZE_HUGE + RESIZE_BIG) / 2
#define RESIZE_A_BIGNORMAL (RESIZE_BIG + RESIZE_NORMAL) / 2
#define RESIZE_A_NORMALSMALL (RESIZE_NORMAL + RESIZE_SMALL) / 2
#define RESIZE_A_SMALLTINY (RESIZE_SMALL + RESIZE_TINY) / 2

View File

@@ -1,4 +1,6 @@
//TFF 28/8/19 - cleanup of areas placement - removes all but rogueminer_vr stuff.
/area
var/limit_mob_size = TRUE //If mob size is limited in the area.
/area/shuttle/belter
name = "Belter Shuttle"

View File

@@ -222,7 +222,7 @@
// Playerscale
var/size = dna.GetUIValueRange(DNA_UI_PLAYERSCALE, player_sizes_list.len)
if((0 < size) && (size <= player_sizes_list.len))
H.resize(player_sizes_list[player_sizes_list[size]], FALSE)
H.resize(player_sizes_list[player_sizes_list[size]], TRUE)
// Tail/Taur Color
H.r_tail = dna.GetUIValueRange(DNA_UI_TAIL_R, 255)

View File

@@ -155,6 +155,7 @@ var/list/admin_verbs_fun = list(
/client/proc/smite,
/client/proc/smite_vr, //VOREStation Add,
/client/proc/admin_lightning_strike,
/client/proc/resize //VOREStation Add,
)
var/list/admin_verbs_spawn = list(

View File

@@ -0,0 +1,16 @@
/client/proc/resize(var/mob/living/L in mob_list)
set name = "Resize"
set desc = "Resizes any living mob without any restrictions on size."
set category = "Fun"
if(!check_rights(R_ADMIN, R_FUN))
return
var/size_multiplier = input(usr, "Input size multiplier.", "Resize", 1)
L.resize(size_multiplier, TRUE, TRUE)
if(size_multiplier >= RESIZE_TINY && size_multiplier <= RESIZE_HUGE)
L.size_uncapped = FALSE
else
L.size_uncapped = TRUE
log_and_message_admins("has changed [key_name(L)]'s size multiplier to [size_multiplier].")
feedback_add_details("admin_verb","RESIZE")

View File

@@ -7,7 +7,6 @@
var/impersonate_bodytype //For impersonating a bodytype
var/ability_flags = 0 //Shadekin abilities/potentially other species-based?
var/sensorpref = 5 //Suit sensor loadout pref
var/unnaturally_resized = FALSE //If one became larger than 200%, or smaller than 25%. This flag is needed for the case when admins want someone to be very big or very small outside of dorms.
var/wings_hidden = FALSE
var/nutrition_hidden = FALSE // Chomp Edit

View File

@@ -62,8 +62,6 @@
//No need to update all of these procs if the guy is dead.
fall() //VORESTATION EDIT. Prevents people from floating
if(unnaturally_resized) //VORESTATION EDIT.
handle_unnatural_size()
if(stat != DEAD && !stasis)
//Updates the number of stored chemicals for powers
handle_changeling()

View File

@@ -78,10 +78,3 @@
// Moving around increases germ_level faster
if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8))
germ_level++
/mob/living/carbon/human/proc/handle_unnatural_size()
if(!in_dorms())
if(src.size_multiplier > 2)
src.resize(2)
else if (src.size_multiplier < 0.25)
src.resize(0.25)

View File

@@ -6,6 +6,7 @@
appearance_flags = TILE_BOUND|PIXEL_SCALE|KEEP_TOGETHER
var/hunger_rate = DEFAULT_HUNGER_FACTOR
var/resizable = TRUE
var/size_uncapped = FALSE //Determines if a mob's size obedies the resize cap, used for adminbus resize.
//custom say verbs
var/custom_say = null

View File

@@ -1,16 +1,5 @@
//these aren't defines so they can stay in this file
var/const/RESIZE_HUGE = 2
var/const/RESIZE_BIG = 1.5
var/const/RESIZE_NORMAL = 1
var/const/RESIZE_SMALL = 0.5
var/const/RESIZE_TINY = 0.25
//average
var/const/RESIZE_A_HUGEBIG = (RESIZE_HUGE + RESIZE_BIG) / 2
var/const/RESIZE_A_BIGNORMAL = (RESIZE_BIG + RESIZE_NORMAL) / 2
var/const/RESIZE_A_NORMALSMALL = (RESIZE_NORMAL + RESIZE_SMALL) / 2
var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2
GLOBAL_LIST_EMPTY(size_uncapped_mobs)
GLOBAL_VAR(size_uncapped_mobs_timer)
// Adding needed defines to /mob/living
// Note: Polaris had this on /mob/living/carbon/human We need it higher up for animals and stuff.
@@ -64,28 +53,58 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2
* Resizes the mob immediately to the desired mod, animating it growing/shrinking.
* It can be used by anything that calls it.
*/
/atom/movable/proc/in_dorms()
var/area/A = get_area(src)
return istype(A, /area/crew_quarters/sleep)
/atom/movable/proc/size_range_check(size_select) //both objects and mobs needs to have that
if((!in_dorms() && (size_select > 200 || size_select < 25)) || (size_select > 600 || size_select <1))
var/area/A = get_area(src) //Get the atom's area to check for size limit.
if((A.limit_mob_size && (size_select > 200 || size_select < 25)) || (size_select > 600 || size_select <1))
return FALSE
return TRUE
/mob/living/proc/resize(var/new_size, var/animate = TRUE, var/mark_unnatural_size = TRUE)
/proc/add_to_uncapped_list(var/mob/living/L)
if(L.size_uncapped)
return
if(!GLOB.size_uncapped_mobs.len)
GLOB.size_uncapped_mobs_timer = addtimer(CALLBACK(GLOBAL_PROC, .check_uncapped_list), 2 SECONDS, TIMER_LOOP | TIMER_UNIQUE | TIMER_STOPPABLE)
GLOB.size_uncapped_mobs |= weakref(L)
/proc/remove_from_uncapped_list(var/mob/living/L)
if(!GLOB.size_uncapped_mobs.len)
return
GLOB.size_uncapped_mobs -= weakref(L)
if(!GLOB.size_uncapped_mobs.len)
deltimer(GLOB.size_uncapped_mobs_timer)
GLOB.size_uncapped_mobs_timer = null
/proc/check_uncapped_list()
for(var/weakref/wr in GLOB.size_uncapped_mobs)
var/mob/living/L = wr.resolve()
var/area/A = get_area(L)
if(!istype(L))
GLOB.size_uncapped_mobs -= wr
continue
if((A.limit_mob_size && !L.size_uncapped) && (L.size_multiplier <= RESIZE_TINY || L.size_multiplier >= RESIZE_HUGE))
L.resize(L.size_multiplier)
GLOB.size_uncapped_mobs -= wr
if(!GLOB.size_uncapped_mobs.len)
deltimer(GLOB.size_uncapped_mobs_timer)
GLOB.size_uncapped_mobs_timer = null
/mob/living/proc/resize(var/new_size, var/animate = TRUE, var/uncapped = FALSE)
if(!uncapped)
new_size = clamp(new_size, RESIZE_TINY, RESIZE_HUGE)
src.size_uncapped = FALSE
remove_from_uncapped_list(src)
else
add_to_uncapped_list(src)
if(size_multiplier == new_size)
return 1
size_multiplier = new_size //Change size_multiplier so that other items can interact with them
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(new_size > 2 || new_size < 0.25)
if(mark_unnatural_size) //Will target size be reverted to ordinary bounds when out of dorms or not?
H.unnaturally_resized = TRUE
else
H.unnaturally_resized = FALSE
if(animate)
var/change = new_size - size_multiplier
var/duration = (abs(change)+0.25) SECONDS

View File

@@ -89,12 +89,8 @@
/obj/item/projectile/beam/sizelaser/on_hit(var/atom/target)
var/mob/living/M = target
if(istype(M))
if(!M.in_dorms() || !istype(M, /mob/living/carbon/human))
if(!M.resize(clamp(set_size,0.25,2)))
to_chat(M, "<font color='blue'>The beam fires into your body, changing your size!</font>")
else
if(!M.resize(clamp(set_size,0.01,6)))
to_chat(M, "<font color='blue'>The beam fires into your body, changing your size!</font>")
if(!M.resize(set_size))
to_chat(M, "<font color='blue'>The beam fires into your body, changing your size!</font>")
M.updateicon()
return
return 1
@@ -102,7 +98,10 @@
/obj/item/projectile/beam/sizelaser/admin/on_hit(var/atom/target)
var/mob/living/M = target
if(istype(M))
M.resize(set_size, TRUE, FALSE)
M.resize(set_size, TRUE, TRUE)
if(set_size >= RESIZE_TINY && set_size <= RESIZE_HUGE)
M.size_uncapped = FALSE
M.size_uncapped = TRUE
to_chat(M, "<font color='blue'>The beam fires into your body, changing your size!</font>")
M.updateicon()
return

View File

@@ -979,6 +979,9 @@
icon_state = "recreation_area_restroom"
sound_env = SMALL_ENCLOSED
/area/crew_quarters/sleep
limit_mob_size = FALSE
/area/crew_quarters/sleep/maintDorm1
name = "\improper Construction Dorm 1"
icon_state = "Sleep"
@@ -1141,6 +1144,9 @@
flags = RAD_SHIELDED | BLUE_SHIELDED
soundproofed = TRUE
/area/holodeck/holodorm
limit_mob_size = FALSE
/area/holodeck/holodorm/source_basic
name = "\improper Holodeck Source"
flags = RAD_SHIELDED | BLUE_SHIELDED
@@ -1537,6 +1543,7 @@ area/shuttle/mining_outpost/shuttle
requires_power = 0
flags = RAD_SHIELDED
icon_state = "red2"
limit_mob_size = FALSE
/area/unknown/dorm1
name = "Unknown Dorm 1"

View File

@@ -1790,6 +1790,7 @@
#include "code\modules\admin\verbs\pray.dm"
#include "code\modules\admin\verbs\randomverbs.dm"
#include "code\modules\admin\verbs\randomverbs_vr.dm"
#include "code\modules\admin\verbs\resize.dm"
#include "code\modules\admin\verbs\smite.dm"
#include "code\modules\admin\verbs\smite_vr.dm"
#include "code\modules\admin\verbs\striketeam.dm"