Skip to content

Commit

Permalink
Slight rewrite of the whole idea
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRomainzZ committed Oct 6, 2024
1 parent 9a26e6e commit 039a309
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 39 deletions.
6 changes: 2 additions & 4 deletions mod_celadon/items/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ ID мода: CELADON_ITEMS

- `code/modules/surgery/organs/tongue.dm`
-`var/static/list/languages_possible_base = typecacheof`
- ADD `code/modules/projectiles/boxes_magazines/_box_magazine.dm`: `var/shuffler`
- EDIT `code/modules/projectiles/ammunition/_ammunition.dm`: `/obj/item/ammo_casing/attackby`
<!--
Если вы редактировали какие-либо процедуры или переменные в кор коде,
они должны быть указаны здесь.
Expand All @@ -44,7 +42,7 @@ ID мода: CELADON_ITEMS

### Оверрайды

- Отсутствуют
- `/obj/item/ammo_casing/attackby`
<!--
Если ты добавлял новый модульный оверрайд, его нужно указать здесь.
Здесь указываются оверрайды в твоём моде и папке `_master_files`
Expand Down Expand Up @@ -83,7 +81,7 @@ ID мода: CELADON_ITEMS

### Авторы:

MrCat15352, MysticalFaceLesS, RalseiDreemuurr
MrCat15352, MysticalFaceLesS, RalseiDreemuurr, MrRomainzZ
<!--
Здесь находится твой никнейм
Если работал совместно - никнеймы тех, кто помогал.
Expand Down
3 changes: 3 additions & 0 deletions mod_celadon/items/_items.dme
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
#include "code/accessories.dm"
#include "code/books.dm"
#include "code/languages.dm"
#include "code/ammunition.dm"
#include "code/box_magazine.dm"
#include "code/shufflers.dm"

#endif
27 changes: 27 additions & 0 deletions mod_celadon/items/code/ammunition.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Part from "code/modules/projectiles/ammunition/_ammunition.dm"

// Overrides proc to add check if ammo_box is a shuffler. Allows shufflers to pick up spent ammo
/obj/item/ammo_casing/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/ammo_box))
var/obj/item/ammo_box/box = I
if(isturf(loc))
var/boolets = 0
for(var/obj/item/ammo_casing/bullet in loc)
if (box.stored_ammo.len >= box.max_ammo)
break
if (bullet.BB || box.shuffler)
if (box.give_round(bullet, 0))
boolets++
// [CELADON-ADD] - CELADON_BALANCE
playsound(loc, 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE)
break
// [/CELADON-ADD]
else
continue
if (boolets > 0)
box.update_appearance()
to_chat(user, "<span class='notice'>You collect [boolets] shell\s. [box] now contains [box.stored_ammo.len] shell\s.</span>")
else
to_chat(user, "<span class='warning'>You fail to collect anything!</span>")
else
return ..()
6 changes: 6 additions & 0 deletions mod_celadon/items/code/box_magazine.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Part from "code/modules/projectiles/boxes_magazines/_box_magazine.dm"

// Adds "shuffler" variable for spent bullets check
/obj/item/ammo_box
/// used to check for spent ammo when picking up (if true then it will pick up spent ammo)
var/shuffler = FALSE
35 changes: 0 additions & 35 deletions mod_celadon/items/code/items.dm
Original file line number Diff line number Diff line change
@@ -1,35 +0,0 @@
/obj/item/ammo_box/a12g/shuffler
name = "buckshot shuffler"
desc = "Buckshot magazine with shuffle function. Don't forget your release of liability."
icon = 'mod_celadon/_storge_icons/icons/ammo/ammo.dmi'
base_icon_state = "buckshot_shuffler"
icon_state = "buckshot_shuffler-0"
caliber = "12ga"
ammo_type = /obj/item/ammo_casing/shotgun/buckshot
max_ammo = 8
start_empty = TRUE
multiple_sprites = AMMO_BOX_PER_BULLET

var/shuffle_sound = 'sound/weapons/gun/shotgun/insert_shell.ogg'

shuffler = TRUE

/obj/item/ammo_box/a12g/shuffler/unique_action(mob/living/user)
stored_ammo = shuffle(stored_ammo)
playsound(src, shuffle_sound, 50, TRUE)
user.visible_message("<span class='notice'>[user] shuffles bullets in [src].</span>", \
"<span class='notice'>You shuffle bullets in [src].</span>", \
"<span class='notice'>You hear shuffling sound.</span>")

/obj/item/ammo_box/a12g/shuffler/examine(mob/user)
. = ..()
. += "Don't load blanks for roulette. They're painful. Load spent shots"
. += "You can shuffle [src] by pressing the <b>unique action</b> key. By default, this is <b>space</b>"

/datum/design/a12g_shuffler
name = "Buckshot Shuffler"
id = "buckshot_shuffler"
build_type = AUTOLATHE
materials = list(/datum/material/iron = 8000)
build_path = /obj/item/ammo_box/a12g/shuffler
category = list("initial", "Security")
42 changes: 42 additions & 0 deletions mod_celadon/items/code/shufflers.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/obj/item/ammo_box/shuffler
name = "ammo shuffler"
desc = "Default ammo shuffler"

var/shuffle_sound = 'sound/weapons/gun/shotgun/insert_shell.ogg'

shuffler = TRUE

/obj/item/ammo_box/shuffler/unique_action(mob/living/user)
stored_ammo = shuffle(stored_ammo)
playsound(src, shuffle_sound, 50, TRUE)
user.visible_message("<span class='notice'>[user] shuffles bullets in [src].</span>", \
"<span class='notice'>You shuffle bullets in [src].</span>", \
"<span class='notice'>You hear shuffling sound.</span>")

/obj/item/ammo_box/shuffler/examine(mob/user)
. = ..()
. += "You can shuffle [src] by pressing the <b>unique action</b> key. By default, this is <b>space</b>"

/obj/item/ammo_box/shuffler/a12g
name = "buckshot shuffler"
desc = "Buckshot magazine with shuffle function. Don't forget your release of liability."
icon = 'mod_celadon/_storge_icons/icons/ammo/ammo.dmi'
base_icon_state = "buckshot_shuffler"
icon_state = "buckshot_shuffler-0"
caliber = "12ga"
ammo_type = /obj/item/ammo_casing/shotgun/buckshot
max_ammo = 8
start_empty = TRUE
multiple_sprites = AMMO_BOX_PER_BULLET

/obj/item/ammo_box/shuffler/a12g/examine(mob/user)
. = ..()
. += "Don't load blanks for roulette. They're painful. Load spent shots"

/datum/design/a12g_shuffler
name = "Buckshot Shuffler"
id = "buckshot_shuffler"
build_type = AUTOLATHE
materials = list(/datum/material/iron = 8000)
build_path = /obj/item/ammo_box/shuffler/a12g
category = list("initial", "Security")

0 comments on commit 039a309

Please sign in to comment.