Second commits.

This contains the changes to item_attack.dm
Obj/attackby() now follows a similar structure as mob/living/attackby. It calls attack_obj() (like attack() but for obj) which calls attacked_by (just like attack() does)
The use of the NOBLUDGEON flag changes a bit, it is now used to signify the item cannot be used as a melee weapon at all. No attack animation, no attack message. I've given this bitflag to many items that have an afterattack() so as to not both attack and do the special action (among those items: the rcd)

There's also the code changes to attacking machines: attacking any machine now give a proper message and a sound. And with this, I made more machines breakable (using a health var and the very little used BROKEN stat). Most notably, tables can now be attacked when on harm intent and be destroyed.

The newly destroyable machines have a take_damage() proc used by all sorts of attack (weapon, xeno, animal, hulk, mech melee, gun projectile, thrown items).

There's some more stuff in there, see the PR's description and comments.
This commit is contained in:
phil235
2016-04-24 20:37:00 +02:00
parent 0caa59b21a
commit b146131a34
54 changed files with 1480 additions and 1410 deletions
+18 -31
View File
@@ -7,46 +7,31 @@
var/list/authorized = list()
/obj/machinery/computer/emergency_shuttle/attackby(obj/item/weapon/card/W, mob/user, params)
if(stat & (BROKEN|NOPOWER))
return
if(!istype(W, /obj/item/weapon/card))
return
if(SSshuttle.emergency.mode != SHUTTLE_DOCKED)
return
if(!user)
return
if(SSshuttle.emergency.timeLeft() < 11)
return
if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if (istype(W, /obj/item/device/pda))
var/obj/item/device/pda/pda = W
W = pda.id
if (!W:access) //no access
user << "The access level of [W:registered_name]\'s card is not high enough. "
/obj/machinery/computer/emergency_shuttle/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/ID = I
if(stat & (BROKEN|NOPOWER))
return
var/list/cardaccess = W:access
if(!istype(cardaccess, /list) || !cardaccess.len) //no access
user << "The access level of [W:registered_name]\'s card is not high enough. "
if(SSshuttle.emergency.mode != SHUTTLE_DOCKED)
return
if(SSshuttle.emergency.timeLeft() < 11)
return
if(!(access_heads in ID.access)) //doesn't have this access
user << "The access level of [ID.registered_name]\'s card is not high enough. "
return
if(!(access_heads in W:access)) //doesn't have this access
user << "The access level of [W:registered_name]\'s card is not high enough. "
return 0
var/choice = alert(user, text("Would you like to (un)authorize a shortened launch time? [] authorization\s are still needed. Use abort to cancel all authorizations.", src.auth_need - src.authorized.len), "Shuttle Launch", "Authorize", "Repeal", "Abort")
if(SSshuttle.emergency.mode != SHUTTLE_DOCKED || user.get_active_hand() != W)
return 0
if(SSshuttle.emergency.mode != SHUTTLE_DOCKED || user.get_active_hand() != ID)
return
var/seconds = SSshuttle.emergency.timeLeft()
if(seconds <= 10)
return 0
return
switch(choice)
if("Authorize")
if(!authorized.Find(W:registered_name))
authorized += W:registered_name
if(!authorized.Find(ID.registered_name))
authorized += ID.registered_name
if(auth_need - authorized.len > 0)
message_admins("[key_name_admin(user.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[user]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[user]'>FLW</A>) has authorized early shuttle launch ",0,1)
log_game("[key_name(user)] has authorized early shuttle launch in ([x],[y],[z])")
@@ -58,13 +43,15 @@
SSshuttle.emergency.setTimer(100)
if("Repeal")
if(authorized.Remove(W:registered_name))
if(authorized.Remove(ID.registered_name))
minor_announce("[auth_need - authorized.len] authorizations needed until shuttle is launched early")
if("Abort")
if(authorized.len)
minor_announce("All authorizations to launch the shuttle early have been revoked.")
authorized.Cut()
else
return ..()
/obj/machinery/computer/emergency_shuttle/emag_act(mob/user)
if(!emagged && SSshuttle.emergency.mode == SHUTTLE_DOCKED)