Merge pull request #2292 from tigercat2000/fancy

-tg- style inventory update, stripping update
This commit is contained in:
Fox McCloud
2015-10-06 18:49:08 -04:00
28 changed files with 822 additions and 1486 deletions
+12 -243
View File
@@ -8,12 +8,12 @@
var/item_state = null
var/lefthand_file = 'icons/mob/inhands/items_lefthand.dmi'
var/righthand_file = 'icons/mob/inhands/items_righthand.dmi'
//Dimensions of the lefthand_file and righthand_file vars
//eg: 32x32 sprite, 64x64 sprite, etc.
var/inhand_x_dimension = 32
var/inhand_y_dimension = 32
var/inhand_y_dimension = 32
var/r_speed = 1.0
var/health = null
var/hitsound = null
@@ -49,6 +49,9 @@
var/list/allowed = null //suit storage stuff.
var/obj/item/device/uplink/hidden/hidden_uplink = null // All items can have an uplink hidden inside, just remember to add the triggers.
var/strip_delay = DEFAULT_ITEM_STRIP_DELAY
var/put_on_delay = DEFAULT_ITEM_PUTON_DELAY
/* Species-specific sprites, concept stolen from Paradise//vg/.
ex:
sprite_sheets = list(
@@ -298,245 +301,11 @@
//the mob M is attempting to equip this item into the slot passed through as 'slot'. Return 1 if it can do this and 0 if it can't.
//If you are making custom procs but would like to retain partial or complete functionality of this one, include a 'return ..()' to where you want this to happen.
//Set disable_warning to 1 if you wish it to not give you outputs.
/obj/item/proc/mob_can_equip(M as mob, slot, disable_warning = 0)
if(!slot) return 0
if(!M) return 0
if(issmall(M))
//START MONKEY
var/mob/living/carbon/human/H = M
switch(slot)
if(slot_l_hand)
if(H.l_hand)
return 0
return 1
if(slot_r_hand)
if(H.r_hand)
return 0
return 1
if(slot_wear_mask)
if(H.wear_mask)
return 0
if( !(slot_flags & SLOT_MASK) )
return 0
return 1
if(slot_back)
if(H.back)
return 0
if( !(slot_flags & SLOT_BACK) )
return 0
return 1
if(slot_handcuffed)
if(H.handcuffed)
return 0
if(!istype(src, /obj/item/weapon/restraints/handcuffs))
return 0
return 1
if(slot_in_backpack)
if (H.back && istype(H.back, /obj/item/weapon/storage/backpack))
var/obj/item/weapon/storage/backpack/B = H.back
if(B.contents.len < B.storage_slots && w_class <= B.max_w_class)
return 1
return 0
return 0 //Unsupported slot
//END MONKEY
if(ishuman(M))
//START HUMAN
var/mob/living/carbon/human/H = M
if(istype(src, /obj/item/clothing/under) || istype(src, /obj/item/clothing/suit))
if(FAT in H.mutations)
//testing("[M] TOO FAT TO WEAR [src]!")
if(!(flags & ONESIZEFITSALL))
if(!disable_warning)
H << "\red You're too fat to wear the [name]."
return 0
switch(slot)
if(slot_l_hand)
if(H.l_hand)
return 0
return 1
if(slot_r_hand)
if(H.r_hand)
return 0
return 1
if(slot_wear_mask)
if(H.wear_mask)
return 0
if( !(slot_flags & SLOT_MASK) )
return 0
return 1
if(slot_back)
if(H.back)
return 0
if( !(slot_flags & SLOT_BACK) )
return 0
return 1
if(slot_wear_suit)
if(H.wear_suit)
return 0
if( !(slot_flags & SLOT_OCLOTHING) )
return 0
return 1
if(slot_gloves)
if(H.gloves)
return 0
if( !(slot_flags & SLOT_GLOVES) )
return 0
return 1
if(slot_shoes)
if(H.shoes)
return 0
if( !(slot_flags & SLOT_FEET) )
return 0
return 1
if(slot_belt)
if(H.belt)
return 0
if(!H.w_uniform)
if(!disable_warning)
H << "\red You need a jumpsuit before you can attach this [name]."
return 0
if( !(slot_flags & SLOT_BELT) )
return
return 1
if(slot_glasses)
if(H.glasses)
return 0
if( !(slot_flags & SLOT_EYES) )
return 0
return 1
if(slot_head)
if(H.head)
return 0
if( !(slot_flags & SLOT_HEAD) )
return 0
return 1
if(slot_l_ear)
if(H.l_ear)
return 0
if( !(slot_flags & SLOT_EARS) )
return 0
if( (slot_flags & SLOT_TWOEARS) && H.r_ear )
return 0
return 1
if(slot_r_ear)
if(H.r_ear)
return 0
if( !(slot_flags & SLOT_EARS) )
return 0
if( (slot_flags & SLOT_TWOEARS) && H.l_ear )
return 0
return 1
if(slot_w_uniform)
if(H.w_uniform)
return 0
if( !(slot_flags & SLOT_ICLOTHING) )
return 0
return 1
if(slot_wear_id)
if(H.wear_id)
return 0
if(!H.w_uniform)
if(!disable_warning)
H << "\red You need a jumpsuit before you can attach this [name]."
return 0
if( !(slot_flags & SLOT_ID) )
return 0
return 1
if(slot_wear_pda)
if(H.wear_pda)
return 0
if(!H.w_uniform)
if(!disable_warning)
H << "\red You need a jumpsuit before you can attach this [name]."
return 0
if( !(slot_flags & SLOT_PDA) )
return 0
return 1
if(slot_l_store)
if(flags & NODROP) //Pockets aren't visible, so you can't move NODROP items into them.
return 0
if(H.l_store)
return 0
if(!H.w_uniform)
if(!disable_warning)
H << "\red You need a jumpsuit before you can attach this [name]."
return 0
if(slot_flags & SLOT_DENYPOCKET)
return
if( w_class <= 2 || (slot_flags & SLOT_POCKET) )
return 1
if(slot_r_store)
if(flags & NODROP)
return 0
if(H.r_store)
return 0
if(!H.w_uniform)
if(!disable_warning)
H << "\red You need a jumpsuit before you can attach this [name]."
return 0
if(slot_flags & SLOT_DENYPOCKET)
return 0
if( w_class <= 2 || (slot_flags & SLOT_POCKET) )
return 1
return 0
if(slot_s_store)
if(flags & NODROP) //Suit storage NODROP items drop if you take a suit off, this is to prevent people exploiting this.
return 0
if(H.s_store)
return 0
if(!H.wear_suit)
if(!disable_warning)
H << "\red You need a suit before you can attach this [name]."
return 0
if(!H.wear_suit.allowed)
if(!disable_warning)
usr << "You somehow have a suit with no defined allowed items for suit storage, stop that."
return 0
if(src.w_class > 4)
if(!disable_warning)
usr << "The [name] is too big to attach."
return 0
if( istype(src, /obj/item/device/pda) || istype(src, /obj/item/weapon/pen) || is_type_in_list(src, H.wear_suit.allowed) )
return 1
return 0
if(slot_handcuffed)
if(H.handcuffed)
return 0
if(!istype(src, /obj/item/weapon/restraints/handcuffs))
return 0
return 1
if(slot_legcuffed)
if(H.legcuffed)
return 0
if(!istype(src, /obj/item/weapon/restraints/legcuffs))
return 0
return 1
if(slot_in_backpack)
if (H.back && istype(H.back, /obj/item/weapon/storage/backpack))
var/obj/item/weapon/storage/backpack/B = H.back
if(B.contents.len < B.storage_slots && w_class <= B.max_w_class)
return 1
return 0
if(slot_tie)
if(!H.w_uniform)
if(!disable_warning)
H << "<span class='warning'>You need a jumpsuit before you can attach this [name].</span>"
return 0
var/obj/item/clothing/under/uniform = H.w_uniform
if(uniform.accessories.len && !uniform.can_attach_accessory(src))
if (!disable_warning)
H << "<span class='warning'>You already have an accessory of this type attached to your [uniform].</span>"
return 0
if( !(slot_flags & SLOT_TIE) )
return 0
return 1
return 0 //Unsupported slot
//END HUMAN
/obj/item/proc/mob_can_equip(mob/M, slot, disable_warning = 0)
if(!M)
return 0
return M.can_equip(src, slot, disable_warning)
/obj/item/verb/verb_pickup()
set src in oview(1)
@@ -713,7 +482,7 @@
/obj/item/proc/pwr_drain()
return 0 // Process Kill
/obj/item/proc/remove_item_from_storage(atom/newLoc) //please use this if you're going to snowflake an item out of a obj/item/weapon/storage
if(!newLoc)
return 0
@@ -722,4 +491,4 @@
S.remove_from_storage(src,newLoc)
return 1
return 0
+4 -1
View File
@@ -229,7 +229,7 @@
if(..())
return 1
if (istype(M, /mob/living/carbon/human))
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/affecting = H.get_organ(user.zone_sel.selecting)
var/limb = affecting.name
@@ -238,6 +238,9 @@
return
if(affecting.status & ORGAN_SPLINTED)
user << "\red [M]'s [limb] is already splinted!"
if(alert(user, "Would you like to remove the splint from [M]'s [limb]?", "Removing.", "Yes", "No") == "Yes")
affecting.status &= ~ORGAN_SPLINTED
user << "<span class='notice'>You remove the splint from [M]'s [limb]."
return
if (M != user)
user.visible_message("\red [user] starts to apply \the [src] to [M]'s [limb].", "\red You start to apply \the [src] to [M]'s [limb].", "\red You hear something being wrapped.")
+33 -84
View File
@@ -96,10 +96,13 @@
if(ishuman(M)) // Would've done this via species instead of type, but the basic mob doesn't have a species, go figure.
var/mob/living/carbon/human/H = M
if(H.species.flags & NO_DNA_RAD)
return
if (!usr.IsAdvancedToolUser())
return
return 0
if (!user.IsAdvancedToolUser())
return 0
if(inuse)
return 0
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been injected with [name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [name] to inject [M.name] ([M.ckey])</font>")
@@ -110,91 +113,37 @@
else
M.LAssailant = user
if (user)
if (istype(M, /mob/living/carbon/human))
if(!inuse)
var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( )
O.source = user
O.target = M
O.item = src
O.s_loc = user.loc
O.t_loc = M.loc
O.place = "dnainjector"
src.inuse = 1
spawn(50) // Not the best fix. There should be an failure proc, for /effect/equip_e/, which is called when the first initital checks fail
inuse = 0
M.requests += O
if (buf.types & DNA2_BUF_SE)
if(block)// Isolated injector
//testing("Isolated block [block] injector with contents: [GetValue()]")
if (GetState() && block == MONKEYBLOCK && istype(M, /mob/living/carbon/human) )
message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name] (MONKEY)")
log_game("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
else
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name]")
else
// testing("DNA injector with contents: [english_list(buf.dna.SE)]")
if (GetState(MONKEYBLOCK) && istype(M, /mob/living/carbon/human) )
message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY)")
log_attack("[key_name(user)] injected [key_name(M)] with the [name] (MONKEY)")
log_game("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY)")
else
// message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]")
log_attack("[key_name(user)] injected [key_name(M)] with the [name]")
else
// message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]")
log_attack("[key_name(user)] injected [key_name(M)] with the [name]")
if(buf.types & DNA2_BUF_SE)
if(block)
if(GetState() && block == MONKEYBLOCK && ishuman(M))
message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name] (MONKEY)")
log_game("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
else
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name]")
spawn( 0 )
O.process()
return
else
if(!inuse)
if(GetState(MONKEYBLOCK) && ishuman(M))
message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name] (MONKEY)")
log_game("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
else
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name]")
for(var/mob/O in viewers(M, null))
O.show_message(text("\red [] has been injected with [] by [].", M, src, user), 1)
//Foreach goto(192)
if (!(istype(M, /mob/living/carbon/human)))
user << "\red Apparently it didn't work."
return
else
log_attack("[key_name(user)] injected [key_name(M)] with the [name]")
if (buf.types & DNA2_BUF_SE)
if(block)// Isolated injector
// testing("Isolated block [block] injector with contents: [english_list(GetValue())]")
if (GetState() && block == MONKEYBLOCK && istype(M, /mob/living/carbon/human) )
message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name] (MONKEY)")
log_game("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)")
else
log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name]")
else
// testing("DNA injector with contents: [english_list(buf.dna.SE)]")
if (GetState(MONKEYBLOCK) && istype(M, /mob/living/carbon/human))
message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY)")
log_game("[key_name(user)] injected [key_name(M)] with the [name] (MONKEY)")
else
// message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]")
log_game("[key_name(user)] injected [key_name(M)] with the [name]")
else
// message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]")
log_game("[key_name(user)] injected [key_name(M)] with the [name]")
inuse = 1
inject(M, user)//Now we actually do the heavy lifting.
spawn(50)
inuse = 0
/*
A user injecting themselves could mean their own transformation and deletion of mob.
I don't have the time to figure out how this code works so this will do for now.
I did rearrange things a bit.
*/
if(user)//If the user still exists. Their mob may not.
if(M)//Runtime fix: If the mob doesn't exist, mob.name doesnt work. - Nodrak
user.show_message(text("\red You inject [M.name]"))
else
user.show_message(text("\red You finish the injection."))
return
user.visible_message("<span class='danger'>\The [user] starts injecting \the [M] with \the [src]!</span>", "<span class='notice'>You start injecting \the [M] with \the [src].</span>")
if(do_after(user, 50, target = M))
inject(M, user)//Now we actually do the heavy lifting
user.visible_message("<span class='danger'>\The [user] injects \the [M] with \the [src]!</span>", "<span class='danger'>You inject \the [M] with \the [src].</span>")
if(user)//If the user still exists. Their mob may not.
if(M)//Runtime fix: If the mob doesn't exist, mob.name doesnt work. - Nodrak
user.show_message("<span class='alert'>You inject [M.name]</span>")
else
user.show_message("<span class='alert'>You finish the injection.</span>")
/obj/item/weapon/dnainjector/hulkmut