Files
CHOMPstation/code/game/objects/items/devices/megaphone.dm
T
Neerti 828dacf485 Centralizes weight class definitions
A lot of new defines are now in inventory_sizes.dm, which contains;
All the size identifiers (the thing that tells the game if something is bulky, or w/e).
Storage costs for all the sizes, which are exponents of two, as previously.
A few constants for inventory size.

Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it.  This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files.  In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke.

The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
2016-09-22 00:51:51 -04:00

55 lines
1.7 KiB
Plaintext

/obj/item/device/megaphone
name = "megaphone"
desc = "A device used to project your voice. Loudly."
icon_state = "megaphone"
item_state = "radio"
w_class = ITEMSIZE_SMALL
flags = CONDUCT
var/spamcheck = 0
var/emagged = 0
var/insults = 0
var/list/insultmsg = list("FUCK EVERYONE!", "I'M A TATER!", "ALL SECURITY TO SHOOT ME ON SIGHT!", "I HAVE A BOMB!", "CAPTAIN IS A COMDOM!", "FOR THE SYNDICATE!")
/obj/item/device/megaphone/attack_self(mob/living/user as mob)
if (user.client)
if(user.client.prefs.muted & MUTE_IC)
src << "<span class='warning'>You cannot speak in IC (muted).</span>"
return
if(!ishuman(user))
user << "<span class='warning'>You don't know how to use this!</span>"
return
if(user.silent)
return
if(spamcheck)
user << "<span class='warning'>\The [src] needs to recharge!</span>"
return
var/message = sanitize(input(user, "Shout a message?", "Megaphone", null) as text)
if(!message)
return
message = capitalize(message)
if ((src.loc == user && usr.stat == 0))
if(emagged)
if(insults)
for(var/mob/O in (viewers(user)))
O.show_message("<B>[user]</B> broadcasts, <FONT size=3>\"[pick(insultmsg)]\"</FONT>",2) // 2 stands for hearable message
insults--
else
user << "<span class='warning'>*BZZZZzzzzzt*</span>"
else
for(var/mob/O in (viewers(user)))
O.show_message("<B>[user]</B> broadcasts, <FONT size=3>\"[message]\"</FONT>",2) // 2 stands for hearable message
spamcheck = 1
spawn(20)
spamcheck = 0
return
/obj/item/device/megaphone/emag_act(var/remaining_charges, var/mob/user)
if(!emagged)
user << "<span class='warning'>You overload \the [src]'s voice synthesizer.</span>"
emagged = 1
insults = rand(1, 3)//to prevent dickflooding
return 1