Skip to content

Commit

Permalink
Updates button sprite. (#558)
Browse files Browse the repository at this point in the history
* button sprite update

* buttons

* north sprite update
  • Loading branch information
Helg2 authored Oct 18, 2024
1 parent e8b73ac commit 0dbfe99
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 144 deletions.
9 changes: 5 additions & 4 deletions _maps/map_files/Talos/TGS_Talos.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -14071,8 +14071,7 @@
"iDP" = (
/obj/machinery/door_control/mainship/cic{
id = "bot_armory";
name = "Armory Lockdown";
pixel_x = -5
name = "Armory Lockdown"
},
/turf/open/floor/mainship/metal/full,
/area/mainship/command/cic)
Expand Down Expand Up @@ -28366,14 +28365,16 @@
},
/obj/machinery/door_control/mainship/cic{
dir = 1;
pixel_x = 5
pixel_x = 5;
pixel_y = -16
},
/obj/effect/turf_decal/siding/metal,
/obj/machinery/door_control{
id = "Brig Lockdown";
name = "Brig Lockdown";
dir = 1;
pixel_x = -6
pixel_x = -6;
pixel_y = -16
},
/turf/open/floor/mainship/metal,
/area/mainship/command/cic)
Expand Down
89 changes: 59 additions & 30 deletions code/game/objects/machinery/buttons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,59 @@
name = "button"
desc = "A remote control switch."
icon = 'icons/obj/machines/buttons.dmi'
icon_state = "doorctrl"
icon_state = "door"
power_channel = ENVIRON
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 5
soft_armor = list(MELEE = 50, BULLET = 50, LASER = 50, ENERGY = 50, BOMB = 10, BIO = 100, FIRE = 90, ACID = 70)
light_range = 1
light_power = 0.3
var/id = null
var/next_activate = 0

/obj/machinery/button/indestructible
resistance_flags = RESIST_ALL

/obj/machinery/button/Initialize(mapload, ndir = 0)
/obj/machinery/button/Initialize(mapload)
. = ..()
setDir(ndir)
pixel_x = ( (dir & 3) ? 0 : (dir == 4 ? -24 : 24) )
pixel_y = ( (dir & 3) ? (dir == 1 ? -24 : 24) : 0 )
update_icon()
set_offsets()

///Proc that sets pixel offsets on Initialize if the button doesn't have it map-edited
/obj/machinery/button/proc/set_offsets()
if(pixel_x || pixel_y)
return

switch(dir)
if(NORTH)
pixel_y = -32
if(SOUTH)
pixel_y = 32
if(EAST)
pixel_x = -32
if(WEST)
pixel_x = 32

/obj/machinery/button/update_icon()
. = ..()
if(machine_stat & (NOPOWER|BROKEN))
set_light(0)
else
set_light(initial(light_range))

/obj/machinery/button/update_icon_state()
. = ..()
if(machine_stat & (NOPOWER|BROKEN))
icon_state = "[initial(icon_state)]-p"
icon_state = "[initial(icon_state)]_off"
else
icon_state = initial(icon_state)

/obj/machinery/button/update_overlays()
. = ..()
if(machine_stat & (NOPOWER|BROKEN))
return
. += emissive_appearance(icon, "[icon_state]_emissive")

/obj/machinery/button/attack_ai(mob/user)
return attack_hand(user)

Expand All @@ -43,11 +70,11 @@

if(!allowed(user))
to_chat(user, span_danger("Access Denied"))
flick("[initial(icon_state)]-denied", src)
flick("[initial(icon_state)]_denied", src)
return

use_power(active_power_usage)
icon_state = "[initial(icon_state)]1"
icon_state = "[initial(icon_state)]_on"

pulsed()

Expand Down Expand Up @@ -108,7 +135,9 @@
/obj/machinery/button/door/open_only/landing_zone
name = "lockdown override"
id = "landing_zone"
icon_state = "shutterctrl"
icon_state = "shutter"
light_range = 0
light_power = 0
use_power = NO_POWER_USE
resistance_flags = RESIST_ALL
req_one_access = list(ACCESS_MARINE_DROPSHIP)
Expand All @@ -130,10 +159,10 @@
#endif
if(!allowed(user))
to_chat(user, span_danger("Access Denied"))
flick("[initial(icon_state)]-denied", src)
flick("[initial(icon_state)]_denied", src)
return
if(alarm_played)
flick("[initial(icon_state)]-denied", src)
flick("[initial(icon_state)]_denied", src)
return
use_power(active_power_usage)
icon_state = "[initial(icon_state)]1"
Expand All @@ -152,8 +181,8 @@

/obj/machinery/driver_button
name = "mass driver button"
icon = 'icons/obj/objects.dmi'
icon_state = "launcherbtt"
icon = 'icons/obj/machines/buttons.dmi'
icon_state = "launcher"
desc = "A remote control switch for a mass driver."
anchored = TRUE
use_power = IDLE_POWER_USE
Expand Down Expand Up @@ -185,7 +214,7 @@
use_power(active_power_usage)

active = TRUE
icon_state = "launcheract"
icon_state = "launcher_on"

for(var/obj/machinery/door/poddoor/M in GLOB.machines)
if(M.id == id)
Expand All @@ -197,32 +226,32 @@
if(M.id == id)
M.close()

icon_state = "launcherbtt"
icon_state = "launcher"
active = 0

/obj/machinery/ignition_switch
name = "ignition switch"
icon = 'icons/obj/objects.dmi'
icon_state = "launcherbtt"
icon = 'icons/obj/machines/buttons.dmi'
icon_state = "launcher"
desc = "A remote control switch for a mounted igniter."
var/id = null
var/active = 0
anchored = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 4
var/id = null
var/active = 0

/obj/machinery/flasher_button
name = "flasher button"
desc = "A remote control switch for a mounted flasher."
icon = 'icons/obj/objects.dmi'
icon_state = "launcherbtt"
var/id = null
var/active = 0
icon = 'icons/obj/machines/buttons.dmi'
icon_state = "launcher"
anchored = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 4
var/id = null
var/active = 0

/obj/machinery/crema_switch
desc = "Burn baby burn!"
Expand All @@ -238,14 +267,14 @@

/obj/machinery/medical_help_button
name = "Medical attention required"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "doorctrl0"
icon = 'icons/obj/machines/buttons.dmi'
icon_state = "button"
desc = "A button for alerting doctors that you require assistance."
var/active = FALSE
anchored = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 4
var/active = FALSE
var/obj/item/radio/radio

/obj/machinery/medical_help_button/Initialize(mapload)
Expand All @@ -268,7 +297,7 @@
if(active)
return
use_power(active_power_usage)
icon_state = "doorctrl1"
icon_state = "button"

radio.talk_into(src, "<b>[user.name] is requesting medical attention at: [get_area(src)].</b>", RADIO_CHANNEL_MEDICAL)
visible_message("Remain calm, someone will be with you shortly.")
Expand All @@ -283,9 +312,9 @@
/obj/machinery/medical_help_button/update_icon_state()
. = ..()
if(machine_stat & NOPOWER)
icon_state = "doorctrl-p"
icon_state = "door_off"
else
icon_state = "doorctrl0"
icon_state = "door"

/obj/machinery/button/valhalla
resistance_flags = INDESTRUCTIBLE
Expand Down
Loading

0 comments on commit 0dbfe99

Please sign in to comment.