AME Polishing and QoL (#30036)

* AME Polish

* was it really that simple?

* more polish

* inhand and gauge

* better

* ptptpptptbnrpnrppnrpp
This commit is contained in:
DeityLink
2021-07-23 23:53:22 +02:00
committed by GitHub
parent a39595d3d9
commit 9fc04cca2d
11 changed files with 73 additions and 37 deletions

View File

@@ -1,8 +1,10 @@
/obj/item/weapon/am_containment
name = "antimatter containment jar"
desc = "Holds antimatter. A few of these could blow an entire 21st-century lunar installation."
icon = 'icons/obj/machines/antimatter.dmi'
icon = 'icons/obj/machines/new_ame.dmi'
icon_state = "jar"
item_state = "am_jar"
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/misc_tools.dmi', "right_hand" = 'icons/mob/in-hand/right/misc_tools.dmi')
density = 0
anchored = 0
force = 8
@@ -14,6 +16,20 @@
var/fuel_max = 1000//Lets try this for now
var/stability = 100//TODO: add all the stability things to this so its not very safe if you keep hitting in on things
var/exploded = 0
var/gauge_offset = 0
/obj/item/weapon/am_containment/New()
..()
update_icon()
/obj/item/weapon/am_containment/update_icon()
overlays.len = 0
var/fullness = round((fuel/fuel_max) * 8)
var/image/I = image(icon, src, "gauge_[fullness]")
I.pixel_x = gauge_offset
overlays += I
/obj/item/weapon/am_containment/proc/boom()
var/percent = 0
@@ -42,14 +58,17 @@
if(fuel < wanted)
wanted = fuel
fuel -= wanted
update_icon()
return wanted
/obj/item/weapon/am_containment/big
icon_state = "jar_big"
fuel = 10000
fuel_max = 10000
gauge_offset = 2
/obj/item/weapon/am_containment/huge
icon_state = "jar_big"
icon_state = "jar_huge"
fuel = 30000
fuel_max = 30000
gauge_offset = 6

View File

@@ -1,7 +1,6 @@
/obj/machinery/power/am_control_unit
name = "antimatter control unit"
desc = "This device injects antimatter into connected shielding units. Wrench the device to set it up."
//icon = 'icons/obj/machines/antimatter.dmi'
icon = 'icons/obj/machines/new_ame.dmi'
icon_state = "control"
var/icon_mod = "on" // on, critical, or fuck
@@ -84,7 +83,7 @@
/obj/machinery/power/am_control_unit/proc/produce_power()
playsound(src, 'sound/effects/bang.ogg', 25, 1)
playsound(src, 'sound/effects/explosionsmallfar.ogg', 25, 1)
var/core_power = reported_core_efficiency//Effectively how much fuel we can safely deal with
if(core_power <= 0)
return 0//Something is wrong
@@ -115,6 +114,8 @@
var/obj/item/weapon/am_containment/AMC = AM
var/mob/last_touched = AMC.fingerprintslast
fueljar = AMC
overlays += "control-[AMC.icon_state]"
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
AMC.forceMove(src)
message_admins("AME loaded with fuel by [last_touched ? "[last_touched.real_name] ([last_touched.key])" : "a conveyor"] at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
visible_message("The conveyor loads an [AMC.name] into the [src.name].")
@@ -208,6 +209,8 @@
to_chat(user, "<span class='warning'>There is already a [fueljar] inside!</span>")
return
fueljar = W
overlays += "control-[W.icon_state]"
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(user.client)
user.client.screen -= W
user.u_equip(W,1)
@@ -264,11 +267,13 @@
/obj/machinery/power/am_control_unit/proc/toggle_power()
active = !active
if(active)
playsound(src, 'sound/effects/fall.ogg', 50, 1)
use_power = 2
visible_message("The [src.name] starts up.")
visible_message("[bicon(src)] The [src.name] starts up.")
else
playsound(src, 'sound/effects/fall2.ogg', 50, 1)
use_power = 1
visible_message("The [src.name] shuts down.")
visible_message("[bicon(src)] The [src.name] shuts down.")
for(var/obj/machinery/am_shielding/AMS in linked_cores)
AMS.update_icon()
update_icon()
@@ -358,7 +363,7 @@
"siliconUser" = istype(user, /mob/living/silicon),
)
ui = nanomanager.get_open_ui(user, src, ui_key, ui, data, force_open)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new one
ui = new(user, src, ui_key, "ame.tmpl", "Antimatter Control Unit", 500, data["siliconUser"] ? 465 : 390)
@@ -390,33 +395,31 @@
if(href_list["togglestatus"])
toggle_power()
message_admins("AME toggled [active?"on":"off"] by [usr.real_name] ([usr.key]) at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
return 1
if(href_list["refreshicons"])
update_shield_icons = 2 // Fuck it
return 1
if(href_list["ejectjar"])
if(fueljar)
message_admins("AME fuel jar ejected by [usr.real_name] ([usr.key]) at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
fueljar.forceMove(src.loc)
fueljar = null
overlays.len = 0
playsound(src, 'sound/machines/click.ogg', 50, 1)
//fueljar.control_unit = null currently it does not care where it is
//update_icon() when we have the icon for it
return 1
if(href_list["set_strength"])
var/newval = input("Enter new injection strength") as num|null
if(isnull(newval))
updateDialog()
return
fuel_injection=newval
fuel_injection=max(1,fuel_injection)
message_admins("AME injection strength set to [fuel_injection] by [usr.real_name] ([usr.key]) at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
return 1
if(href_list["refreshstability"])
check_core_stability()
return 1
updateDialog()
return 1

View File

@@ -12,9 +12,8 @@ proc/cardinalrange(var/center)
name = "antimatter reactor section"
desc = "This device was built using a plasma life-form that increases plasma's natural ability to react with neutrinos while reducing the combustibility."
//icon = 'icons/obj/machines/antimatter.dmi'
icon = 'icons/obj/machines/new_ame.dmi'
icon_state = "shield"
icon_state = "part"
anchored = 1
density = 1
dir = 1
@@ -23,6 +22,8 @@ proc/cardinalrange(var/center)
active_power_usage = 0
mech_flags = MECH_SCAN_FAIL
light_color = "#00FFFF"
var/obj/machinery/power/am_control_unit/control_unit = null
var/processing = 0//To track if we are in the update list or not, we need to be when we are damaged and if we ever
var/stability = 100//If this gets low bad things tend to happen
@@ -46,6 +47,19 @@ proc/cardinalrange(var/center)
link_control(AMC)
machines -= src
power_machines += src
update_icon()
playsound(src, 'sound/effects/sparks4.ogg', 30, 0, 0)
anim(target = loc, a_icon = icon, flick_anim = "deploy", lay = ABOVE_LIGHTING_LAYER, plane = ABOVE_LIGHTING_PLANE)
spawn(3) // delay for nicer animation
for (var/direction in alldirs)
var/turf/T = get_step(loc, direction)
for (var/obj/machinery/am_shielding/AMS in T)
var/old_state = AMS.icon_state
AMS.update_icon()
if (old_state != AMS.icon_state)
playsound(T, 'sound/effects/sparks1.ogg', 25, 0, 0)
anim(target = T, a_icon = icon, flick_anim = "change", lay = ABOVE_LIGHTING_LAYER, plane = ABOVE_LIGHTING_PLANE)
sleep(1)
/obj/machinery/am_shielding/proc/link_control(var/obj/machinery/power/am_control_unit/AMC)
if(!istype(AMC))
@@ -158,36 +172,35 @@ proc/cardinalrange(var/center)
/obj/machinery/am_shielding/update_icon()
overlays.len = 0
coredirs = 0
dirs = 0
if(core_check())
icon_state = "core[control_unit && control_unit.active]"
if (control_unit && control_unit.active)
var/image/I = image(icon = icon, icon_state = "core_overlay")
I.plane = ABOVE_LIGHTING_PLANE
I.layer = ABOVE_LIGHTING_LAYER
overlays += I
set_light(1.4,1)
else
set_light(0)
if(!processing)
setup_core()
return
else if(processing)
set_light(0)
shutdown_core()
for(var/direction in alldirs)
var/turf/T = get_step(loc, direction)
for(var/obj/machinery/machine in T)
// Detect cores
if((istype(machine, /obj/machinery/am_shielding) && machine:control_unit == control_unit && machine:processing))
coredirs |= direction
// Detect cores, shielding, and control boxen.
if(direction in cardinal)
if((istype(machine, /obj/machinery/am_shielding) && machine:control_unit == control_unit) || (istype(machine, /obj/machinery/power/am_control_unit) && machine == control_unit))
dirs |= direction
// If we're next to a core, set the prefix.
var/prefix = ""
var/icondirs=dirs
icon_state = "shield_[dirs]"
if(coredirs)
prefix="core"
// Set our overlay
icon_state = "[prefix]shield_[icondirs]"
if(core_check())
overlays += image(icon = icon, icon_state = "core[control_unit && control_unit.active]")
if(!processing)
setup_core()
else if(processing)
shutdown_core()
/obj/machinery/am_shielding/attackby(obj/item/W, mob/user)
@@ -251,15 +264,15 @@ proc/cardinalrange(var/center)
/obj/item/device/am_shielding_container
name = "packaged antimatter reactor section"
desc = "A small storage unit containing an antimatter reactor section. To use place near an antimatter control unit or deployed antimatter reactor section and use a multitool to activate this package."
icon = 'icons/obj/machines/antimatter.dmi'
icon_state = "box"
icon = 'icons/obj/machines/new_ame.dmi'
icon_state = "part"
item_state = "electronic"
w_class = W_CLASS_LARGE
flags = FPRINT
siemens_coefficient = 1
throwforce = 5
throw_speed = 1
throw_range = 2
throw_range = 5
starting_materials = list(MAT_IRON = CC_PER_SHEET_METAL*2)
w_type = RECYK_METAL