Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Система постеров для революции #3021

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/_helpers/global_access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,8 @@
return global.restricted_camera_networks;
if("revdata")
return global.revdata;
if("revolution_posters")
return GLOB.revolution_posters;
Comment on lines +750 to +751
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нафиг это нужно?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно для отображения в списке глобальных переменных, который находится в вкладке Debug. Делал для тестов, оставил на всякий случай.

if("robot_custom_icons")
return global.robot_custom_icons;
if("robot_hud_colours")
Expand Down Expand Up @@ -1726,6 +1728,8 @@
global.restricted_camera_networks=newval;
if("revdata")
global.revdata=newval;
if("revolution_posters")
GLOB.revolution_posters=newval;
if("robot_custom_icons")
global.robot_custom_icons=newval;
if("robot_hud_colours")
Expand Down Expand Up @@ -2333,6 +2337,7 @@
"responsive_carriers",
"restricted_camera_networks",
"revdata",
"revolution_posters",
"rkeys",
"robot_custom_icons",
"robot_hud_colours",
Expand Down
25 changes: 25 additions & 0 deletions code/game/antagonist/station/revolutionary.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,28 @@ GLOBAL_DATUM_INIT(revs, /datum/antagonist/revolutionary, new)
rev_obj.target = player.mind
rev_obj.explanation_text = "Assassinate, capture or convert [player.real_name], the [player.mind.assigned_role]."
global_objectives += rev_obj

/datum/antagonist/revolutionary/equip(mob/living/carbon/human/revolutionary)
if(!..())
return 0

equip_poster(revolutionary)
equip_poster(revolutionary)

/datum/antagonist/revolutionary/proc/equip_poster(mob/living/carbon/human/player)

var/obj/item/weapon/contraband/poster/revolutionary/P = new(get_turf(player))
var/list/slots = list (
"backpack" = slot_in_backpack,
"left pocket" = slot_l_store,
"right pocket" = slot_r_store,
"left hand" = slot_l_hand,
"right hand" = slot_r_hand,
)
for(var/slot in slots)
player.equip_to_slot(P, slot)
if(P.loc == player)
break
var/obj/item/weapon/storage/S = locate() in player.contents
if(istype(S))
P.forceMove(S)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не городи велосипеды, используй хелперы из inventory.dm. Например, equip_to_appropriate_slot и equip_to_storage_or_drop.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спасибо, сейчас исправлю.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Заменил на equip_to_storage_or_drop, изменения загружены

1 change: 1 addition & 0 deletions code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
var/global/global_uid = 0
var/uid
var/area_flags
var/score = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше переименовать в strategic_importance. А то слово score ни о чем не говорит.


/area/New()
icon_state = ""
Expand Down
19 changes: 19 additions & 0 deletions code/game/gamemodes/revolution/revolution.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
GLOBAL_LIST_EMPTY(revolution_posters)

/datum/game_mode/revolution
name = "Revolution"
config_tag = "revolution"
Expand All @@ -10,3 +12,20 @@
shuttle_delay = 2
antag_tags = list(MODE_REVOLUTIONARY)
require_all_templates = 1

var/last_poster_update
var/points = 0

/datum/game_mode/revolution/post_setup()
..()
last_poster_update = round_duration_in_ticks + 1 MINUTES


/datum/game_mode/revolution/process()
if(last_poster_update <= round_duration_in_ticks)
Comment on lines +24 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/datum/game_mode/revolution/process()
if(last_poster_update <= round_duration_in_ticks)
/datum/game_mode/revolution/process()
..()
if(last_poster_update <= round_duration_in_ticks)

for(var/obj/structure/P in GLOB.revolution_posters)
if(P && (P.z in GLOB.using_map.station_levels))
points += get_area(P.loc).score
else
GLOB.revolution_posters -= P
last_poster_update = round_duration_in_ticks + 1 MINUTES
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ты здесь складываешь ТИКИ и децисекунды. Нельзя так делать)

Нужно либо все считать в тиках, либо все в децисекундах.

60 changes: 52 additions & 8 deletions code/game/objects/effects/decals/contraband.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
desc = "The poster comes with its own automatic adhesive mechanism, for easy pinning to any vertical surface."
icon_state = "rolled_poster"
var/serial_number = 0
var/revolution = FALSE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь лучше переменную назвать не "революция", а "революционный", т.е. revolutionary



/obj/item/weapon/contraband/poster/New(turf/loc, given_serial = 0)
Expand Down Expand Up @@ -57,8 +58,7 @@

to_chat(user, "<span class='notice'>You start placing the poster on the wall...</span>")//Looks like it's uncluttered enough. Place the poster.


