Robot_module and cyborg stack refactor (#13527)

* robot_module refactor

* some fixes

1. adds medical stacks of 25 for the syndi medical borg
2. fixes various construction steps that weren't using `use()` or `get_amount()`

* review tweaks + other stuff

1. Makes a bunch of for loops into istypeless loops
2. Adds a readout of the current out of stacks a borg has, in the status panel
3. Slightly reorganizes the medical, syndi medical, engineering and syndi engineering cyborgs items

* fixes after upstream merge

* blank line for travis

* fixes and improvements

1. Fixed welder icon's not updating periodically if you were charging in a borg recharger
2. Fixes solar panels dropping /cyborg type glass when they were deconstructed.
3. Band-aid fix (incase #2 doesn't fix this) for cyborg stack's `source` var being null which resulted in tons of "cannot read null.energy" runtimes

* more fixes + constructable frame runtime fix

* removes toy sword placeholder

remove comment

* remove these as well

* .amount to .get_amount(), really should have done this before

* refactors robot_upgrades to work with the new system

- more cleanup
- adds documentation
- fixed a bug I made where you could delete your robot stack via crafting

* moves some unemag logic to the module file, makes more loops typless

* farie review

* fox review

* affected review and more TM bugfixes

* fixes comment

Co-authored-by: SteelSlayer <SteelSlayer@users.noreply.github.com>
This commit is contained in:
SteelSlayer
2021-05-24 16:24:25 +01:00
committed by GitHub
co-authored by SteelSlayer
parent 663eff7b5e
commit e4bbd94d6a
46 changed files with 1057 additions and 914 deletions
+3 -3
View File
@@ -130,13 +130,13 @@
/datum/component/material_container/proc/insert_stack(obj/item/stack/S, amt, multiplier = 1)
if(isnull(amt))
amt = S.amount
amt = S.get_amount()
if(amt <= 0)
return FALSE
if(amt > S.amount)
amt = S.amount
if(amt > S.get_amount())
amt = S.get_amount()
var/material_amt = get_item_material_amount(S)
if(!material_amt)
@@ -47,7 +47,7 @@
/datum/construction/proc/custom_action(step, used_atom, user)
if(istype(used_atom, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = used_atom
if(C.amount<4)
if(C.get_amount() < 4)
to_chat(user, ("<span class='warning'>There's not enough cable to finish the task.</span>"))
return 0
else
@@ -55,7 +55,7 @@
playsound(holder, C.usesound, 50, 1)
else if(istype(used_atom, /obj/item/stack))
var/obj/item/stack/S = used_atom
if(S.amount < 5)
if(S.get_amount() < 5)
to_chat(user, ("<span class='warning'>There's not enough material in this stack.</span>"))
return 0
else
@@ -113,7 +113,7 @@
// STACKS
if(istype(used_atom,/obj/item/stack))
var/obj/item/stack/stack=used_atom
if(stack.amount < amount)
if(stack.get_amount() < amount)
to_chat(user, "<span class='warning'>You don't have enough [stack]! You need at least [amount].</span>")
return 0
stack.use(amount)
+12 -38
View File
@@ -1375,46 +1375,20 @@
switch(href_list["silicon"])
if("unemag")
var/mob/living/silicon/robot/R = current
if(istype(R))
R.emagged = 0
if(R.module)
if(R.activated(R.module.emag))
R.module_active = null
if(R.module_state_1 == R.module.emag)
R.module_state_1 = null
R.contents -= R.module.emag
else if(R.module_state_2 == R.module.emag)
R.module_state_2 = null
R.contents -= R.module.emag
else if(R.module_state_3 == R.module.emag)
R.module_state_3 = null
R.contents -= R.module.emag
R.clear_supplied_laws()
R.laws = new /datum/ai_laws/crewsimov
log_admin("[key_name(usr)] has un-emagged [key_name(current)]")
message_admins("[key_name_admin(usr)] has un-emagged [key_name_admin(current)]")
if(!istype(R))
return
R.unemag()
log_admin("[key_name(usr)] has un-emagged [key_name(current)]")
message_admins("[key_name_admin(usr)] has un-emagged [key_name_admin(current)]")
if("unemagcyborgs")
if(isAI(current))
var/mob/living/silicon/ai/ai = current
for(var/mob/living/silicon/robot/R in ai.connected_robots)
R.emagged = 0
if(R.module)
if(R.activated(R.module.emag))
R.module_active = null
if(R.module_state_1 == R.module.emag)
R.module_state_1 = null
R.contents -= R.module.emag
else if(R.module_state_2 == R.module.emag)
R.module_state_2 = null
R.contents -= R.module.emag
else if(R.module_state_3 == R.module.emag)
R.module_state_3 = null
R.contents -= R.module.emag
R.clear_supplied_laws()
R.laws = new /datum/ai_laws/crewsimov
log_admin("[key_name(usr)] has unemagged [key_name(ai)]'s cyborgs")
message_admins("[key_name_admin(usr)] has unemagged [key_name_admin(ai)]'s cyborgs")
if(!isAI(current))
return
var/mob/living/silicon/ai/ai = current
for(var/mob/living/silicon/robot/R in ai.connected_robots)
R.unemag()
log_admin("[key_name(usr)] has unemagged [key_name(ai)]'s cyborgs")
message_admins("[key_name_admin(usr)] has unemagged [key_name_admin(ai)]'s cyborgs")
else if(href_list["common"])
switch(href_list["common"])