Files
Bubberstation/code/datums/wires/explosive.dm
SkyratBot 23cda1571f [MIRROR] No roundstart playable MULEs / Trampling requires hacking [MDB IGNORE] (#22585)
* No roundstart playable MULEs / Trampling requires hacking (#76837)

## About The Pull Request

Prevailing feedback has been:
- The player base cannot be trusted to control MULEbots.
- It should be clearer what bots can and can't do.

The former is easy to fix.
The latter is sort of a matter for policy but I'm going to investigate
giving bots a rudimentary laws system. Plus that sounds much more
controversial than this so I am going to atomise this outside of that
PR.

MULEbots can still be set to allow sentience by cargo technicians, but
don't start that way.

ADDITIONALLY this PR just changes it so that MULEbots do not crush
people unless:
- They have been emagged.
- Their safety wire has been cut.
Either means works, so it's not too hard to access for nefarious
purposes, but hard to do to yourself.
Otherwise they just slow down for a few seconds instead.

Also fixed an unrelated name bug while I was there.

Closes #76926

## Why It's Good For The Game

Players would take them, not deliver any cargo, and repeatedly ask
people to lie down in front of them.
Plus Tram has 5 of the things which is frankly too many to be wandering
around the bar.

## Changelog

🆑
balance: You can't possess a MULE as soon as the round starts, someone
will have to give you permission.
balance: MULEbots no longer crush prone characters unless they have been
hacked (or emagged).
fix: Bots can put numbers in their names, what with being robots.
admin: Adds attack logging when certain wires are cut (for instance:
MULEbot safeties)
/🆑

* No roundstart playable MULEs / Trampling requires hacking

* add missing arg

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: Pinta <68373373+softcerv@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
2023-07-21 02:02:40 -04:00

155 lines
4.5 KiB
Plaintext

/datum/wires/explosive
var/duds_number = 2 // All "dud" wires cause an explosion when cut or pulsed
proper_name = "Explosive Device"
randomize = TRUE // Prevents wires from showing up on blueprints
/datum/wires/explosive/New(atom/holder)
add_duds(duds_number) // Duds also explode here.
..()
/datum/wires/explosive/on_pulse(index)
explode()
/datum/wires/explosive/on_cut(index, mend, source)
if (!isnull(source))
log_combat(source, holder, "cut the detonation wire for")
explode()
/datum/wires/explosive/proc/explode()
return
/datum/wires/explosive/chem_grenade
duds_number = 1
holder_type = /obj/item/grenade/chem_grenade
var/fingerprint
/datum/wires/explosive/chem_grenade/interactable(mob/user)
if(!..())
return FALSE
var/obj/item/grenade/chem_grenade/G = holder
if(G.stage == GRENADE_WIRED)
return TRUE
/datum/wires/explosive/chem_grenade/on_pulse(index)
var/obj/item/grenade/chem_grenade/grenade = holder
if(grenade.stage != GRENADE_READY)
return
. = ..()
/datum/wires/explosive/chem_grenade/on_cut(index, mend, source)
var/obj/item/grenade/chem_grenade/grenade = holder
if(grenade.stage != GRENADE_READY)
return
. = ..()
/datum/wires/explosive/chem_grenade/attach_assembly(color, obj/item/assembly/S)
if(istype(S,/obj/item/assembly/timer))
var/obj/item/grenade/chem_grenade/G = holder
var/obj/item/assembly/timer/T = S
G.det_time = T.saved_time*10
else if(istype(S,/obj/item/assembly/prox_sensor))
var/obj/item/assembly/prox_sensor/sensor = S
var/obj/item/grenade/chem_grenade/grenade = holder
grenade.landminemode = sensor
sensor.proximity_monitor.set_ignore_if_not_on_turf(FALSE)
else if(istype(S,/obj/item/assembly/health))
var/obj/item/assembly/health/sensor = S
if(!sensor.secured)
sensor.toggle_secure()
if(!sensor.scanning)
sensor.toggle_scan()
fingerprint = S.fingerprintslast
return ..()
/datum/wires/explosive/chem_grenade/explode()
var/obj/item/grenade/chem_grenade/grenade = holder
var/obj/item/assembly/pulser = get_attached(get_wire(1))
var/message = "\An [pulser] has pulsed [grenade] ([grenade.type]), which was installed by [fingerprint]"
if(istype(pulser, /obj/item/assembly/voice))
var/obj/item/assembly/voice/spoken_trigger = pulser
message += " with the following activation message: \"[spoken_trigger.recorded]\""
if(!grenade.dud_flags)
message_admins(message)
log_game(message)
var/mob/M = get_mob_by_ckey(fingerprint)
grenade.log_grenade(M) //Used in arm_grenade() too but this one conveys where the mob who triggered the bomb is
if(grenade.landminemode)
grenade.detonate() ///already armed
else
grenade.arm_grenade() //The one here conveys where the bomb was when it went boom
/datum/wires/explosive/chem_grenade/detach_assembly(color)
var/obj/item/assembly/S = get_attached(color)
if(S && istype(S))
assemblies -= color
S.connected = null
S.holder = null
S.forceMove(holder.drop_location())
var/obj/item/grenade/chem_grenade/G = holder
G.landminemode = null
return S
/datum/wires/explosive/c4 // Also includes X4
holder_type = /obj/item/grenade/c4
/datum/wires/explosive/c4/explode()
var/obj/item/grenade/c4/P = holder
P.detonate()
/datum/wires/explosive/pizza
holder_type = /obj/item/pizzabox
/datum/wires/explosive/pizza/New(atom/holder)
wires = list(
WIRE_DISARM
)
add_duds(3) // Duds also explode here.
..()
/datum/wires/explosive/pizza/interactable(mob/user)
if(!..())
return FALSE
var/obj/item/pizzabox/P = holder
if(P.open && P.bomb)
return TRUE
/datum/wires/explosive/pizza/get_status()
var/obj/item/pizzabox/P = holder
var/list/status = list()
status += "The red light is [P.bomb_active ? "on" : "off"]."
status += "The green light is [P.bomb_defused ? "on": "off"]."
return status
/datum/wires/explosive/pizza/on_pulse(wire)
var/obj/item/pizzabox/P = holder
switch(wire)
if(WIRE_DISARM) // Pulse to toggle
P.bomb_defused = !P.bomb_defused
else // Boom
explode()
/datum/wires/explosive/pizza/on_cut(wire, mend, source)
var/obj/item/pizzabox/P = holder
switch(wire)
if(WIRE_DISARM) // Disarm and untrap the box.
if(!mend)
P.bomb_defused = TRUE
else
if(!mend && !P.bomb_defused)
if (!isnull(source))
log_combat(source, holder, "cut the detonation wire for")
explode()
/datum/wires/explosive/pizza/explode()
var/obj/item/pizzabox/P = holder
P.bomb.detonate()
/datum/wires/explosive/gibtonite
holder_type = /obj/item/gibtonite
/datum/wires/explosive/gibtonite/explode()
var/obj/item/gibtonite/P = holder
P.GibtoniteReaction(null, 2)