Merge branch 'evilew:master' into feature/bluespace_collar
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
|
||||
//Lists to keep track of:
|
||||
// - Mobs with a sprite size over 100%
|
||||
// - Mobs with the toggle activated
|
||||
// Done to reduce the amount of mobs that need to be taken into account when the toggle is switched and for updating the seen sprite
|
||||
GLOBAL_LIST_EMPTY(enabled_smallsprite)
|
||||
GLOBAL_LIST_EMPTY(see_toggle_smallsprite)
|
||||
|
||||
/mob/
|
||||
///var to know if one has the toggle activated or not
|
||||
var/see_resized_others = FALSE
|
||||
|
||||
/datum/atom_hud/alternate_appearance/basic/showSmall
|
||||
|
||||
//Verb for the associated toggle.
|
||||
//When switched on, add the current mob to the list of mobs that need to see smallsprites and apply the ones already present immediately to the mob's hud.
|
||||
//When switched off, remove from the list and remove smallsprites for the user's hud.
|
||||
/client/verb/toggle_others_giant()
|
||||
set name = "Toggle Others' Giant Sprite"
|
||||
set category = "Preferences.GS13"
|
||||
set desc = "Change display settings to and from displaying others' giant sprites."
|
||||
var/list/remove_from_list = new()
|
||||
|
||||
mob.see_resized_others = !mob.see_resized_others
|
||||
|
||||
if(mob.see_resized_others)
|
||||
GLOB.see_toggle_smallsprite += mob
|
||||
for(var/mob/living/resize_mob in GLOB.enabled_smallsprite)
|
||||
if(QDELETED(resize_mob))
|
||||
remove_from_list += resize_mob
|
||||
continue
|
||||
|
||||
if(resize_mob && resize_mob != mob && resize_mob.alternate_appearances && resize_mob.alternate_appearances["gscode_smallsprite"])
|
||||
var/datum/atom_hud/alternate_appearance/appearance = resize_mob.alternate_appearances["gscode_smallsprite"]
|
||||
appearance.add_to_single_hud(mob, resize_mob)
|
||||
|
||||
GLOB.enabled_smallsprite -= remove_from_list
|
||||
to_chat(src, "Resize others view toggled ON.")
|
||||
return
|
||||
|
||||
GLOB.see_toggle_smallsprite -= mob
|
||||
for(var/mob/living/resize_mob in GLOB.enabled_smallsprite)
|
||||
if(QDELETED(resize_mob))
|
||||
remove_from_list += resize_mob
|
||||
continue
|
||||
|
||||
if(resize_mob && resize_mob.alternate_appearances && resize_mob.alternate_appearances["gscode_smallsprite"])
|
||||
var/datum/atom_hud/alternate_appearance/appearance = resize_mob.alternate_appearances["gscode_smallsprite"]
|
||||
appearance.remove_from_single_hud(mob, resize_mob)
|
||||
|
||||
GLOB.enabled_smallsprite -= remove_from_list
|
||||
to_chat(src, "Resize others view toggled OFF.")
|
||||
|
||||
///Generate the image based on the mob's current icon and apply matrix transformations to adjust its position and angle
|
||||
/mob/living/proc/create_smallsprite()
|
||||
var/image/smallsprite = image(icon=icon, icon_state=icon_state, loc=src, layer=layer, pixel_x=pixel_x, pixel_y=pixel_y)
|
||||
smallsprite.overlays += overlays
|
||||
smallsprite.override = TRUE
|
||||
|
||||
var/matrix/ntransform = matrix(lying, MATRIX_ROTATE)
|
||||
if(lying != 0)
|
||||
ntransform.Translate(0, -get_standard_pixel_y_offset(lying))
|
||||
|
||||
smallsprite.transform = ntransform
|
||||
return smallsprite
|
||||
|
||||
/**
|
||||
* Call to regenerate the sprites and update huds.
|
||||
* * If present, remove the old sprite from the huds and from the mob
|
||||
* * If the size_multiplier is still higher than 1, check if the mob is in the list of smallsprite mobs and add it if not
|
||||
* * add a new sprite by generating it, then go through the list of mobs with smallsprites toggled on and it to their hud
|
||||
* * If the size_multiplier was not higher than one then remove the mob from the list of smallsprite mobs
|
||||
*/
|
||||
/mob/living/proc/regenerate_smallsprite()
|
||||
var/list/remove_from_list = new()
|
||||
|
||||
if(length(alternate_appearances) && alternate_appearances["gscode_smallsprite"])
|
||||
for(var/mob/viewer_mob in GLOB.see_toggle_smallsprite)
|
||||
if(QDELETED(viewer_mob))
|
||||
remove_from_list += viewer_mob
|
||||
continue
|
||||
|
||||
var/datum/atom_hud/alternate_appearance/appearance = alternate_appearances["gscode_smallsprite"]
|
||||
appearance.remove_from_single_hud(viewer_mob, src)
|
||||
remove_alt_appearance("gscode_smallsprite")
|
||||
|
||||
if(size_multiplier > 1)
|
||||
if(!GLOB.enabled_smallsprite[src])
|
||||
GLOB.enabled_smallsprite += src
|
||||
|
||||
add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", create_smallsprite(), FALSE)
|
||||
for(var/mob/viewer_mob in GLOB.see_toggle_smallsprite)
|
||||
if(QDELETED(viewer_mob))
|
||||
remove_from_list += viewer_mob
|
||||
continue
|
||||
|
||||
if(viewer_mob != src)
|
||||
var/datum/atom_hud/alternate_appearance/appearance = alternate_appearances["gscode_smallsprite"]
|
||||
appearance.add_to_single_hud(viewer_mob, src)
|
||||
return TRUE
|
||||
|
||||
else
|
||||
if(GLOB.enabled_smallsprite[src])
|
||||
GLOB.enabled_smallsprite -= src
|
||||
|
||||
GLOB.see_toggle_smallsprite -= remove_from_list
|
||||
|
||||
return FALSE
|
||||
|
||||
//Called periodically to regenerate the mob's smallsprite
|
||||
/mob/living/carbon/human/BiologicalLife(delta_time, times_fired)
|
||||
. = ..()
|
||||
regenerate_smallsprite()
|
||||
@@ -5,8 +5,10 @@
|
||||
desc = "This implant was meant to prevent people from going hungry, but due to a flaw in its designs, it permanently produces a small amount of nutriment overtime."
|
||||
icon_state = "chest_implant"
|
||||
implant_color = "#006607"
|
||||
nutrition_amount = 20 //Dunno if this is still needed. Will test.
|
||||
hunger_threshold = NUTRITION_LEVEL_FULL
|
||||
poison_amount = 10
|
||||
message = "" //Why wasn't this ported over? Spam is a pain in the butt. Just shaddup already!
|
||||
|
||||
/obj/item/organ/cyberimp/chest/mobility
|
||||
name = "Mobility Nanite Core"
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/obj/item/gun/ballistic/liberator
|
||||
name = "liberator pistol"
|
||||
desc = "Hey, it's better than no gun, right?"
|
||||
icon = 'GainStation13/icons/obj/weapons/gun.dmi' // Sprites were made by Static and Lew
|
||||
icon_state = "liberator"
|
||||
w_class = WEIGHT_CLASS_SMALL // It's not really much of a gun...
|
||||
mag_type = /obj/item/ammo_box/magazine/m10mm/ramrod
|
||||
can_suppress = FALSE
|
||||
/// How many bullets are currently stashed in the gun
|
||||
var/list/stashed_bullets = list()
|
||||
/// What is the max amount of bullets we can stash in this baby?
|
||||
var/max_bullets = 5
|
||||
|
||||
/obj/item/gun/ballistic/liberator/examine(mob/user)
|
||||
. = ..()
|
||||
. += span_notice("Inside of the weapon there is a storage container, containing [length(stashed_bullets)] 10mm bullets.")
|
||||
. += span_notice("Bullets can be removed from the internal storage using <b>Alt+Click</b>.")
|
||||
|
||||
/obj/item/gun/ballistic/liberator/attackby(obj/item/A, mob/user, params)
|
||||
if(!istype(A, /obj/item/ammo_casing/c10mm))
|
||||
return ..()
|
||||
|
||||
if(length(stashed_bullets) >= max_bullets)
|
||||
to_chat(user, span_notice("The storage container in the gun is already full."))
|
||||
return
|
||||
|
||||
|
||||
if(!A.forceMove(src))
|
||||
return
|
||||
|
||||
stashed_bullets += A
|
||||
to_chat(user, span_notice("You slip the [A] inside of the storage chamber."))
|
||||
|
||||
return
|
||||
|
||||
/obj/item/gun/ballistic/liberator/AltClick(mob/user)
|
||||
if(!length(stashed_bullets))
|
||||
to_chat(user, span_notice("The storage container in the gun is already empty."))
|
||||
return
|
||||
|
||||
var/obj/item/removed_bullet = stashed_bullets[1]
|
||||
|
||||
if(!user.put_in_hands(removed_bullet))
|
||||
return
|
||||
|
||||
stashed_bullets.Remove(removed_bullet)
|
||||
to_chat(user, span_notice("You remove the [removed_bullet] from [src]"))
|
||||
|
||||
/obj/item/gun/ballistic/liberator/can_shoot()
|
||||
if(!chambered)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/ammo_box/magazine/m10mm/ramrod // baaaaaaa
|
||||
name = "ram rod"
|
||||
desc = "Allows for bullets to be pushed into guns."
|
||||
icon = 'GainStation13/icons/obj/weapons/gun.dmi'
|
||||
icon_state = "ram_rod"
|
||||
max_ammo = 1
|
||||
multiple_sprites = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user