var/obj/structure/sign/poster/P = new(user.loc, placement_dir=get_dir(user, W), serial=serial_number)
var/obj/structure/sign/poster/P = new(user.loc, placement_dir=get_dir(user, W), serial=serial_number, revolution=revolution)

flick("poster_being_set", P)
//playsound(W, 'sound/items/poster_being_created.ogg', 100, 1) //why the hell does placing a poster make printer sounds?
Expand All @@ -75,6 +75,33 @@

qdel(oldsrc) //delete it now to cut down on sanity checks afterwards. Agouri's code supports rerolling it anyway

//REV POSTER
/obj/item/weapon/contraband/poster/revolutionary
name = "rolled-up poster - unknown number"
desc = "This poster has strange message."
revolution = TRUE

/obj/item/weapon/contraband/poster/revolutionary/New(turf/loc)
..(loc, serial_number=666)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В poster/New нет аргумента serial_number. Кажется он тут вообще не нужен.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем вообще New переопределять здесь? Кажется это лишнее.


/obj/item/weapon/contraband/poster/revolutionary/afterattack(atom/A, mob/user, adjacent, clickparams)
var/area/B = get_area(user.loc)
if(istype(B, /area/space))
to_chat(user, SPAN_WARNING("You can't place this poster in space."))
return

if(!(user.z in GLOB.using_map.station_levels))
to_chat(user, SPAN_WARNING("You can place this poster only on station levels,"))
return
Comment on lines +89 to +95
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему? Пусть висят где угодно, но считать будем только размещенные в правильных зонах, не? Это как-то нелогично, что кусок бумаги мы повесить не можем где хотим.


for(var/obj/structure/P in GLOB.revolution_posters)
if(istype(B, get_area(P.loc)))
to_chat(user, SPAN_WARNING("A poster has been placed in this area already."))
return
Comment on lines +97 to +100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже какие-то странные механоограничения вылазят. Пусть обклеивают отсек полностью, чо такого то? Просто когда считаем - надо собирать некий список зон, в который каждая зона может попасть ровно один раз. А потом по этому списку считаем очки.

Так логичнее будет, тебе так не кажется?


..(A, user, adjacent, clickparams)


//############################## THE ACTUAL DECALS ###########################

/obj/structure/sign/poster
Expand All @@ -85,16 +112,22 @@
var/serial_number //Will hold the value of src.loc if nobody initialises it
var/poster_type //So mappers can specify a desired poster
var/ruined = 0
var/revolutionary = FALSE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

О, а здесь нормальная переменная :)


/obj/structure/sign/poster/New(newloc, placement_dir=null, serial=null)
/obj/structure/sign/poster/New(newloc, placement_dir=null, serial=null, revolution=FALSE)
..(newloc)

if(!serial)
serial = rand(1, poster_designs.len) //use a random serial if none is given
if(revolution)
revolutionary = TRUE
set_revolution_poster()
GLOB.revolution_posters += src
else
if(!serial)
serial = rand(1, poster_designs.len) //use a random serial if none is given

serial_number = serial
var/datum/poster/design = poster_designs[serial_number]
set_poster(design)
serial_number = serial
var/datum/poster/design = poster_designs[serial_number]
set_poster(design)

switch (placement_dir)
if (NORTH)
Expand Down Expand Up @@ -122,6 +155,11 @@
desc = "[initial(desc)] [design.desc]"
icon_state = design.icon_state // poster[serial_number]

/obj/structure/sign/poster/proc/set_revolution_poster()
SetName("[initial(name)] - Break our Chains!")
desc = "[initial(desc)] It's time to end golden age of Nanotrasen!"
icon_state = "revposter"

/obj/structure/sign/poster/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(isWirecutter(W))
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
Expand All @@ -131,6 +169,8 @@
else
to_chat(user, "<span class='notice'>You carefully remove the poster from the wall.</span>")
roll_and_drop(user.loc)
if(revolutionary)
GLOB.revolution_posters -= src
Comment on lines +172 to +173
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это лучше запихать в roll_and_drop

return


Expand All @@ -152,6 +192,10 @@
desc = "You can't make out anything from the poster's original print. It's ruined."
add_fingerprint(user)

if(revolutionary)
GLOB.revolution_posters -= src
return

/obj/structure/sign/poster/proc/roll_and_drop(turf/newloc)
var/obj/item/weapon/contraband/poster/P = new(src, serial_number)
P.loc = newloc
Expand Down
Binary file modified icons/obj/contraband.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions maps/shared/exodus_torch/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/area/bridge
name = "\improper Bridge"
icon_state = "bridge"
score = 4

/area/bridge/meeting_room
name = "\improper Heads of Staff Meeting Room"
Expand Down