Mech Appearance Update (#7818)

* Mechs are now properly scaled. Also fixes the FUCKING taur sprites.

* What
This commit is contained in:
Mechoid
2021-01-24 11:18:05 -08:00
committed by GitHub
parent 119bd1f458
commit 95ea4f6f2d
15 changed files with 139 additions and 18 deletions
+3
View File
@@ -33,6 +33,9 @@
defence_mode_possible = 1
icon_scale_x = 1.5
icon_scale_y = 1.5
/*
/obj/mecha/combat/durand/New()
..()
+3
View File
@@ -31,6 +31,9 @@
overload_possible = 1
icon_scale_x = 1.35
icon_scale_y = 1.35
//Not quite sure how to move those yet.
/obj/mecha/combat/gygax/get_commands()
var/output = {"<div class='wr'>
+3
View File
@@ -44,6 +44,9 @@
/obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster
)
icon_scale_x = 1.5
icon_scale_y = 1.5
/obj/mecha/combat/marauder/seraph
desc = "Heavy-duty, command-type exosuit. This is a custom model, utilized only by high-ranking military personnel."
name = "Seraph"
@@ -43,6 +43,9 @@
..()
return
/obj/item/mecha_parts/mecha_equipment/proc/add_equip_overlay(obj/mecha/M as obj)
return
/obj/item/mecha_parts/mecha_equipment/proc/update_chassis_page()
if(chassis)
send_byjax(chassis.occupant,"exosuit.browser","eq_list",chassis.get_equipment_list())
@@ -26,9 +26,10 @@
pr_repair_droid = null
..()
/obj/item/mecha_parts/mecha_equipment/repair_droid/attach(obj/mecha/M as obj)
/obj/item/mecha_parts/mecha_equipment/repair_droid/add_equip_overlay(obj/mecha/M as obj)
..()
droid_overlay = new(src.icon, icon_state = "repair_droid")
if(!droid_overlay)
droid_overlay = new(src.icon, icon_state = "repair_droid")
M.add_overlay(droid_overlay)
return
+7 -3
View File
@@ -37,15 +37,19 @@
my_shield = null
..()
/obj/item/mecha_parts/mecha_equipment/combat_shield/add_equip_overlay(obj/mecha/M as obj)
..()
if(!drone_overlay)
drone_overlay = new(src.icon, icon_state = "shield_droid")
M.overlays += drone_overlay
return
/obj/item/mecha_parts/mecha_equipment/combat_shield/attach(obj/mecha/M as obj)
..()
if(chassis)
my_shield.shield_health = 0
my_shield.my_mecha = chassis
my_shield.forceMove(chassis)
drone_overlay = new(src.icon, icon_state = "shield_droid")
M.overlays += drone_overlay
return
/obj/item/mecha_parts/mecha_equipment/combat_shield/detach()
@@ -460,11 +460,15 @@
if(enabled)
set_ready_state(0)
log_message("Activated.")
chassis.overlays += drone_overlay
else
set_ready_state(1)
log_message("Deactivated.")
chassis.overlays -= drone_overlay
/obj/item/mecha_parts/mecha_equipment/crisis_drone/add_equip_overlay(obj/mecha/M as obj)
..()
if(enabled)
M.add_overlay(drone_overlay)
return
/obj/item/mecha_parts/mecha_equipment/crisis_drone/Topic(href, href_list)
..()
+5 -10
View File
@@ -211,6 +211,7 @@
var/obj/item/mecha_parts/mecha_equipment/ME = new path(src)
ME.attach(src)
update_transform()
/obj/mecha/drain_power(var/drain_check)
@@ -1581,11 +1582,12 @@
src.verbs += /obj/mecha/verb/eject
src.Entered(mmi_as_oc)
src.Move(src.loc)
src.icon_state = src.reset_icon()
update_icon()
set_dir(dir_in)
src.log_message("[mmi_as_oc] moved in as pilot.")
if(!hasInternalDamage())
src.occupant << sound('sound/mecha/nominal.ogg',volume=50)
update_icon()
return 1
else
return 0
@@ -1888,7 +1890,7 @@
src.forceMove(src.loc)
src.verbs += /obj/mecha/verb/eject
src.log_append_to_last("[H] moved in as pilot.")
src.icon_state = src.reset_icon()
update_icon()
//This part removes all the verbs if you don't have them the _possible on your mech. This is a little clunky, but it lets you just add that to any mech.
//And it's not like this 10yo code wasn't clunky before.
@@ -2006,7 +2008,7 @@
occupant.clear_alert("mech damage")
occupant.in_enclosed_vehicle = 0
occupant = null
icon_state = src.reset_icon()+"-open"
update_icon()
set_dir(dir_in)
verbs -= /obj/mecha/verb/eject
@@ -2650,13 +2652,6 @@
return 1
return 0
/obj/mecha/proc/reset_icon()
if (initial_icon)
icon_state = initial_icon
else
icon_state = initial(icon_state)
return icon_state
//This is for mobs mostly.
/obj/mecha/attack_generic(var/mob/user, var/damage, var/attack_message)
+65
View File
@@ -0,0 +1,65 @@
/obj/mecha
// Show the pilot.
var/show_pilot = FALSE
// The state of the 'face', or the thing that overlays on the pilot. If this isn't set, it will probably look really weird.
var/face_state = null
var/icon/face_overlay
var/icon/pilot_image
// How many pixels do we bump the pilot upward?
var/pilot_lift = 0
/obj/mecha/update_transform()
// Now for the regular stuff.
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)
return
/obj/mecha/update_icon()
if(!initial_icon)
initial_icon = initial(icon_state)
if(occupant)
icon_state = initial_icon
else
icon_state = "[initial_icon]-open"
cut_overlays()
if(show_pilot)
if(occupant)
pilot_image = getCompoundIcon(occupant)
if(!istype(occupant, /mob/living/carbon/brain))
var/icon/Cutter
if("[initial_icon]_cutter" in icon_states(icon))
Cutter = new(src.icon, "[initial_icon]_cutter")
if(Cutter)
pilot_image.Blend(Cutter, ICON_MULTIPLY, y = (-1 * pilot_lift))
var/image/Pilot = image(pilot_image)
Pilot.pixel_y = pilot_lift
add_overlay(Pilot)
else
pilot_image = null
if(face_state && !face_overlay)
face_overlay = new(src.icon, icon_state = face_state)
if(face_overlay)
add_overlay(face_overlay)
for(var/obj/item/mecha_parts/mecha_equipment/ME in equipment)
ME.add_equip_overlay(src)
return
+3
View File
@@ -17,6 +17,9 @@
step_energy_drain = 6
var/obj/item/clothing/glasses/hud/health/mech/hud
icon_scale_x = 1.2
icon_scale_y = 1.2
/obj/mecha/medical/odysseus/New()
..()
hud = new /obj/item/clothing/glasses/hud/health/mech(src)
+17
View File
@@ -22,6 +22,9 @@
/obj/item/mecha_parts/component/electrical
)
icon_scale_x = 1.2
icon_scale_y = 1.2
/obj/mecha/working/ripley/Destroy()
for(var/atom/movable/A in src.cargo)
A.loc = loc
@@ -90,6 +93,20 @@
for(var/obj/item/mecha_parts/mecha_tracking/B in src.contents)//Deletes the beacon so it can't be found easily
qdel (B)
/obj/mecha/working/ripley/antique
name = "APLU \"Geiger\""
desc = "You can't beat the classics."
icon_state = "ripley-old"
initial_icon = "ripley-old"
show_pilot = TRUE
pilot_lift = 5
max_utility_equip = 1
max_universal_equip = 3
icon_scale_x = 1
icon_scale_y = 1
//Meant for random spawns.
/obj/mecha/working/ripley/mining/old
+1 -1
View File
@@ -241,7 +241,7 @@
M.initial_icon = new_icon
if(new_icon_file)
M.icon = new_icon_file
M.reset_icon()
M.update_icon()
use(1, user)
/obj/mecha/attackby(var/obj/item/weapon/W, var/mob/user)
@@ -275,6 +275,9 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
if(part.transparent)
icon_key += "_t"
if(istype(tail_style, /datum/sprite_accessory/tail/taur))
icon_key += tail_style.clip_mask_state
icon_key = "[icon_key][husk ? 1 : 0][fat ? 1 : 0][hulk ? 1 : 0][skeleton ? 1 : 0]"
var/icon/base_icon
if(human_icon_cache[icon_key])
@@ -284,10 +287,26 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
var/obj/item/organ/external/chest = get_organ(BP_TORSO)
base_icon = chest.get_icon()
var/icon/Cutter = null
if(istype(tail_style, /datum/sprite_accessory/tail/taur)) // Tail icon 'cookie cutters' are filled in where icons are preserved. We need to invert that.
Cutter = new(icon = tail_style.icon, icon_state = tail_style.clip_mask)
Cutter.Blend("#000000", ICON_MULTIPLY) // Make it all black.
Cutter.SwapColor("#00000000", "#FFFFFFFF") // Everywhere empty, make white.
Cutter.SwapColor("#000000FF", "#00000000") // Everywhere black, make empty.
Cutter.Blend("#000000", ICON_MULTIPLY) // Black again.
for(var/obj/item/organ/external/part in organs)
if(isnull(part) || part.is_stump())
continue
var/icon/temp = part.get_icon(skeleton)
if((part.organ_tag in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT)) && Cutter)
temp.Blend(Cutter, ICON_AND, x = -16)
//That part makes left and right legs drawn topmost and lowermost when human looks WEST or EAST
//And no change in rendering for other parts (they icon_position is 0, so goes to 'else' part)
if(part.icon_position & (LEFT | RIGHT))
Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 220 KiB

+1
View File
@@ -830,6 +830,7 @@
#include "code\game\mecha\mech_sensor.dm"
#include "code\game\mecha\mecha.dm"
#include "code\game\mecha\mecha_actions.dm"
#include "code\game\mecha\mecha_appearance.dm"
#include "code\game\mecha\mecha_construction_paths.dm"
#include "code\game\mecha\mecha_control_console.dm"
#include "code\game\mecha\mecha_helpers.dm"